From b55cab45d71650a87372dce00f2e036dd7927003 Mon Sep 17 00:00:00 2001 From: Albert Gasset Date: Tue, 10 Sep 2019 16:29:25 +0200 Subject: [PATCH 1/3] MOBILE-3147 scripts: Script to remove jsdoc types --- scripts/remove-jsdocs-types.js | 71 ++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 scripts/remove-jsdocs-types.js diff --git a/scripts/remove-jsdocs-types.js b/scripts/remove-jsdocs-types.js new file mode 100644 index 000000000..0392c4d1c --- /dev/null +++ b/scripts/remove-jsdocs-types.js @@ -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) +}) From a7c2d22cb89fc428e433d7143b3270bc5cb37239 Mon Sep 17 00:00:00 2001 From: Albert Gasset Date: Tue, 10 Sep 2019 16:48:56 +0200 Subject: [PATCH 2/3] MOBILE-3147 doc: Remove jsdoc types from all typescript files --- .../badges/pages/issued-badge/issued-badge.ts | 4 +- .../badges/pages/user-badges/user-badges.ts | 6 +- .../badges/providers/badge-link-handler.ts | 20 +- src/addon/badges/providers/badges.ts | 26 +- .../badges/providers/mybadges-link-handler.ts | 20 +- .../badges/providers/push-click-handler.ts | 8 +- src/addon/badges/providers/user-handler.ts | 14 +- .../activitymodules/activitymodules.ts | 4 +- .../providers/block-handler.ts | 10 +- .../block/badges/providers/block-handler.ts | 10 +- .../block/blogmenu/providers/block-handler.ts | 10 +- .../blogrecent/providers/block-handler.ts | 10 +- .../block/blogtags/providers/block-handler.ts | 10 +- .../calendarmonth/providers/block-handler.ts | 10 +- .../providers/block-handler.ts | 10 +- .../block/comments/providers/block-handler.ts | 10 +- .../providers/block-handler.ts | 10 +- .../glossaryrandom/providers/block-handler.ts | 10 +- .../block/html/providers/block-handler.ts | 10 +- .../learningplans/providers/block-handler.ts | 10 +- .../components/myoverview/myoverview.ts | 14 +- .../myoverview/providers/block-handler.ts | 12 +- .../newsitems/providers/block-handler.ts | 10 +- .../onlineusers/providers/block-handler.ts | 10 +- .../privatefiles/providers/block-handler.ts | 10 +- .../recentactivity/providers/block-handler.ts | 10 +- .../recentlyaccessedcourses.ts | 6 +- .../providers/block-handler.ts | 10 +- .../recentlyaccesseditems.ts | 8 +- .../providers/block-handler.ts | 10 +- .../providers/recentlyaccesseditems.ts | 10 +- .../rssclient/providers/block-handler.ts | 10 +- .../selfcompletion/providers/block-handler.ts | 10 +- .../components/sitemainmenu/sitemainmenu.ts | 4 +- .../sitemainmenu/providers/block-handler.ts | 10 +- .../starredcourses/starredcourses.ts | 6 +- .../starredcourses/providers/block-handler.ts | 10 +- .../block/tags/providers/block-handler.ts | 10 +- .../timeline/components/events/events.ts | 10 +- .../timeline/components/timeline/timeline.ts | 16 +- .../block/timeline/providers/block-handler.ts | 12 +- .../block/timeline/providers/timeline.ts | 52 +- src/addon/blog/components/entries/entries.ts | 12 +- src/addon/blog/providers/blog.ts | 28 +- .../blog/providers/course-option-handler.ts | 30 +- .../blog/providers/index-link-handler.ts | 20 +- src/addon/blog/providers/mainmenu-handler.ts | 4 +- src/addon/blog/providers/tag-area-handler.ts | 10 +- src/addon/blog/providers/user-handler.ts | 14 +- .../calendar/components/calendar/calendar.ts | 26 +- .../upcoming-events/upcoming-events.ts | 20 +- src/addon/calendar/pages/day/day.ts | 50 +- .../calendar/pages/edit-event/edit-event.ts | 22 +- src/addon/calendar/pages/event/event.ts | 30 +- src/addon/calendar/pages/index/index.ts | 30 +- src/addon/calendar/pages/list/list.ts | 64 +- src/addon/calendar/pages/settings/settings.ts | 2 +- .../calendar/providers/calendar-offline.ts | 78 +- src/addon/calendar/providers/calendar-sync.ts | 28 +- src/addon/calendar/providers/calendar.ts | 426 ++++----- src/addon/calendar/providers/helper.ts | 64 +- .../calendar/providers/mainmenu-handler.ts | 4 +- .../calendar/providers/sync-cron-handler.ts | 8 +- .../calendar/providers/view-link-handler.ts | 20 +- .../competency/components/course/course.ts | 8 +- .../pages/competencies/competencies.ts | 6 +- .../competency/pages/competency/competency.ts | 6 +- .../competencysummary/competencysummary.ts | 6 +- src/addon/competency/pages/plan/plan.ts | 6 +- .../competency/pages/planlist/planlist.ts | 6 +- .../providers/competency-link-handler.ts | 20 +- src/addon/competency/providers/competency.ts | 174 ++-- .../providers/course-option-handler.ts | 30 +- src/addon/competency/providers/helper.ts | 10 +- .../competency/providers/mainmenu-handler.ts | 4 +- .../competency/providers/plan-link-handler.ts | 20 +- .../providers/plans-link-handler.ts | 20 +- .../providers/push-click-handler.ts | 8 +- .../providers/user-competency-link-handler.ts | 20 +- .../competency/providers/user-handler.ts | 14 +- .../components/report/report.ts | 4 +- .../providers/course-option-handler.ts | 28 +- .../providers/coursecompletion.ts | 50 +- .../providers/user-handler.ts | 14 +- src/addon/files/pages/list/list.ts | 6 +- src/addon/files/providers/files.ts | 100 +- src/addon/files/providers/helper.ts | 4 +- src/addon/files/providers/mainmenu-handler.ts | 4 +- .../airnotifier/pages/devices/devices.ts | 8 +- .../airnotifier/providers/airnotifier.ts | 20 +- .../airnotifier/providers/handler.ts | 6 +- src/addon/messageoutput/providers/delegate.ts | 14 +- .../confirmed-contacts/confirmed-contacts.ts | 16 +- .../contact-requests/contact-requests.ts | 16 +- .../messages/components/contacts/contacts.ts | 22 +- .../components/discussions/discussions.ts | 18 +- src/addon/messages/pages/contacts/contacts.ts | 6 +- .../conversation-info/conversation-info.ts | 16 +- .../messages/pages/discussion/discussion.ts | 86 +- .../group-conversations.ts | 68 +- src/addon/messages/pages/index/index.ts | 4 +- src/addon/messages/pages/search/search.ts | 16 +- src/addon/messages/pages/settings/settings.ts | 12 +- .../providers/contact-request-link-handler.ts | 20 +- .../providers/discussion-link-handler.ts | 20 +- .../messages/providers/index-link-handler.ts | 20 +- .../messages/providers/mainmenu-handler.ts | 32 +- .../messages/providers/messages-offline.ts | 86 +- src/addon/messages/providers/messages.ts | 715 +++++++------- .../messages/providers/push-click-handler.ts | 8 +- .../messages/providers/settings-handler.ts | 4 +- .../messages/providers/sync-cron-handler.ts | 8 +- src/addon/messages/providers/sync.ts | 44 +- .../providers/user-add-contact-handler.ts | 27 +- .../providers/user-block-contact-handler.ts | 23 +- .../providers/user-send-message-handler.ts | 14 +- .../assign/classes/base-feedback-handler.ts | 90 +- .../assign/classes/base-submission-handler.ts | 130 +-- .../classes/feedback-plugin-component.ts | 4 +- .../classes/submission-plugin-component.ts | 2 +- .../feedback-plugin/feedback-plugin.ts | 2 +- .../mod/assign/components/index/index.ts | 28 +- .../submission-plugin/submission-plugin.ts | 2 +- .../components/submission/submission.ts | 28 +- .../feedback/comments/component/comments.ts | 6 +- .../feedback/comments/providers/handler.ts | 94 +- .../feedback/editpdf/providers/handler.ts | 18 +- .../assign/feedback/file/providers/handler.ts | 18 +- .../edit-feedback-modal.ts | 10 +- src/addon/mod/assign/pages/edit/edit.ts | 14 +- src/addon/mod/assign/pages/index/index.ts | 2 +- .../pages/submission-list/submission-list.ts | 12 +- .../submission-review/submission-review.ts | 8 +- .../mod/assign/providers/assign-offline.ts | 136 +-- src/addon/mod/assign/providers/assign-sync.ts | 60 +- src/addon/mod/assign/providers/assign.ts | 376 ++++---- .../mod/assign/providers/feedback-delegate.ts | 191 ++-- src/addon/mod/assign/providers/helper.ts | 178 ++-- .../mod/assign/providers/list-link-handler.ts | 2 +- .../mod/assign/providers/module-handler.ts | 16 +- .../mod/assign/providers/prefetch-handler.ts | 94 +- .../assign/providers/push-click-handler.ts | 8 +- .../assign/providers/submission-delegate.ts | 271 +++--- .../mod/assign/providers/sync-cron-handler.ts | 8 +- .../submission/comments/component/comments.ts | 2 +- .../submission/comments/providers/handler.ts | 30 +- .../submission/file/providers/handler.ts | 120 +-- .../onlinetext/component/onlinetext.ts | 2 +- .../onlinetext/providers/handler.ts | 106 +-- src/addon/mod/book/components/index/index.ts | 16 +- src/addon/mod/book/pages/index/index.ts | 2 +- src/addon/mod/book/pages/toc/toc.ts | 2 +- src/addon/mod/book/providers/book.ts | 93 +- src/addon/mod/book/providers/link-handler.ts | 10 +- .../mod/book/providers/list-link-handler.ts | 10 +- .../mod/book/providers/module-handler.ts | 18 +- .../mod/book/providers/prefetch-handler.ts | 28 +- .../mod/book/providers/tag-area-handler.ts | 10 +- src/addon/mod/chat/components/index/index.ts | 8 +- src/addon/mod/chat/pages/chat/chat.ts | 16 +- src/addon/mod/chat/pages/index/index.ts | 2 +- .../session-messages/session-messages.ts | 10 +- src/addon/mod/chat/pages/sessions/sessions.ts | 12 +- src/addon/mod/chat/pages/users/users.ts | 4 +- src/addon/mod/chat/providers/chat.ts | 130 +-- .../mod/chat/providers/module-handler.ts | 16 +- .../mod/chat/providers/prefetch-handler.ts | 46 +- .../mod/choice/components/index/index.ts | 34 +- src/addon/mod/choice/pages/index/index.ts | 2 +- src/addon/mod/choice/providers/choice.ts | 146 +-- .../mod/choice/providers/module-handler.ts | 16 +- src/addon/mod/choice/providers/offline.ts | 44 +- .../mod/choice/providers/prefetch-handler.ts | 46 +- .../mod/choice/providers/sync-cron-handler.ts | 8 +- src/addon/mod/choice/providers/sync.ts | 34 +- .../data/classes/field-plugin-component.ts | 6 +- .../mod/data/components/action/action.ts | 2 +- src/addon/mod/data/components/index/index.ts | 32 +- .../fields/checkbox/component/checkbox.ts | 2 +- .../data/fields/checkbox/providers/handler.ts | 42 +- .../mod/data/fields/date/providers/handler.ts | 42 +- .../mod/data/fields/file/component/file.ts | 6 +- .../mod/data/fields/file/providers/handler.ts | 46 +- .../data/fields/latlong/component/latlong.ts | 14 +- .../data/fields/latlong/providers/handler.ts | 42 +- .../mod/data/fields/menu/providers/handler.ts | 42 +- .../fields/multimenu/component/multimenu.ts | 2 +- .../fields/multimenu/providers/handler.ts | 42 +- .../data/fields/number/providers/handler.ts | 20 +- .../data/fields/picture/component/picture.ts | 12 +- .../data/fields/picture/providers/handler.ts | 46 +- .../fields/radiobutton/providers/handler.ts | 42 +- .../mod/data/fields/text/providers/handler.ts | 42 +- .../fields/textarea/component/textarea.ts | 4 +- .../data/fields/textarea/providers/handler.ts | 34 +- .../mod/data/fields/url/providers/handler.ts | 18 +- src/addon/mod/data/pages/edit/edit.ts | 16 +- src/addon/mod/data/pages/entry/entry.ts | 24 +- src/addon/mod/data/pages/index/index.ts | 2 +- src/addon/mod/data/pages/search/search.ts | 12 +- .../data/providers/approve-link-handler.ts | 20 +- src/addon/mod/data/providers/data.ts | 350 +++---- .../data/providers/default-field-handler.ts | 40 +- .../mod/data/providers/delete-link-handler.ts | 20 +- .../mod/data/providers/edit-link-handler.ts | 20 +- .../mod/data/providers/fields-delegate.ts | 105 +-- src/addon/mod/data/providers/helper.ts | 190 ++-- .../mod/data/providers/list-link-handler.ts | 2 +- .../mod/data/providers/module-handler.ts | 16 +- src/addon/mod/data/providers/offline.ts | 100 +- .../mod/data/providers/prefetch-handler.ts | 92 +- .../mod/data/providers/show-link-handler.ts | 20 +- .../mod/data/providers/sync-cron-handler.ts | 8 +- src/addon/mod/data/providers/sync.ts | 48 +- .../mod/data/providers/tag-area-handler.ts | 10 +- .../mod/feedback/components/index/index.ts | 46 +- .../mod/feedback/pages/attempt/attempt.ts | 2 +- src/addon/mod/feedback/pages/form/form.ts | 10 +- src/addon/mod/feedback/pages/index/index.ts | 2 +- .../pages/nonrespondents/nonrespondents.ts | 12 +- .../feedback/pages/respondents/respondents.ts | 14 +- .../providers/analysis-link-handler.ts | 20 +- .../providers/complete-link-handler.ts | 20 +- src/addon/mod/feedback/providers/feedback.ts | 382 ++++---- src/addon/mod/feedback/providers/helper.ts | 96 +- .../feedback/providers/list-link-handler.ts | 2 +- .../mod/feedback/providers/module-handler.ts | 16 +- src/addon/mod/feedback/providers/offline.ts | 44 +- .../feedback/providers/prefetch-handler.ts | 62 +- .../feedback/providers/print-link-handler.ts | 20 +- .../feedback/providers/push-click-handler.ts | 8 +- .../providers/show-entries-link-handler.ts | 20 +- .../show-non-respondents-link-handler.ts | 20 +- .../feedback/providers/sync-cron-handler.ts | 8 +- src/addon/mod/feedback/providers/sync.ts | 46 +- .../mod/folder/components/index/index.ts | 8 +- src/addon/mod/folder/pages/index/index.ts | 2 +- src/addon/mod/folder/providers/folder.ts | 45 +- src/addon/mod/folder/providers/helper.ts | 4 +- .../mod/folder/providers/module-handler.ts | 16 +- .../folder/providers/pluginfile-handler.ts | 8 +- .../mod/folder/providers/prefetch-handler.ts | 26 +- src/addon/mod/forum/components/index/index.ts | 42 +- src/addon/mod/forum/components/post/post.ts | 16 +- .../mod/forum/pages/discussion/discussion.ts | 40 +- src/addon/mod/forum/pages/index/index.ts | 2 +- .../pages/new-discussion/new-discussion.ts | 30 +- .../sort-order-selector.ts | 2 +- .../providers/discussion-link-handler.ts | 22 +- src/addon/mod/forum/providers/forum.ts | 280 +++--- src/addon/mod/forum/providers/helper.ts | 136 ++- .../mod/forum/providers/index-link-handler.ts | 20 +- .../mod/forum/providers/module-handler.ts | 26 +- src/addon/mod/forum/providers/offline.ts | 156 +-- .../mod/forum/providers/post-link-handler.ts | 20 +- .../mod/forum/providers/prefetch-handler.ts | 64 +- .../mod/forum/providers/push-click-handler.ts | 8 +- .../mod/forum/providers/sync-cron-handler.ts | 8 +- src/addon/mod/forum/providers/sync.ts | 106 +-- .../mod/forum/providers/tag-area-handler.ts | 10 +- .../mod/glossary/components/index/index.ts | 40 +- .../components/mode-picker/mode-picker.ts | 6 +- src/addon/mod/glossary/pages/edit/edit.ts | 4 +- src/addon/mod/glossary/pages/entry/entry.ts | 8 +- src/addon/mod/glossary/pages/index/index.ts | 2 +- .../glossary/providers/edit-link-handler.ts | 20 +- .../glossary/providers/entry-link-handler.ts | 10 +- src/addon/mod/glossary/providers/glossary.ts | 420 ++++----- src/addon/mod/glossary/providers/helper.ts | 54 +- .../mod/glossary/providers/module-handler.ts | 18 +- src/addon/mod/glossary/providers/offline.ts | 84 +- .../glossary/providers/prefetch-handler.ts | 50 +- .../glossary/providers/sync-cron-handler.ts | 8 +- src/addon/mod/glossary/providers/sync.ts | 60 +- .../glossary/providers/tag-area-handler.ts | 10 +- src/addon/mod/imscp/components/index/index.ts | 12 +- src/addon/mod/imscp/pages/index/index.ts | 2 +- src/addon/mod/imscp/pages/toc/toc.ts | 6 +- src/addon/mod/imscp/providers/imscp.ts | 94 +- .../mod/imscp/providers/list-link-handler.ts | 2 +- .../mod/imscp/providers/module-handler.ts | 16 +- .../mod/imscp/providers/pluginfile-handler.ts | 8 +- .../mod/imscp/providers/prefetch-handler.ts | 38 +- src/addon/mod/label/providers/label.ts | 64 +- .../mod/label/providers/module-handler.ts | 18 +- .../mod/label/providers/prefetch-handler.ts | 20 +- .../mod/lesson/components/index/index.ts | 48 +- src/addon/mod/lesson/pages/index/index.ts | 2 +- .../mod/lesson/pages/menu-modal/menu-modal.ts | 3 +- .../pages/password-modal/password-modal.ts | 4 +- src/addon/mod/lesson/pages/player/player.ts | 46 +- .../lesson/pages/user-retake/user-retake.ts | 12 +- .../lesson/providers/grade-link-handler.ts | 22 +- src/addon/mod/lesson/providers/helper.ts | 44 +- .../lesson/providers/index-link-handler.ts | 32 +- .../mod/lesson/providers/lesson-offline.ts | 190 ++-- src/addon/mod/lesson/providers/lesson-sync.ts | 74 +- src/addon/mod/lesson/providers/lesson.ts | 891 +++++++++--------- .../mod/lesson/providers/list-link-handler.ts | 2 +- .../mod/lesson/providers/module-handler.ts | 16 +- .../mod/lesson/providers/prefetch-handler.ts | 88 +- .../lesson/providers/push-click-handler.ts | 8 +- .../lesson/providers/report-link-handler.ts | 48 +- .../mod/lesson/providers/sync-cron-handler.ts | 8 +- src/addon/mod/lti/components/index/index.ts | 10 +- src/addon/mod/lti/pages/index/index.ts | 2 +- src/addon/mod/lti/providers/lti.ts | 48 +- src/addon/mod/lti/providers/module-handler.ts | 16 +- src/addon/mod/page/components/index/index.ts | 6 +- src/addon/mod/page/pages/index/index.ts | 2 +- src/addon/mod/page/providers/helper.ts | 10 +- .../mod/page/providers/list-link-handler.ts | 2 +- .../mod/page/providers/module-handler.ts | 16 +- src/addon/mod/page/providers/page.ts | 49 +- .../mod/page/providers/pluginfile-handler.ts | 8 +- .../mod/page/providers/prefetch-handler.ts | 26 +- .../delaybetweenattempts/providers/handler.ts | 12 +- .../ipaddress/providers/handler.ts | 12 +- .../numattempts/providers/handler.ts | 12 +- .../offlineattempts/providers/handler.ts | 28 +- .../openclosedate/providers/handler.ts | 20 +- .../accessrules/password/providers/handler.ts | 72 +- .../safebrowser/providers/handler.ts | 12 +- .../securewindow/providers/handler.ts | 12 +- .../timelimit/providers/handler.ts | 24 +- src/addon/mod/quiz/classes/auto-save.ts | 40 +- src/addon/mod/quiz/components/index/index.ts | 34 +- src/addon/mod/quiz/pages/attempt/attempt.ts | 8 +- src/addon/mod/quiz/pages/index/index.ts | 2 +- .../navigation-modal/navigation-modal.ts | 5 +- src/addon/mod/quiz/pages/player/player.ts | 46 +- .../pages/preflight-modal/preflight-modal.ts | 2 +- src/addon/mod/quiz/pages/review/review.ts | 20 +- .../quiz/providers/access-rules-delegate.ts | 147 ++- .../mod/quiz/providers/grade-link-handler.ts | 10 +- src/addon/mod/quiz/providers/helper.ts | 90 +- .../mod/quiz/providers/index-link-handler.ts | 10 +- .../mod/quiz/providers/module-handler.ts | 16 +- .../mod/quiz/providers/prefetch-handler.ts | 124 +-- .../mod/quiz/providers/push-click-handler.ts | 8 +- src/addon/mod/quiz/providers/quiz-offline.ts | 90 +- src/addon/mod/quiz/providers/quiz-sync.ts | 78 +- src/addon/mod/quiz/providers/quiz.ts | 674 ++++++------- .../mod/quiz/providers/review-link-handler.ts | 22 +- .../mod/quiz/providers/sync-cron-handler.ts | 8 +- .../mod/resource/components/index/index.ts | 6 +- src/addon/mod/resource/pages/index/index.ts | 2 +- src/addon/mod/resource/providers/helper.ts | 30 +- .../resource/providers/list-link-handler.ts | 2 +- .../mod/resource/providers/module-handler.ts | 28 +- .../resource/providers/pluginfile-handler.ts | 8 +- .../resource/providers/prefetch-handler.ts | 42 +- src/addon/mod/resource/providers/resource.ts | 50 +- src/addon/mod/scorm/classes/data-model-12.ts | 82 +- src/addon/mod/scorm/components/index/index.ts | 48 +- src/addon/mod/scorm/pages/index/index.ts | 2 +- src/addon/mod/scorm/pages/player/player.ts | 20 +- src/addon/mod/scorm/pages/toc/toc.ts | 2 +- src/addon/mod/scorm/providers/helper.ts | 80 +- .../mod/scorm/providers/module-handler.ts | 16 +- .../mod/scorm/providers/pluginfile-handler.ts | 8 +- .../mod/scorm/providers/prefetch-handler.ts | 125 ++- .../mod/scorm/providers/scorm-offline.ts | 236 ++--- src/addon/mod/scorm/providers/scorm-sync.ts | 139 ++- src/addon/mod/scorm/providers/scorm.ts | 442 +++++---- .../mod/scorm/providers/sync-cron-handler.ts | 8 +- .../mod/survey/components/index/index.ts | 24 +- src/addon/mod/survey/pages/index/index.ts | 2 +- src/addon/mod/survey/providers/helper.ts | 12 +- .../mod/survey/providers/module-handler.ts | 16 +- src/addon/mod/survey/providers/offline.ts | 50 +- .../mod/survey/providers/prefetch-handler.ts | 48 +- src/addon/mod/survey/providers/survey.ts | 100 +- .../mod/survey/providers/sync-cron-handler.ts | 8 +- src/addon/mod/survey/providers/sync.ts | 34 +- src/addon/mod/url/components/index/index.ts | 12 +- src/addon/mod/url/pages/index/index.ts | 2 +- src/addon/mod/url/providers/helper.ts | 2 +- src/addon/mod/url/providers/module-handler.ts | 26 +- src/addon/mod/url/providers/url.ts | 54 +- src/addon/mod/wiki/components/index/index.ts | 74 +- .../subwiki-picker/subwiki-picker.ts | 6 +- src/addon/mod/wiki/pages/edit/edit.ts | 22 +- src/addon/mod/wiki/pages/index/index.ts | 2 +- .../mod/wiki/providers/create-link-handler.ts | 18 +- .../mod/wiki/providers/edit-link-handler.ts | 10 +- .../mod/wiki/providers/module-handler.ts | 16 +- .../providers/page-or-map-link-handler.ts | 20 +- .../mod/wiki/providers/prefetch-handler.ts | 68 +- .../mod/wiki/providers/sync-cron-handler.ts | 8 +- .../mod/wiki/providers/tag-area-handler.ts | 10 +- src/addon/mod/wiki/providers/wiki-offline.ts | 76 +- src/addon/mod/wiki/providers/wiki-sync.ts | 64 +- src/addon/mod/wiki/providers/wiki.ts | 309 +++--- .../accumulative/providers/handler.ts | 24 +- .../assessment/comments/providers/handler.ts | 24 +- .../assessment/numerrors/providers/handler.ts | 24 +- .../assessment/rubric/providers/handler.ts | 24 +- .../assessment-strategy.ts | 8 +- .../mod/workshop/components/index/index.ts | 34 +- .../workshop/pages/assessment/assessment.ts | 12 +- .../pages/edit-submission/edit-submission.ts | 12 +- src/addon/mod/workshop/pages/index/index.ts | 2 +- src/addon/mod/workshop/pages/phase/phase.ts | 2 +- .../workshop/pages/submission/submission.ts | 16 +- .../providers/assessment-strategy-delegate.ts | 57 +- src/addon/mod/workshop/providers/helper.ts | 212 ++--- .../workshop/providers/list-link-handler.ts | 2 +- .../mod/workshop/providers/module-handler.ts | 16 +- src/addon/mod/workshop/providers/offline.ts | 230 ++--- .../workshop/providers/prefetch-handler.ts | 72 +- .../workshop/providers/sync-cron-handler.ts | 8 +- src/addon/mod/workshop/providers/sync.ts | 70 +- src/addon/mod/workshop/providers/workshop.ts | 540 +++++------ src/addon/notes/components/list/list.ts | 26 +- src/addon/notes/pages/add/add.ts | 2 +- .../notes/providers/course-option-handler.ts | 20 +- src/addon/notes/providers/notes-offline.ts | 104 +- src/addon/notes/providers/notes-sync.ts | 24 +- src/addon/notes/providers/notes.ts | 120 +-- .../notes/providers/sync-cron-handler.ts | 8 +- src/addon/notes/providers/user-handler.ts | 16 +- .../components/actions/actions.ts | 4 +- src/addon/notifications/pages/list/list.ts | 12 +- .../notifications/pages/settings/settings.ts | 16 +- .../notifications/providers/cron-handler.ts | 22 +- src/addon/notifications/providers/helper.ts | 14 +- .../providers/mainmenu-handler.ts | 6 +- .../notifications/providers/notifications.ts | 104 +- .../providers/push-click-handler.ts | 8 +- .../providers/settings-handler.ts | 4 +- .../qbehaviour/adaptive/providers/handler.ts | 10 +- .../adaptivenopenalty/providers/handler.ts | 10 +- .../deferredcbm/providers/handler.ts | 38 +- .../deferredfeedback/providers/handler.ts | 44 +- .../immediatecbm/providers/handler.ts | 10 +- .../immediatefeedback/providers/handler.ts | 10 +- .../informationitem/providers/handler.ts | 20 +- .../interactive/providers/handler.ts | 10 +- .../interactivecountback/providers/handler.ts | 10 +- .../manualgraded/providers/handler.ts | 44 +- .../qtype/calculated/providers/handler.ts | 40 +- .../calculatedmulti/providers/handler.ts | 28 +- .../calculatedsimple/providers/handler.ts | 28 +- .../ddimageortext/classes/ddimageortext.ts | 52 +- .../qtype/ddimageortext/providers/handler.ts | 34 +- src/addon/qtype/ddmarker/classes/ddmarker.ts | 116 +-- .../qtype/ddmarker/classes/graphics_api.ts | 10 +- src/addon/qtype/ddmarker/providers/handler.ts | 40 +- src/addon/qtype/ddwtos/classes/ddwtos.ts | 66 +- src/addon/qtype/ddwtos/providers/handler.ts | 34 +- .../qtype/description/providers/handler.ts | 20 +- src/addon/qtype/essay/providers/handler.ts | 48 +- .../qtype/gapselect/providers/handler.ts | 34 +- src/addon/qtype/match/providers/handler.ts | 34 +- .../qtype/multianswer/providers/handler.ts | 40 +- .../qtype/multichoice/providers/handler.ts | 52 +- .../qtype/randomsamatch/providers/handler.ts | 28 +- .../qtype/shortanswer/providers/handler.ts | 28 +- .../qtype/truefalse/providers/handler.ts | 38 +- .../remotethemes/providers/remotethemes.ts | 42 +- .../pages/course-storage/course-storage.ts | 6 +- .../providers/coursemenu-handler.ts | 18 +- .../checkbox/providers/handler.ts | 16 +- .../datetime/providers/handler.ts | 16 +- .../menu/providers/handler.ts | 16 +- .../text/providers/handler.ts | 16 +- .../textarea/providers/handler.ts | 16 +- src/app/app.component.ts | 4 +- src/classes/base-sync.ts | 87 +- src/classes/cache.ts | 22 +- src/classes/delegate.ts | 91 +- src/classes/interceptor.ts | 6 +- src/classes/site.ts | 329 +++---- src/classes/sqlitedb.ts | 330 +++---- src/components/attachments/attachments.ts | 8 +- src/components/chart/chart.ts | 4 +- .../context-menu/context-menu-item.ts | 6 +- .../context-menu/context-menu-popover.ts | 6 +- src/components/context-menu/context-menu.ts | 8 +- .../course-picker-menu-popover.ts | 6 +- .../download-refresh/download-refresh.ts | 4 +- .../dynamic-component/dynamic-component.ts | 8 +- src/components/file/file.ts | 10 +- src/components/icon/icon.ts | 4 +- src/components/iframe/iframe.ts | 2 - .../infinite-loading/infinite-loading.ts | 10 +- src/components/ion-tabs/ion-tabs.ts | 31 +- src/components/local-file/local-file.ts | 10 +- .../navbar-buttons/navbar-buttons.ts | 14 +- src/components/recaptcha/recaptchamodal.ts | 2 +- .../rich-text-editor/rich-text-editor.ts | 38 +- src/components/search-box/search-box.ts | 2 +- .../send-message-form/send-message-form.ts | 6 +- src/components/show-password/show-password.ts | 2 +- src/components/split-view/split-view.ts | 18 +- src/components/style/style.ts | 6 +- src/components/tabs/tab.ts | 4 +- src/components/tabs/tabs.ts | 14 +- .../block/classes/base-block-component.ts | 24 +- src/core/block/classes/base-block-handler.ts | 12 +- src/core/block/components/block/block.ts | 10 +- .../components/course-blocks/course-blocks.ts | 4 +- src/core/block/providers/delegate.ts | 53 +- src/core/block/providers/helper.ts | 6 +- .../comments/components/comments/comments.ts | 10 +- src/core/comments/pages/add/add.ts | 2 +- src/core/comments/pages/viewer/viewer.ts | 32 +- src/core/comments/providers/comments.ts | 148 +-- src/core/comments/providers/offline.ts | 116 +-- .../comments/providers/sync-cron-handler.ts | 8 +- src/core/comments/providers/sync.ts | 52 +- .../components/compile-html/compile-html.ts | 12 +- src/core/compile/providers/compile.ts | 30 +- src/core/contentlinks/classes/base-handler.ts | 33 +- .../classes/module-grade-handler.ts | 34 +- .../classes/module-index-handler.ts | 17 +- .../classes/module-list-handler.ts | 17 +- .../pages/choose-site/choose-site.ts | 2 +- src/core/contentlinks/providers/delegate.ts | 77 +- src/core/contentlinks/providers/helper.ts | 56 +- .../classes/activity-prefetch-handler.ts | 64 +- src/core/course/classes/activity-sync.ts | 10 +- .../course/classes/main-activity-component.ts | 56 +- .../course/classes/main-resource-component.ts | 28 +- .../course/classes/module-prefetch-handler.ts | 128 ++- .../classes/resource-prefetch-handler.ts | 54 +- src/core/course/components/format/format.ts | 38 +- .../module-completion/module-completion.ts | 2 +- src/core/course/components/module/module.ts | 10 +- .../course/components/tag-area/tag-area.ts | 2 +- .../components/singleactivity.ts | 8 +- .../singleactivity/providers/handler.ts | 36 +- .../formats/topics/providers/handler.ts | 2 +- .../course/formats/weeks/providers/handler.ts | 14 +- .../pages/list-mod-type/list-mod-type.ts | 4 +- .../section-selector/section-selector.ts | 2 +- src/core/course/pages/section/section.ts | 18 +- src/core/course/providers/course-offline.ts | 34 +- .../providers/course-tag-area-handler.ts | 10 +- src/core/course/providers/course.ts | 278 +++--- src/core/course/providers/default-format.ts | 48 +- src/core/course/providers/default-module.ts | 20 +- src/core/course/providers/format-delegate.ts | 159 ++-- src/core/course/providers/helper.ts | 316 +++---- src/core/course/providers/log-cron-handler.ts | 10 +- src/core/course/providers/log-helper.ts | 124 +-- src/core/course/providers/module-delegate.ts | 116 +-- .../providers/module-prefetch-delegate.ts | 343 ++++--- .../providers/modules-tag-area-handler.ts | 10 +- src/core/course/providers/options-delegate.ts | 176 ++-- .../course/providers/sync-cron-handler.ts | 8 +- src/core/course/providers/sync.ts | 24 +- .../course-list-item/course-list-item.ts | 2 +- .../course-options-menu.ts | 2 +- .../course-progress/course-progress.ts | 12 +- .../components/my-courses/my-courses.ts | 8 +- .../available-courses/available-courses.ts | 4 +- .../courses/pages/categories/categories.ts | 6 +- .../pages/course-preview/course-preview.ts | 22 +- src/core/courses/pages/dashboard/dashboard.ts | 8 +- src/core/courses/pages/search/search.ts | 6 +- .../self-enrol-password.ts | 4 +- .../courses/providers/course-link-handler.ts | 48 +- .../providers/courses-index-link-handler.ts | 10 +- src/core/courses/providers/courses.ts | 300 +++--- .../providers/dashboard-link-handler.ts | 20 +- src/core/courses/providers/dashboard.ts | 28 +- .../providers/enrol-push-click-handler.ts | 8 +- src/core/courses/providers/helper.ts | 28 +- .../courses/providers/mainmenu-handler.ts | 8 +- .../providers/request-push-click-handler.ts | 8 +- src/core/emulator/classes/filesystem.ts | 104 +- .../emulator/classes/inappbrowserobject.ts | 18 +- src/core/emulator/classes/sqlitedb.ts | 18 +- .../pages/capture-media/capture-media.ts | 10 +- src/core/emulator/providers/badge.ts | 19 +- src/core/emulator/providers/camera.ts | 6 +- src/core/emulator/providers/capture-helper.ts | 16 +- src/core/emulator/providers/clipboard.ts | 6 +- src/core/emulator/providers/file-opener.ts | 14 +- src/core/emulator/providers/file-transfer.ts | 44 +- src/core/emulator/providers/file.ts | 228 +++-- src/core/emulator/providers/globalization.ts | 36 +- src/core/emulator/providers/helper.ts | 36 +- src/core/emulator/providers/inappbrowser.ts | 8 +- .../emulator/providers/local-notifications.ts | 167 ++-- src/core/emulator/providers/media-capture.ts | 12 +- src/core/emulator/providers/network.ts | 6 +- src/core/emulator/providers/push.ts | 22 +- src/core/emulator/providers/zip.ts | 14 +- .../fileuploader/providers/album-handler.ts | 8 +- .../fileuploader/providers/audio-handler.ts | 8 +- .../fileuploader/providers/camera-handler.ts | 8 +- src/core/fileuploader/providers/delegate.ts | 39 +- .../fileuploader/providers/file-handler.ts | 8 +- .../fileuploader/providers/fileuploader.ts | 113 ++- src/core/fileuploader/providers/helper.ts | 168 ++-- .../fileuploader/providers/video-handler.ts | 8 +- src/core/grades/components/course/course.ts | 8 +- src/core/grades/pages/courses/courses.ts | 6 +- src/core/grades/pages/grade/grade.ts | 4 +- .../grades/providers/course-option-handler.ts | 30 +- src/core/grades/providers/grades.ts | 112 +-- src/core/grades/providers/helper.ts | 116 +-- src/core/grades/providers/mainmenu-handler.ts | 4 +- .../grades/providers/overview-link-handler.ts | 20 +- src/core/grades/providers/user-handler.ts | 24 +- .../grades/providers/user-link-handler.ts | 22 +- .../login/pages/credentials/credentials.ts | 8 +- .../login/pages/email-signup/email-signup.ts | 14 +- .../forgotten-password/forgotten-password.ts | 2 +- src/core/login/pages/init/init.ts | 2 +- src/core/login/pages/reconnect/reconnect.ts | 6 +- .../login/pages/site-policy/site-policy.ts | 2 +- src/core/login/pages/site/site.ts | 10 +- src/core/login/pages/sites/sites.ts | 6 +- src/core/login/providers/helper.ts | 250 +++-- src/core/mainmenu/pages/menu/menu.ts | 2 +- src/core/mainmenu/pages/more/more.ts | 4 +- src/core/mainmenu/providers/delegate.ts | 19 +- src/core/mainmenu/providers/mainmenu.ts | 24 +- .../pushnotifications/providers/delegate.ts | 39 +- .../providers/pushnotifications.ts | 115 ++- .../providers/register-cron-handler.ts | 10 +- .../providers/unregister-cron-handler.ts | 6 +- .../classes/base-behaviour-handler.ts | 20 +- .../classes/base-question-component.ts | 16 +- .../question/classes/base-question-handler.ts | 54 +- .../question/components/question/question.ts | 2 +- .../question/providers/behaviour-delegate.ts | 41 +- src/core/question/providers/delegate.ts | 129 ++- src/core/question/providers/helper.ts | 112 +-- src/core/question/providers/question.ts | 167 ++-- src/core/rating/pages/ratings/ratings.ts | 4 +- src/core/rating/providers/offline.ts | 94 +- src/core/rating/providers/rating.ts | 128 +-- src/core/rating/providers/sync.ts | 56 +- src/core/settings/pages/list/list.ts | 4 +- .../settings/pages/space-usage/space-usage.ts | 16 +- .../pages/synchronization/synchronization.ts | 6 +- src/core/settings/providers/delegate.ts | 10 +- src/core/settings/providers/helper.ts | 24 +- .../pages/choose-site/choose-site.ts | 2 +- src/core/sharedfiles/pages/list/list.ts | 16 +- src/core/sharedfiles/providers/helper.ts | 34 +- src/core/sharedfiles/providers/sharedfiles.ts | 42 +- .../sharedfiles/providers/upload-handler.ts | 8 +- src/core/sitehome/components/index/index.ts | 4 +- .../sitehome/providers/index-link-handler.ts | 20 +- src/core/sitehome/providers/sitehome.ts | 20 +- .../classes/call-ws-click-directive.ts | 2 +- .../siteplugins/classes/call-ws-directive.ts | 8 +- .../classes/compile-init-component.ts | 4 +- .../handlers/assign-feedback-handler.ts | 12 +- .../handlers/assign-submission-handler.ts | 14 +- .../classes/handlers/base-handler.ts | 2 +- .../classes/handlers/block-handler.ts | 10 +- .../classes/handlers/course-format-handler.ts | 18 +- .../classes/handlers/course-option-handler.ts | 28 +- .../classes/handlers/main-menu-handler.ts | 2 +- .../handlers/message-output-handler.ts | 2 +- .../classes/handlers/module-handler.ts | 18 +- .../handlers/module-prefetch-handler.ts | 68 +- .../handlers/question-behaviour-handler.ts | 8 +- .../classes/handlers/question-handler.ts | 6 +- .../handlers/quiz-access-rule-handler.ts | 58 +- .../classes/handlers/settings-handler.ts | 2 +- .../classes/handlers/user-handler.ts | 20 +- .../handlers/user-profile-field-handler.ts | 14 +- .../workshop-assessment-strategy-handler.ts | 28 +- .../assign-feedback/assign-feedback.ts | 2 +- .../assign-submission/assign-submission.ts | 2 +- .../components/course-format/course-format.ts | 8 +- .../components/course-option/course-option.ts | 2 +- .../components/module-index/module-index.ts | 12 +- .../plugin-content/plugin-content.ts | 34 +- .../directives/call-ws-new-content.ts | 2 +- src/core/siteplugins/directives/call-ws.ts | 2 +- .../pages/module-index/module-index.ts | 4 +- .../pages/plugin-page/plugin-page.ts | 4 +- src/core/siteplugins/providers/helper.ts | 222 ++--- src/core/siteplugins/providers/siteplugins.ts | 162 ++-- src/core/tag/pages/index-area/index-area.ts | 10 +- src/core/tag/pages/index/index.ts | 6 +- src/core/tag/pages/search/search.ts | 10 +- src/core/tag/providers/area-delegate.ts | 31 +- src/core/tag/providers/helper.ts | 4 +- src/core/tag/providers/index-link-handler.ts | 22 +- src/core/tag/providers/mainmenu-handler.ts | 4 +- src/core/tag/providers/search-link-handler.ts | 22 +- src/core/tag/providers/tag.ts | 120 +-- .../components/participants/participants.ts | 12 +- src/core/user/pages/about/about.ts | 2 +- src/core/user/pages/profile/profile.ts | 6 +- .../user/providers/course-option-handler.ts | 36 +- src/core/user/providers/helper.ts | 12 +- src/core/user/providers/offline.ts | 14 +- .../providers/participants-link-handler.ts | 20 +- src/core/user/providers/sync-cron-handler.ts | 8 +- src/core/user/providers/sync.ts | 8 +- src/core/user/providers/tag-area-handler.ts | 10 +- src/core/user/providers/user-delegate.ts | 49 +- src/core/user/providers/user-handler.ts | 14 +- src/core/user/providers/user-link-handler.ts | 20 +- .../providers/user-profile-field-delegate.ts | 46 +- src/core/user/providers/user.ts | 172 ++-- src/directives/auto-rows.ts | 2 +- src/directives/external-content.ts | 14 +- src/directives/format-text.ts | 37 +- src/directives/link.ts | 2 +- src/directives/supress-events.ts | 2 +- src/pipes/bytes-to-size.ts | 4 +- src/pipes/create-links.ts | 4 +- src/pipes/date-day-or-time.ts | 4 +- src/pipes/duration.ts | 4 +- src/pipes/format-date.ts | 10 +- src/pipes/no-tags.ts | 4 +- src/pipes/seconds-to-hms.ts | 4 +- src/pipes/time-ago.ts | 4 +- src/pipes/to-locale-string.ts | 4 +- src/providers/app.ts | 72 +- src/providers/config.ts | 16 +- src/providers/cron.ts | 91 +- src/providers/db.ts | 10 +- src/providers/events.ts | 20 +- src/providers/file-helper.ts | 58 +- src/providers/file-session.ts | 52 +- src/providers/file.ts | 263 +++--- src/providers/filepool.ts | 764 ++++++++------- src/providers/groups.ts | 138 ++- src/providers/init.ts | 15 +- src/providers/lang.ts | 46 +- src/providers/local-notifications.ts | 108 +-- src/providers/logger.ts | 10 +- src/providers/plugin-file-delegate.ts | 28 +- src/providers/sites-factory.ts | 18 +- src/providers/sites.ts | 270 +++--- src/providers/sync.ts | 56 +- src/providers/update-manager.ts | 51 +- src/providers/urlschemes.ts | 35 +- src/providers/utils/dom.ts | 366 ++++--- src/providers/utils/iframe.ts | 28 +- src/providers/utils/mimetype.ts | 88 +- src/providers/utils/text.ts | 190 ++-- src/providers/utils/time.ts | 50 +- src/providers/utils/url.ts | 80 +- src/providers/utils/utils.ts | 281 +++--- src/providers/ws.ts | 140 ++- 749 files changed, 15872 insertions(+), 16313 deletions(-) diff --git a/src/addon/badges/pages/issued-badge/issued-badge.ts b/src/addon/badges/pages/issued-badge/issued-badge.ts index ff79f7841..d33990ddb 100644 --- a/src/addon/badges/pages/issued-badge/issued-badge.ts +++ b/src/addon/badges/pages/issued-badge/issued-badge.ts @@ -65,7 +65,7 @@ export class AddonBadgesIssuedBadgePage { /** * Fetch the issued badge required for the view. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ fetchIssuedBadge(): Promise { const promises = []; @@ -101,7 +101,7 @@ export class AddonBadgesIssuedBadgePage { /** * Refresh the badges. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshBadges(refresher: any): void { this.badgesProvider.invalidateUserBadges(this.courseId, this.userId).finally(() => { diff --git a/src/addon/badges/pages/user-badges/user-badges.ts b/src/addon/badges/pages/user-badges/user-badges.ts index cde1db77a..fe5ea5c1c 100644 --- a/src/addon/badges/pages/user-badges/user-badges.ts +++ b/src/addon/badges/pages/user-badges/user-badges.ts @@ -64,7 +64,7 @@ export class AddonBadgesUserBadgesPage { /** * Fetch all the badges required for the view. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ fetchBadges(): Promise { this.currentTime = this.timeUtils.timestamp(); @@ -79,7 +79,7 @@ export class AddonBadgesUserBadgesPage { /** * Refresh the badges. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshBadges(refresher: any): void { this.badgesProvider.invalidateUserBadges(this.courseId, this.userId).finally(() => { @@ -92,7 +92,7 @@ export class AddonBadgesUserBadgesPage { /** * Navigate to a particular badge. * - * @param {string} badgeHash Badge to load. + * @param badgeHash Badge to load. */ loadIssuedBadge(badgeHash: string): void { this.badgeHash = badgeHash; diff --git a/src/addon/badges/providers/badge-link-handler.ts b/src/addon/badges/providers/badge-link-handler.ts index 144acad5c..0f98f0f0d 100644 --- a/src/addon/badges/providers/badge-link-handler.ts +++ b/src/addon/badges/providers/badge-link-handler.ts @@ -33,11 +33,11 @@ export class AddonBadgesBadgeLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -53,11 +53,11 @@ export class AddonBadgesBadgeLinkHandler extends CoreContentLinksHandlerBase { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { diff --git a/src/addon/badges/providers/badges.ts b/src/addon/badges/providers/badges.ts index 019341e39..f2b16814b 100644 --- a/src/addon/badges/providers/badges.ts +++ b/src/addon/badges/providers/badges.ts @@ -35,8 +35,8 @@ export class AddonBadgesProvider { * This method is called quite often and thus should only perform a quick * check, we should not be calling WS from here. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if enabled, false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if enabled, false otherwise. */ isPluginEnabled(siteId?: string): Promise { @@ -54,9 +54,9 @@ export class AddonBadgesProvider { /** * Get the cache key for the get badges call. * - * @param {number} courseId ID of the course to get the badges from. - * @param {number} userId ID of the user to get the badges from. - * @return {string} Cache key. + * @param courseId ID of the course to get the badges from. + * @param userId ID of the user to get the badges from. + * @return Cache key. */ protected getBadgesCacheKey(courseId: number, userId: number): string { 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. * - * @param {number} courseId ID of the course to get the badges from. - * @param {number} userId ID of the user to get the badges from. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise}Promise to be resolved when the badges are retrieved. + * @param courseId ID of the course to get the badges from. + * @param userId ID of the user to get the badges from. + * @param siteId Site ID. If not defined, current site. + * @return Promise to be resolved when the badges are retrieved. */ getUserBadges(courseId: number, userId: number, siteId?: string): Promise { @@ -98,10 +98,10 @@ export class AddonBadgesProvider { /** * Invalidate get badges WS call. * - * @param {number} courseId Course ID. - * @param {number} userId ID of the user to get the badges from. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when data is invalidated. + * @param courseId Course ID. + * @param userId ID of the user to get the badges from. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when data is invalidated. */ invalidateUserBadges(courseId: number, userId: number, siteId?: string): Promise { diff --git a/src/addon/badges/providers/mybadges-link-handler.ts b/src/addon/badges/providers/mybadges-link-handler.ts index 190e575ac..f9ea5e8a3 100644 --- a/src/addon/badges/providers/mybadges-link-handler.ts +++ b/src/addon/badges/providers/mybadges-link-handler.ts @@ -34,11 +34,11 @@ export class AddonBadgesMyBadgesLinkHandler extends CoreContentLinksHandlerBase /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -54,11 +54,11 @@ export class AddonBadgesMyBadgesLinkHandler extends CoreContentLinksHandlerBase * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { diff --git a/src/addon/badges/providers/push-click-handler.ts b/src/addon/badges/providers/push-click-handler.ts index 1aabf4f28..c36e1e3e2 100644 --- a/src/addon/badges/providers/push-click-handler.ts +++ b/src/addon/badges/providers/push-click-handler.ts @@ -33,8 +33,8 @@ export class AddonBadgesPushClickHandler implements CorePushNotificationsClickHa /** * Check if a notification click is handled by this handler. * - * @param {any} notification The notification to check. - * @return {boolean} Whether the notification click is handled by this handler + * @param notification The notification to check. + * @return Whether the notification click is handled by this handler */ handles(notification: any): boolean | Promise { const data = notification.customdata || {}; @@ -50,8 +50,8 @@ export class AddonBadgesPushClickHandler implements CorePushNotificationsClickHa /** * Handle the notification click. * - * @param {any} notification The notification to check. - * @return {Promise} Promise resolved when done. + * @param notification The notification to check. + * @return Promise resolved when done. */ handleClick(notification: any): Promise { const data = notification.customdata || {}; diff --git a/src/addon/badges/providers/user-handler.ts b/src/addon/badges/providers/user-handler.ts index fb34cd633..5c8e705e3 100644 --- a/src/addon/badges/providers/user-handler.ts +++ b/src/addon/badges/providers/user-handler.ts @@ -30,7 +30,7 @@ export class AddonBadgesUserHandler implements CoreUserProfileHandler { /** * Check if handler is enabled. * - * @return {Promise} Always enabled. + * @return Always enabled. */ isEnabled(): Promise { return this.badgesProvider.isPluginEnabled(); @@ -39,11 +39,11 @@ export class AddonBadgesUserHandler implements CoreUserProfileHandler { /** * Check if handler is enabled for this user in this context. * - * @param {any} user User to check. - * @param {number} courseId Course ID. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean} True if enabled, false otherwise. + * @param user User to check. + * @param courseId Course ID. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return True if enabled, false otherwise. */ 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. * - * @return {CoreUserProfileHandlerData} Data needed to render the handler. + * @return Data needed to render the handler. */ getDisplayData(user: any, courseId: number): CoreUserProfileHandlerData { return { diff --git a/src/addon/block/activitymodules/components/activitymodules/activitymodules.ts b/src/addon/block/activitymodules/components/activitymodules/activitymodules.ts index 69a0122bb..6a96b2169 100644 --- a/src/addon/block/activitymodules/components/activitymodules/activitymodules.ts +++ b/src/addon/block/activitymodules/components/activitymodules/activitymodules.ts @@ -52,7 +52,7 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { return this.courseProvider.invalidateSections(this.instanceId); @@ -61,7 +61,7 @@ export class AddonBlockActivityModulesComponent extends CoreBlockBaseComponent i /** * Fetch the data to render the block. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchContent(): Promise { return this.courseProvider.getSections(this.instanceId, false, true).then((sections) => { diff --git a/src/addon/block/activitymodules/providers/block-handler.ts b/src/addon/block/activitymodules/providers/block-handler.ts index 752d23a47..aeee44e52 100644 --- a/src/addon/block/activitymodules/providers/block-handler.ts +++ b/src/addon/block/activitymodules/providers/block-handler.ts @@ -32,11 +32,11 @@ export class AddonBlockActivityModulesHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/badges/providers/block-handler.ts b/src/addon/block/badges/providers/block-handler.ts index d6cfb677a..4b9b6971e 100644 --- a/src/addon/block/badges/providers/block-handler.ts +++ b/src/addon/block/badges/providers/block-handler.ts @@ -33,11 +33,11 @@ export class AddonBlockBadgesHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/blogmenu/providers/block-handler.ts b/src/addon/block/blogmenu/providers/block-handler.ts index 231137b8e..86446a1fe 100644 --- a/src/addon/block/blogmenu/providers/block-handler.ts +++ b/src/addon/block/blogmenu/providers/block-handler.ts @@ -33,11 +33,11 @@ export class AddonBlockBlogMenuHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/blogrecent/providers/block-handler.ts b/src/addon/block/blogrecent/providers/block-handler.ts index 55f03cb8e..8fca85a70 100644 --- a/src/addon/block/blogrecent/providers/block-handler.ts +++ b/src/addon/block/blogrecent/providers/block-handler.ts @@ -33,11 +33,11 @@ export class AddonBlockBlogRecentHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/blogtags/providers/block-handler.ts b/src/addon/block/blogtags/providers/block-handler.ts index aa2a17495..a73d45f17 100644 --- a/src/addon/block/blogtags/providers/block-handler.ts +++ b/src/addon/block/blogtags/providers/block-handler.ts @@ -33,11 +33,11 @@ export class AddonBlockBlogTagsHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/calendarmonth/providers/block-handler.ts b/src/addon/block/calendarmonth/providers/block-handler.ts index 80e85edf8..4f1724ea6 100644 --- a/src/addon/block/calendarmonth/providers/block-handler.ts +++ b/src/addon/block/calendarmonth/providers/block-handler.ts @@ -33,11 +33,11 @@ export class AddonBlockCalendarMonthHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/calendarupcoming/providers/block-handler.ts b/src/addon/block/calendarupcoming/providers/block-handler.ts index c58a0d080..edadfb05c 100644 --- a/src/addon/block/calendarupcoming/providers/block-handler.ts +++ b/src/addon/block/calendarupcoming/providers/block-handler.ts @@ -33,11 +33,11 @@ export class AddonBlockCalendarUpcomingHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/comments/providers/block-handler.ts b/src/addon/block/comments/providers/block-handler.ts index ada6e1654..594b262f7 100644 --- a/src/addon/block/comments/providers/block-handler.ts +++ b/src/addon/block/comments/providers/block-handler.ts @@ -32,11 +32,11 @@ export class AddonBlockCommentsHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/completionstatus/providers/block-handler.ts b/src/addon/block/completionstatus/providers/block-handler.ts index 88fca4ec8..7edac6643 100644 --- a/src/addon/block/completionstatus/providers/block-handler.ts +++ b/src/addon/block/completionstatus/providers/block-handler.ts @@ -32,11 +32,11 @@ export class AddonBlockCompletionStatusHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/glossaryrandom/providers/block-handler.ts b/src/addon/block/glossaryrandom/providers/block-handler.ts index d639ccb16..8e54cf602 100644 --- a/src/addon/block/glossaryrandom/providers/block-handler.ts +++ b/src/addon/block/glossaryrandom/providers/block-handler.ts @@ -32,11 +32,11 @@ export class AddonBlockGlossaryRandomHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/html/providers/block-handler.ts b/src/addon/block/html/providers/block-handler.ts index a5603fb53..4d91839c1 100644 --- a/src/addon/block/html/providers/block-handler.ts +++ b/src/addon/block/html/providers/block-handler.ts @@ -32,11 +32,11 @@ export class AddonBlockHtmlHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/learningplans/providers/block-handler.ts b/src/addon/block/learningplans/providers/block-handler.ts index fa98be638..e831019be 100644 --- a/src/addon/block/learningplans/providers/block-handler.ts +++ b/src/addon/block/learningplans/providers/block-handler.ts @@ -32,11 +32,11 @@ export class AddonBlockLearningPlansHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/myoverview/components/myoverview/myoverview.ts b/src/addon/block/myoverview/components/myoverview/myoverview.ts index ed68b9205..06c57fd6e 100644 --- a/src/addon/block/myoverview/components/myoverview/myoverview.ts +++ b/src/addon/block/myoverview/components/myoverview/myoverview.ts @@ -133,7 +133,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -161,7 +161,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem /** * Fetch the courses for my overview. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchContent(): Promise { return this.coursesHelper.getUserCoursesWithOptions(this.sort).then((courses) => { @@ -197,7 +197,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem /** * The filter has changed. * - * @param {any} Received Event. + * @param Received Event. */ filterChanged(event: any): void { 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. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ prefetchCourses(): Promise { const selected = this.selectedFilter, @@ -264,7 +264,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem /** * Init courses filters. * - * @param {any[]} courses Courses to filter. + * @param courses Courses to filter. */ initCourseFilters(courses: any[]): void { if (this.showSortFilter) { @@ -319,7 +319,7 @@ export class AddonBlockMyOverviewComponent extends CoreBlockBaseComponent implem /** * The selected courses sort filter have changed. * - * @param {string} sort New sorting. + * @param sort New sorting. */ switchSort(sort: string): void { 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. * - * @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 { return this.loaded && this.courses['all'] && this.courses['all'].length > 5; diff --git a/src/addon/block/myoverview/providers/block-handler.ts b/src/addon/block/myoverview/providers/block-handler.ts index e0a593b9a..f7d434747 100644 --- a/src/addon/block/myoverview/providers/block-handler.ts +++ b/src/addon/block/myoverview/providers/block-handler.ts @@ -34,7 +34,7 @@ export class AddonBlockMyOverviewHandler extends CoreBlockBaseHandler { /** * 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 { return this.sitesProvider.getCurrentSite().isVersionGreaterEqualThan('3.6') || @@ -44,11 +44,11 @@ export class AddonBlockMyOverviewHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/newsitems/providers/block-handler.ts b/src/addon/block/newsitems/providers/block-handler.ts index c077474d8..86b12b57f 100644 --- a/src/addon/block/newsitems/providers/block-handler.ts +++ b/src/addon/block/newsitems/providers/block-handler.ts @@ -32,11 +32,11 @@ export class AddonBlockNewsItemsHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/onlineusers/providers/block-handler.ts b/src/addon/block/onlineusers/providers/block-handler.ts index 353835c83..78505b0de 100644 --- a/src/addon/block/onlineusers/providers/block-handler.ts +++ b/src/addon/block/onlineusers/providers/block-handler.ts @@ -32,11 +32,11 @@ export class AddonBlockOnlineUsersHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/privatefiles/providers/block-handler.ts b/src/addon/block/privatefiles/providers/block-handler.ts index f0284df97..811aea153 100644 --- a/src/addon/block/privatefiles/providers/block-handler.ts +++ b/src/addon/block/privatefiles/providers/block-handler.ts @@ -32,11 +32,11 @@ export class AddonBlockPrivateFilesHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/recentactivity/providers/block-handler.ts b/src/addon/block/recentactivity/providers/block-handler.ts index ac69af02b..b3d6042a4 100644 --- a/src/addon/block/recentactivity/providers/block-handler.ts +++ b/src/addon/block/recentactivity/providers/block-handler.ts @@ -33,11 +33,11 @@ export class AddonBlockRecentActivityHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/recentlyaccessedcourses/components/recentlyaccessedcourses/recentlyaccessedcourses.ts b/src/addon/block/recentlyaccessedcourses/components/recentlyaccessedcourses/recentlyaccessedcourses.ts index 92697e4f0..7db55fcfd 100644 --- a/src/addon/block/recentlyaccessedcourses/components/recentlyaccessedcourses/recentlyaccessedcourses.ts +++ b/src/addon/block/recentlyaccessedcourses/components/recentlyaccessedcourses/recentlyaccessedcourses.ts @@ -79,7 +79,7 @@ export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseCom /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -104,7 +104,7 @@ export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseCom /** * Fetch the courses for recent courses. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchContent(): Promise { return this.coursesHelper.getUserCoursesWithOptions('lastaccess', 10).then((courses) => { @@ -133,7 +133,7 @@ export class AddonBlockRecentlyAccessedCoursesComponent extends CoreBlockBaseCom /** * Prefetch all the shown courses. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ prefetchCourses(): Promise { const initialIcon = this.prefetchCoursesData.icon; diff --git a/src/addon/block/recentlyaccessedcourses/providers/block-handler.ts b/src/addon/block/recentlyaccessedcourses/providers/block-handler.ts index 3af9cf0dd..0f70d2768 100644 --- a/src/addon/block/recentlyaccessedcourses/providers/block-handler.ts +++ b/src/addon/block/recentlyaccessedcourses/providers/block-handler.ts @@ -32,11 +32,11 @@ export class AddonBlockRecentlyAccessedCoursesHandler extends CoreBlockBaseHandl /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/recentlyaccesseditems/components/recentlyaccesseditems/recentlyaccesseditems.ts b/src/addon/block/recentlyaccesseditems/components/recentlyaccesseditems/recentlyaccesseditems.ts index e1c9bf372..6aa7b3650 100644 --- a/src/addon/block/recentlyaccesseditems/components/recentlyaccesseditems/recentlyaccesseditems.ts +++ b/src/addon/block/recentlyaccesseditems/components/recentlyaccesseditems/recentlyaccesseditems.ts @@ -50,7 +50,7 @@ export class AddonBlockRecentlyAccessedItemsComponent extends CoreBlockBaseCompo /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { return this.recentItemsProvider.invalidateRecentItems(); @@ -59,7 +59,7 @@ export class AddonBlockRecentlyAccessedItemsComponent extends CoreBlockBaseCompo /** * Fetch the data to render the block. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchContent(): Promise { return this.recentItemsProvider.getRecentItems().then((items) => { @@ -70,8 +70,8 @@ export class AddonBlockRecentlyAccessedItemsComponent extends CoreBlockBaseCompo /** * Event clicked. * - * @param {Event} e Click event. - * @param {any} item Activity item info. + * @param e Click event. + * @param item Activity item info. */ action(e: Event, item: any): void { e.preventDefault(); diff --git a/src/addon/block/recentlyaccesseditems/providers/block-handler.ts b/src/addon/block/recentlyaccesseditems/providers/block-handler.ts index dfadcc542..928f33e1b 100644 --- a/src/addon/block/recentlyaccesseditems/providers/block-handler.ts +++ b/src/addon/block/recentlyaccesseditems/providers/block-handler.ts @@ -32,11 +32,11 @@ export class AddonBlockRecentlyAccessedItemsHandler extends CoreBlockBaseHandler /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/recentlyaccesseditems/providers/recentlyaccesseditems.ts b/src/addon/block/recentlyaccesseditems/providers/recentlyaccesseditems.ts index f07f386d5..a24bc035c 100644 --- a/src/addon/block/recentlyaccesseditems/providers/recentlyaccesseditems.ts +++ b/src/addon/block/recentlyaccesseditems/providers/recentlyaccesseditems.ts @@ -30,7 +30,7 @@ export class AddonBlockRecentlyAccessedItemsProvider { /** * Get cache key for get last accessed items value WS call. * - * @return {string} Cache key. + * @return Cache key. */ protected getRecentItemsCacheKey(): string { return this.ROOT_CACHE_KEY + ':recentitems'; @@ -39,8 +39,8 @@ export class AddonBlockRecentlyAccessedItemsProvider { /** * Get last accessed items. * - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved when the info is retrieved. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved when the info is retrieved. */ getRecentItems(siteId?: string): Promise { @@ -63,8 +63,8 @@ export class AddonBlockRecentlyAccessedItemsProvider { /** * Invalidates get last accessed items WS call. * - * @param {string} [siteId] Site ID to invalidate. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param siteId Site ID to invalidate. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateRecentItems(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/block/rssclient/providers/block-handler.ts b/src/addon/block/rssclient/providers/block-handler.ts index 8976f2182..770f74398 100644 --- a/src/addon/block/rssclient/providers/block-handler.ts +++ b/src/addon/block/rssclient/providers/block-handler.ts @@ -33,11 +33,11 @@ export class AddonBlockRssClientHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/selfcompletion/providers/block-handler.ts b/src/addon/block/selfcompletion/providers/block-handler.ts index 57d716e5a..f9ea51d35 100644 --- a/src/addon/block/selfcompletion/providers/block-handler.ts +++ b/src/addon/block/selfcompletion/providers/block-handler.ts @@ -32,11 +32,11 @@ export class AddonBlockSelfCompletionHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/sitemainmenu/components/sitemainmenu/sitemainmenu.ts b/src/addon/block/sitemainmenu/components/sitemainmenu/sitemainmenu.ts index 23bfb74ca..19030b3cc 100644 --- a/src/addon/block/sitemainmenu/components/sitemainmenu/sitemainmenu.ts +++ b/src/addon/block/sitemainmenu/components/sitemainmenu/sitemainmenu.ts @@ -54,7 +54,7 @@ export class AddonBlockSiteMainMenuComponent extends CoreBlockBaseComponent impl /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -73,7 +73,7 @@ export class AddonBlockSiteMainMenuComponent extends CoreBlockBaseComponent impl /** * Fetch the data to render the block. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchContent(): Promise { return this.courseProvider.getSections(this.siteHomeId, false, true).then((sections) => { diff --git a/src/addon/block/sitemainmenu/providers/block-handler.ts b/src/addon/block/sitemainmenu/providers/block-handler.ts index dcaf4fe01..b7118a5f4 100644 --- a/src/addon/block/sitemainmenu/providers/block-handler.ts +++ b/src/addon/block/sitemainmenu/providers/block-handler.ts @@ -32,11 +32,11 @@ export class AddonBlockSiteMainMenuHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/starredcourses/components/starredcourses/starredcourses.ts b/src/addon/block/starredcourses/components/starredcourses/starredcourses.ts index ca25f3354..ca7e3156e 100644 --- a/src/addon/block/starredcourses/components/starredcourses/starredcourses.ts +++ b/src/addon/block/starredcourses/components/starredcourses/starredcourses.ts @@ -79,7 +79,7 @@ export class AddonBlockStarredCoursesComponent extends CoreBlockBaseComponent im /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -104,7 +104,7 @@ export class AddonBlockStarredCoursesComponent extends CoreBlockBaseComponent im /** * Fetch the courses. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchContent(): Promise { return this.coursesHelper.getUserCoursesWithOptions('timemodified', 0, 'isfavourite').then((courses) => { @@ -133,7 +133,7 @@ export class AddonBlockStarredCoursesComponent extends CoreBlockBaseComponent im /** * Prefetch all the shown courses. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ prefetchCourses(): Promise { const initialIcon = this.prefetchCoursesData.icon; diff --git a/src/addon/block/starredcourses/providers/block-handler.ts b/src/addon/block/starredcourses/providers/block-handler.ts index c7abc3485..c65f01aff 100644 --- a/src/addon/block/starredcourses/providers/block-handler.ts +++ b/src/addon/block/starredcourses/providers/block-handler.ts @@ -32,11 +32,11 @@ export class AddonBlockStarredCoursesHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/tags/providers/block-handler.ts b/src/addon/block/tags/providers/block-handler.ts index f1c7d4cd8..963ae63f3 100644 --- a/src/addon/block/tags/providers/block-handler.ts +++ b/src/addon/block/tags/providers/block-handler.ts @@ -33,11 +33,11 @@ export class AddonBlockTagsHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/timeline/components/events/events.ts b/src/addon/block/timeline/components/events/events.ts index a4f50e96a..07dbf0ac0 100644 --- a/src/addon/block/timeline/components/events/events.ts +++ b/src/addon/block/timeline/components/events/events.ts @@ -89,9 +89,9 @@ export class AddonBlockTimelineEventsComponent implements OnChanges { /** * 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 {number} [end] Number of days after the start. - * @return {any[]} Filtered events. + * @param start Number of days to start getting events from today. E.g. -1 will get events from yesterday. + * @param end Number of days after the start. + * @return Filtered events. */ protected filterEventsByTime(start: number, end?: number): any[] { start = moment().add(start, 'days').startOf('day').unix(); @@ -121,8 +121,8 @@ export class AddonBlockTimelineEventsComponent implements OnChanges { /** * Action clicked. * - * @param {Event} e Click event. - * @param {string} url Url of the action. + * @param e Click event. + * @param url Url of the action. */ action(e: Event, url: string): void { e.preventDefault(); diff --git a/src/addon/block/timeline/components/timeline/timeline.ts b/src/addon/block/timeline/components/timeline/timeline.ts index 20976cc5b..8325cbcf3 100644 --- a/src/addon/block/timeline/components/timeline/timeline.ts +++ b/src/addon/block/timeline/components/timeline/timeline.ts @@ -75,7 +75,7 @@ export class AddonBlockTimelineComponent extends CoreBlockBaseComponent implemen /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -94,7 +94,7 @@ export class AddonBlockTimelineComponent extends CoreBlockBaseComponent implemen /** * Fetch the courses for my overview. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchContent(): Promise { if (this.sort == 'sortbydates') { @@ -120,8 +120,8 @@ export class AddonBlockTimelineComponent extends CoreBlockBaseComponent implemen /** * Load more events. * - * @param {any} course Course. - * @return {Promise} Promise resolved when done. + * @param course Course. + * @return Promise resolved when done. */ loadMoreCourse(course: any): Promise { return this.timelineProvider.getActionEventsByCourse(course.id, course.canLoadMore).then((courseEvents) => { @@ -135,8 +135,8 @@ export class AddonBlockTimelineComponent extends CoreBlockBaseComponent implemen /** * Fetch the timeline. * - * @param {number} [afterEventId] The last event id. - * @return {Promise} Promise resolved when done. + * @param afterEventId The last event id. + * @return Promise resolved when done. */ protected fetchMyOverviewTimeline(afterEventId?: number): Promise { return this.timelineProvider.getActionEventsByTimesort(afterEventId).then((events) => { @@ -148,7 +148,7 @@ export class AddonBlockTimelineComponent extends CoreBlockBaseComponent implemen /** * Fetch the timeline by courses. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchMyOverviewTimelineByCourses(): Promise { return this.coursesHelper.getUserCoursesWithOptions().then((courses) => { @@ -210,7 +210,7 @@ export class AddonBlockTimelineComponent extends CoreBlockBaseComponent implemen /** * Change timeline sort being viewed. * - * @param {string} sort New sorting. + * @param sort New sorting. */ switchSort(sort: string): void { this.sort = sort; diff --git a/src/addon/block/timeline/providers/block-handler.ts b/src/addon/block/timeline/providers/block-handler.ts index 8973fbc5d..e116002b7 100644 --- a/src/addon/block/timeline/providers/block-handler.ts +++ b/src/addon/block/timeline/providers/block-handler.ts @@ -37,7 +37,7 @@ export class AddonBlockTimelineHandler extends CoreBlockBaseHandler { /** * 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 { return this.timelineProvider.isAvailable().then((enabled) => { @@ -49,11 +49,11 @@ export class AddonBlockTimelineHandler extends CoreBlockBaseHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/addon/block/timeline/providers/timeline.ts b/src/addon/block/timeline/providers/timeline.ts index 148aed267..6f90184e8 100644 --- a/src/addon/block/timeline/providers/timeline.ts +++ b/src/addon/block/timeline/providers/timeline.ts @@ -32,10 +32,10 @@ export class AddonBlockTimelineProvider { /** * Get calendar action events for the given course. * - * @param {number} courseId Only events in this course. - * @param {number} [afterEventId] The last seen event id. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise<{events: any[], canLoadMore: number}>} Promise resolved when the info is retrieved. + * @param courseId Only events in this course. + * @param afterEventId The last seen event id. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved when the info is retrieved. */ getActionEventsByCourse(courseId: number, afterEventId?: number, siteId?: string): 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. * - * @param {number} courseId Only events in this course. - * @return {string} Cache key. + * @param courseId Only events in this course. + * @return Cache key. */ protected getActionEventsByCourseCacheKey(courseId: number): string { return this.getActionEventsByCoursesCacheKey() + ':' + courseId; @@ -78,9 +78,9 @@ export class AddonBlockTimelineProvider { /** * Get calendar action events for a given list of courses. * - * @param {number[]} courseIds Course IDs. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise<{[s: string]: {events: any[], canLoadMore: number}}>} Promise resolved when the info is retrieved. + * @param courseIds Course IDs. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved when the info is retrieved. */ getActionEventsByCourses(courseIds: number[], siteId?: string): Promise<{ [s: string]: { 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. * - * @return {string} Cache key. + * @return Cache key. */ protected getActionEventsByCoursesCacheKey(): string { return this.ROOT_CACHE_KEY + 'bycourse'; @@ -123,9 +123,9 @@ export class AddonBlockTimelineProvider { /** * Get calendar action events based on the timesort value. * - * @param {number} [afterEventId] The last seen event id. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise<{events: any[], canLoadMore: number}>} Promise resolved when the info is retrieved. + * @param afterEventId The last seen event id. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved when the info is retrieved. */ getActionEventsByTimesort(afterEventId: number, siteId?: string): Promise<{ events: any[], canLoadMore: number }> { 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. * - * @return {string} Cache key. + * @return Cache key. */ protected getActionEventsByTimesortPrefixCacheKey(): string { 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. * - * @param {number} [afterEventId] The last seen event id. - * @param {number} [limit] Limit num of the call. - * @return {string} Cache key. + * @param afterEventId The last seen event id. + * @param limit Limit num of the call. + * @return Cache key. */ protected getActionEventsByTimesortCacheKey(afterEventId?: number, limit?: number): string { afterEventId = afterEventId || 0; @@ -190,8 +190,8 @@ export class AddonBlockTimelineProvider { /** * 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. - * @return {Promise} Promise resolved when the data is invalidated. + * @param siteId Site ID to invalidate. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateActionEventsByCourses(siteId?: string): Promise { 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. * - * @param {string} [siteId] Site ID to invalidate. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param siteId Site ID to invalidate. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateActionEventsByTimesort(siteId?: string): Promise { 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. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if available, resolved with false or rejected otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if available, resolved with false or rejected otherwise. */ isAvailable(siteId?: string): Promise { 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. * - * @param {any} course Object containing response course events info. - * @param {number} 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. + * @param course Object containing response course events info. + * @param timeFrom Current time to filter events from. + * @return Object with course events and last loaded event id if more can be loaded. */ protected treatCourseEvents(course: any, timeFrom: number): { events: any[], canLoadMore: number } { const canLoadMore: number = diff --git a/src/addon/blog/components/entries/entries.ts b/src/addon/blog/components/entries/entries.ts index aa66beaef..3cd10ebd6 100644 --- a/src/addon/blog/components/entries/entries.ts +++ b/src/addon/blog/components/entries/entries.ts @@ -104,8 +104,8 @@ export class AddonBlogEntriesComponent implements OnInit { /** * Fetch blog entries. * - * @param {boolean} [refresh] Empty events array first. - * @return {Promise} Promise with the entries. + * @param refresh Empty events array first. + * @return Promise with the entries. */ private fetchEntries(refresh: boolean = false): Promise { this.loadMoreError = false; @@ -174,7 +174,7 @@ export class AddonBlogEntriesComponent implements OnInit { /** * 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 { if (enabled) { @@ -198,8 +198,8 @@ export class AddonBlogEntriesComponent implements OnInit { /** * Function to load more entries. * - * @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. - * @return {Promise} Resolved when done. + * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. + * @return Resolved when done. */ loadMore(infiniteComplete?: any): Promise { return this.fetchEntries().finally(() => { @@ -210,7 +210,7 @@ export class AddonBlogEntriesComponent implements OnInit { /** * Refresh blog entries on PTR. * - * @param {any} refresher Refresher instance. + * @param refresher Refresher instance. */ refresh(refresher?: any): void { const promises = this.entries.map((entry) => { diff --git a/src/addon/blog/providers/blog.ts b/src/addon/blog/providers/blog.ts index 90b875283..a816fd9d3 100644 --- a/src/addon/blog/providers/blog.ts +++ b/src/addon/blog/providers/blog.ts @@ -40,8 +40,8 @@ export class AddonBlogProvider { * This method is called quite often and thus should only perform a quick * check, we should not be calling WS from here. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if enabled, resolved with false or rejected otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if enabled, resolved with false or rejected otherwise. */ isPluginEnabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -53,8 +53,8 @@ export class AddonBlogProvider { /** * Get the cache key for the blog entries. * - * @param {any} [filter] Filter to apply on search. - * @return {string} Cache key. + * @param filter Filter to apply on search. + * @return Cache key. */ getEntriesCacheKey(filter: any = {}): string { return this.ROOT_CACHE_KEY + this.utils.sortAndStringify(filter); @@ -63,10 +63,10 @@ export class AddonBlogProvider { /** * Get blog entries. * - * @param {any} [filter] Filter to apply on search. - * @param {any} [page=0] Page of the blog entries to fetch. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise to be resolved when the entries are retrieved. + * @param filter Filter to apply on search. + * @param page Page of the blog entries to fetch. + * @param siteId Site ID. If not defined, current site. + * @return Promise to be resolved when the entries are retrieved. */ getEntries(filter: any = {}, page: number = 0, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -88,9 +88,9 @@ export class AddonBlogProvider { /** * Invalidate blog entries WS call. * - * @param {any} [filter] Filter to apply on search - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when data is invalidated. + * @param filter Filter to apply on search + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when data is invalidated. */ invalidateEntries(filter: any = {}, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -101,9 +101,9 @@ export class AddonBlogProvider { /** * Trigger the blog_entries_viewed event. * - * @param {any} [filter] Filter to apply on search. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise to be resolved when done. + * @param filter Filter to apply on search. + * @param siteId Site ID. If not defined, current site. + * @return Promise to be resolved when done. */ logView(filter: any = {}, siteId?: string): Promise { this.pushNotificationsProvider.logViewListEvent('blog', 'core_blog_view_entries', filter, siteId); diff --git a/src/addon/blog/providers/course-option-handler.ts b/src/addon/blog/providers/course-option-handler.ts index 5617d6c92..34140ca2a 100644 --- a/src/addon/blog/providers/course-option-handler.ts +++ b/src/addon/blog/providers/course-option-handler.ts @@ -37,10 +37,10 @@ export class AddonBlogCourseOptionHandler implements CoreCourseOptionsHandler { /** * Should invalidate the data to determine if the handler is enabled for a certain course. * - * @param {number} courseId The course ID. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {Promise} Promise resolved when done. + * @param courseId The course ID. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved when done. */ invalidateEnabledForCourse(courseId: number, navOptions?: any, admOptions?: any): Promise { return this.courseProvider.invalidateCourseBlocks(courseId); @@ -49,7 +49,7 @@ export class AddonBlogCourseOptionHandler implements CoreCourseOptionsHandler { /** * 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 { return this.blogProvider.isPluginEnabled(); @@ -58,11 +58,11 @@ export class AddonBlogCourseOptionHandler implements CoreCourseOptionsHandler { /** * Whether or not the handler is enabled for a certain course. * - * @param {number} courseId The course ID. - * @param {any} accessData Access type and data. Default, guest, ... - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @param courseId The course ID. + * @param accessData Access type and data. Default, guest, ... + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return True or promise resolved with true if enabled. */ isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise { 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. * - * @param {Injector} injector Injector. - * @param {number} course The course. - * @return {CoreCourseOptionsHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param course The course. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, course: any): CoreCourseOptionsHandlerData | Promise { 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. * - * @param {any} course The course. - * @return {Promise} Promise resolved when done. + * @param course The course. + * @return Promise resolved when done. */ prefetch(course: any): Promise { const siteId = this.sitesProvider.getCurrentSiteId(); diff --git a/src/addon/blog/providers/index-link-handler.ts b/src/addon/blog/providers/index-link-handler.ts index 0670b322b..ab728fd06 100644 --- a/src/addon/blog/providers/index-link-handler.ts +++ b/src/addon/blog/providers/index-link-handler.ts @@ -34,11 +34,11 @@ export class AddonBlogIndexLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -62,11 +62,11 @@ export class AddonBlogIndexLinkHandler extends CoreContentLinksHandlerBase { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { diff --git a/src/addon/blog/providers/mainmenu-handler.ts b/src/addon/blog/providers/mainmenu-handler.ts index e45bfd06f..4f157e5bb 100644 --- a/src/addon/blog/providers/mainmenu-handler.ts +++ b/src/addon/blog/providers/mainmenu-handler.ts @@ -29,7 +29,7 @@ export class AddonBlogMainMenuHandler implements CoreMainMenuHandler { /** * 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 { return this.blogProvider.isPluginEnabled(); @@ -38,7 +38,7 @@ export class AddonBlogMainMenuHandler implements CoreMainMenuHandler { /** * 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 { return { diff --git a/src/addon/blog/providers/tag-area-handler.ts b/src/addon/blog/providers/tag-area-handler.ts index 41413d824..7d38f48c2 100644 --- a/src/addon/blog/providers/tag-area-handler.ts +++ b/src/addon/blog/providers/tag-area-handler.ts @@ -30,7 +30,7 @@ export class AddonBlogTagAreaHandler implements CoreTagAreaHandler { /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { 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. * - * @param {string} content Rendered content. - * @return {any[]|Promise} Area items (or promise resolved with the items). + * @param content Rendered content. + * @return Area items (or promise resolved with the items). */ parseContent(content: string): any[] | Promise { return this.tagHelper.parseFeedContent(content); @@ -49,8 +49,8 @@ export class AddonBlogTagAreaHandler implements CoreTagAreaHandler { /** * Get the component to use to display items. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return CoreTagFeedComponent; diff --git a/src/addon/blog/providers/user-handler.ts b/src/addon/blog/providers/user-handler.ts index fe19563b8..6911ba70d 100644 --- a/src/addon/blog/providers/user-handler.ts +++ b/src/addon/blog/providers/user-handler.ts @@ -31,7 +31,7 @@ export class AddonBlogUserHandler implements CoreUserProfileHandler { /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return this.blogProvider.isPluginEnabled(); @@ -40,11 +40,11 @@ export class AddonBlogUserHandler implements CoreUserProfileHandler { /** * Check if handler is enabled for this user in this context. * - * @param {any} user User to check. - * @param {number} courseId Course ID. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} Promise resolved with true if enabled, resolved with false otherwise. + * @param user User to check. + * @param courseId Course ID. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved with true if enabled, resolved with false otherwise. */ isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise { return true; @@ -53,7 +53,7 @@ export class AddonBlogUserHandler implements CoreUserProfileHandler { /** * 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 { return { diff --git a/src/addon/calendar/components/calendar/calendar.ts b/src/addon/calendar/components/calendar/calendar.ts index 269310608..391116337 100644 --- a/src/addon/calendar/components/calendar/calendar.ts +++ b/src/addon/calendar/components/calendar/calendar.ts @@ -134,8 +134,8 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest /** * Fetch contacts. * - * @param {boolean} [refresh=false] True if we are refreshing events. - * @return {Promise} Promise resolved when done. + * @param refresh True if we are refreshing events. + * @return Promise resolved when done. */ fetchData(refresh: boolean = false): Promise { const promises = []; @@ -184,7 +184,7 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest /** * Fetch the events for current month. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ fetchEvents(): Promise { // 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. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected loadCategories(): Promise { if (this.categoriesRetrieved) { @@ -285,8 +285,8 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest /** * Refresh events. * - * @param {boolean} [afterChange] Whether the refresh is done after an event has changed or has been synced. - * @return {Promise} Promise resolved when done. + * @param afterChange Whether the refresh is done after an event has changed or has been synced. + * @return Promise resolved when done. */ refreshData(afterChange?: boolean): Promise { const promises = []; @@ -340,8 +340,8 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest /** * An event was clicked. * - * @param {any} calendarEvent Calendar event.. - * @param {MouseEvent} event Mouse event. + * @param calendarEvent Calendar event.. + * @param event Mouse event. */ eventClicked(calendarEvent: any, event: MouseEvent): void { this.onEventClicked.emit(calendarEvent.id); @@ -351,7 +351,7 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest /** * A day was clicked. * - * @param {number} day Day. + * @param day Day. */ dayClicked(day: number): void { 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. * - * @param {any[]} events List to sort. + * @param events List to sort. */ protected sortEvents(events: any[]): any[] { return events.sort((a, b) => { @@ -476,7 +476,7 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest /** * Undelete a certain event. * - * @param {number} eventId Event ID. + * @param eventId Event ID. */ protected undeleteEvent(eventId: number): void { if (!this.weeks) { @@ -498,8 +498,8 @@ export class AddonCalendarCalendarComponent implements OnInit, OnChanges, OnDest /** * Returns if the event is in the past or not. - * @param {any} event Event object. - * @return {boolean} True if it's in the past. + * @param event Event object. + * @return True if it's in the past. */ isEventPast(event: any): boolean { return (event.timestart + event.timeduration) < this.currentTime; diff --git a/src/addon/calendar/components/upcoming-events/upcoming-events.ts b/src/addon/calendar/components/upcoming-events/upcoming-events.ts index d56a3470b..43489bd80 100644 --- a/src/addon/calendar/components/upcoming-events/upcoming-events.ts +++ b/src/addon/calendar/components/upcoming-events/upcoming-events.ts @@ -106,8 +106,8 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, OnChanges, /** * Fetch data. * - * @param {boolean} [refresh=false] True if we are refreshing events. - * @return {Promise} Promise resolved when done. + * @param refresh True if we are refreshing events. + * @return Promise resolved when done. */ fetchData(refresh: boolean = false): Promise { const promises = []; @@ -151,7 +151,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, OnChanges, /** * Fetch upcoming events. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ fetchEvents(): Promise { // 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. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected loadCategories(): Promise { if (this.categoriesRetrieved) { @@ -225,8 +225,8 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, OnChanges, /** * Refresh events. * - * @param {boolean} [afterChange] Whether the refresh is done after an event has changed or has been synced. - * @return {Promise} Promise resolved when done. + * @param afterChange Whether the refresh is done after an event has changed or has been synced. + * @return Promise resolved when done. */ refreshData(afterChange?: boolean): Promise { const promises = []; @@ -249,7 +249,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, OnChanges, /** * An event was clicked. * - * @param {any} event Event. + * @param event Event. */ eventClicked(event: any): void { 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. * - * @return {any[]} Merged events. + * @return Merged events. */ protected mergeEvents(): any[] { if (!this.offlineEvents.length && !this.deletedEvents.length) { @@ -302,7 +302,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, OnChanges, /** * Sort events by timestart. * - * @param {any[]} events List to sort. + * @param events List to sort. */ protected sortEvents(events: any[]): any[] { return events.sort((a, b) => { @@ -317,7 +317,7 @@ export class AddonCalendarUpcomingEventsComponent implements OnInit, OnChanges, /** * Undelete a certain event. * - * @param {number} eventId Event ID. + * @param eventId Event ID. */ protected undeleteEvent(eventId: number): void { const event = this.onlineEvents.find((event) => { diff --git a/src/addon/calendar/pages/day/day.ts b/src/addon/calendar/pages/day/day.ts index c3b566f88..d87725e8f 100644 --- a/src/addon/calendar/pages/day/day.ts +++ b/src/addon/calendar/pages/day/day.ts @@ -208,9 +208,9 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { /** * Fetch all the data required for the view. * - * @param {boolean} [sync] Whether it should try to synchronize offline events. - * @param {boolean} [showErrors] Whether to show sync errors to the user. - * @return {Promise} Promise resolved when done. + * @param sync Whether it should try to synchronize offline events. + * @param showErrors Whether to show sync errors to the user. + * @return Promise resolved when done. */ fetchData(sync?: boolean, showErrors?: boolean): Promise { @@ -280,7 +280,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { /** * Fetch the events for current day. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ fetchEvents(): Promise { // 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. * - * @return {any[]} Merged events. + * @return Merged events. */ protected mergeEvents(): any[] { this.hasOffline = false; @@ -389,7 +389,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { /** * Sort events by timestart. * - * @param {any[]} events List to sort. + * @param events List to sort. */ protected sortEvents(events: any[]): any[] { return events.sort((a, b) => { @@ -404,10 +404,10 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @param {Function} [done] Function to call when done. - * @param {boolean} [showErrors] Whether to show sync errors to the user. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @param done Function to call when done. + * @param showErrors Whether to show sync errors to the user. + * @return Promise resolved when done. */ doRefresh(refresher?: any, done?: () => void, showErrors?: boolean): Promise { if (this.loaded) { @@ -423,10 +423,10 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { /** * Refresh the data. * - * @param {boolean} [sync] Whether it should try to synchronize offline events. - * @param {boolean} [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. - * @return {Promise} Promise resolved when done. + * @param sync Whether it should try to synchronize offline events. + * @param showErrors Whether to show sync errors to the user. + * @param afterChange Whether the refresh is done after an event has changed or has been synced. + * @return Promise resolved when done. */ refreshData(sync?: boolean, showErrors?: boolean, afterChange?: boolean): Promise { this.syncIcon = 'spinner'; @@ -449,7 +449,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { /** * Load categories to be able to filter events. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected loadCategories(): Promise { return this.coursesProvider.getCategories(0, true).then((cats) => { @@ -467,8 +467,8 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { /** * Try to synchronize offline events. * - * @param {boolean} [showErrors] Whether to show sync errors to the user. - * @return {Promise} Promise resolved when done. + * @param showErrors Whether to show sync errors to the user. + * @return Promise resolved when done. */ protected sync(showErrors?: boolean): Promise { return this.calendarSync.syncEvents().then((result) => { @@ -495,7 +495,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { /** * Navigate to a particular event. * - * @param {number} eventId Event to load. + * @param eventId Event to load. */ gotoEvent(eventId: number): void { if (eventId < 0) { @@ -511,7 +511,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { /** * Show the context menu. * - * @param {MouseEvent} event Event. + * @param event Event. */ openCourseFilter(event: MouseEvent): void { 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. * - * @param {number} [eventId] Event ID to edit. + * @param eventId Event ID to edit. */ openEdit(eventId?: number): void { const params: any = {}; @@ -658,9 +658,9 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { /** * Find an event and mark it as deleted. * - * @param {number} eventId Event ID. - * @param {boolean} deleted Whether to mark it as deleted or not. - * @return {boolean} Whether the event was found. + * @param eventId Event ID. + * @param deleted Whether to mark it as deleted or not. + * @return Whether the event was found. */ protected markAsDeleted(eventId: number, deleted: boolean): boolean { 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. - * @param {any} event Event object. - * @return {boolean} True if it's in the past. + * @param event Event object. + * @return True if it's in the past. */ isEventPast(event: any): boolean { return (event.timestart + event.timeduration) < this.currentTime; diff --git a/src/addon/calendar/pages/edit-event/edit-event.ts b/src/addon/calendar/pages/edit-event/edit-event.ts index b8d8ef9f4..df1f0f8c7 100644 --- a/src/addon/calendar/pages/edit-event/edit-event.ts +++ b/src/addon/calendar/pages/edit-event/edit-event.ts @@ -148,8 +148,8 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy { /** * Fetch the data needed to render the form. * - * @param {boolean} [refresh] Whether it's refreshing data. - * @return {Promise} Promise resolved when done. + * @param refresh Whether it's refreshing data. + * @return Promise resolved when done. */ protected fetchData(refresh?: boolean): Promise { let accessInfo; @@ -289,9 +289,9 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy { /** * Load an event data into the form. * - * @param {any} event Event data. - * @param {boolean} isOffline Whether the data is from offline or not. - * @return {Promise} Promise resolved when done. + * @param event Event data. + * @param isOffline Whether the data is from offline or not. + * @return Promise resolved when done. */ protected loadEventData(event: any, isOffline: boolean): Promise { const courseId = event.course ? event.course.id : event.courseid; @@ -344,7 +344,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy { /** * Pull to refresh. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshData(refresher: any): void { const promises = [ @@ -375,7 +375,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy { /** * A course was selected, get its groups. * - * @param {number} courseId Course ID. + * @param courseId Course ID. */ groupCourseSelected(courseId: number): void { if (!courseId) { @@ -396,8 +396,8 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy { /** * Load groups of a certain course. * - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved when done. + * @param courseId Course ID. + * @return Promise resolved when done. */ protected loadGroups(courseId: number): Promise { 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. * - * @param {number} [event] Event. + * @param event Event. */ protected returnToList(event?: any): void { // 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. * - * @return {boolean|Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { diff --git a/src/addon/calendar/pages/event/event.ts b/src/addon/calendar/pages/event/event.ts index 8edc9b96e..21b503b5a 100644 --- a/src/addon/calendar/pages/event/event.ts +++ b/src/addon/calendar/pages/event/event.ts @@ -144,9 +144,9 @@ export class AddonCalendarEventPage implements OnDestroy { /** * Fetches the event and updates the view. * - * @param {boolean} [sync] Whether it should try to synchronize offline events. - * @param {boolean} [showErrors] Whether to show sync errors to the user. - * @return {Promise} Promise resolved when done. + * @param sync Whether it should try to synchronize offline events. + * @param showErrors Whether to show sync errors to the user. + * @return Promise resolved when done. */ fetchEvent(sync?: boolean, showErrors?: boolean): Promise { const currentSite = this.sitesProvider.getCurrentSite(), @@ -312,7 +312,7 @@ export class AddonCalendarEventPage implements OnDestroy { /** * Add a reminder for this event. * - * @param {Event} e Click event. + * @param e Click event. */ addNotificationTime(e: Event): void { e.preventDefault(); @@ -342,8 +342,8 @@ export class AddonCalendarEventPage implements OnDestroy { /** * Cancel the selected notification. * - * @param {number} id Reminder ID. - * @param {Event} e Click event. + * @param id Reminder ID. + * @param e Click event. */ cancelNotification(id: number, e: Event): void { e.preventDefault(); @@ -359,10 +359,10 @@ export class AddonCalendarEventPage implements OnDestroy { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @param {Function} [done] Function to call when done. - * @param {boolean} [showErrors] Whether to show sync errors to the user. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @param done Function to call when done. + * @param showErrors Whether to show sync errors to the user. + * @return Promise resolved when done. */ doRefresh(refresher?: any, done?: () => void, showErrors?: boolean): Promise { if (this.eventLoaded) { @@ -378,9 +378,9 @@ export class AddonCalendarEventPage implements OnDestroy { /** * Refresh the event. * - * @param {boolean} [sync] Whether it should try to synchronize offline events. - * @param {boolean} [showErrors] Whether to show sync errors to the user. - * @return {Promise} Promise resolved when done. + * @param sync Whether it should try to synchronize offline events. + * @param showErrors Whether to show sync errors to the user. + * @return Promise resolved when done. */ refreshEvent(sync?: boolean, showErrors?: boolean): Promise { 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. * - * @param {boolean} isManual Whether it's a manual sync. - * @param {any} data Sync result. + * @param isManual Whether it's a manual sync. + * @param data Sync result. */ protected checkSyncResult(isManual: boolean, data: any): void { if (!data) { diff --git a/src/addon/calendar/pages/index/index.ts b/src/addon/calendar/pages/index/index.ts index 8f3d5a129..e9dd336de 100644 --- a/src/addon/calendar/pages/index/index.ts +++ b/src/addon/calendar/pages/index/index.ts @@ -164,9 +164,9 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy { /** * Fetch all the data required for the view. * - * @param {boolean} [sync] Whether it should try to synchronize offline events. - * @param {boolean} [showErrors] Whether to show sync errors to the user. - * @return {Promise} Promise resolved when done. + * @param sync Whether it should try to synchronize offline events. + * @param showErrors Whether to show sync errors to the user. + * @return Promise resolved when done. */ fetchData(sync?: boolean, showErrors?: boolean): Promise { @@ -230,10 +230,10 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @param {Function} [done] Function to call when done. - * @param {boolean} [showErrors] Whether to show sync errors to the user. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @param done Function to call when done. + * @param showErrors Whether to show sync errors to the user. + * @return Promise resolved when done. */ doRefresh(refresher?: any, done?: () => void, showErrors?: boolean): Promise { if (this.loaded) { @@ -249,10 +249,10 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy { /** * Refresh the data. * - * @param {boolean} [sync] Whether it should try to synchronize offline events. - * @param {boolean} [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. - * @return {Promise} Promise resolved when done. + * @param sync Whether it should try to synchronize offline events. + * @param showErrors Whether to show sync errors to the user. + * @param afterChange Whether the refresh is done after an event has changed or has been synced. + * @return Promise resolved when done. */ refreshData(sync?: boolean, showErrors?: boolean, afterChange?: boolean): Promise { this.syncIcon = 'spinner'; @@ -276,7 +276,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy { /** * Navigate to a particular event. * - * @param {number} eventId Event to load. + * @param eventId Event to load. */ gotoEvent(eventId: number): void { if (eventId < 0) { @@ -292,7 +292,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy { /** * 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 { const params: any = { @@ -311,7 +311,7 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy { /** * Show the context menu. * - * @param {MouseEvent} event Event. + * @param event Event. */ openCourseFilter(event: MouseEvent): void { 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. * - * @param {number} [eventId] Event ID to edit. + * @param eventId Event ID to edit. */ openEdit(eventId?: number): void { const params: any = {}; diff --git a/src/addon/calendar/pages/list/list.ts b/src/addon/calendar/pages/list/list.ts index 0b864a78a..77b8922d1 100644 --- a/src/addon/calendar/pages/list/list.ts +++ b/src/addon/calendar/pages/list/list.ts @@ -233,10 +233,10 @@ export class AddonCalendarListPage implements OnDestroy { /** * Fetch all the data required for the view. * - * @param {boolean} [refresh] Empty events array first. - * @param {boolean} [sync] Whether it should try to synchronize offline events. - * @param {boolean} [showErrors] Whether to show sync errors to the user. - * @return {Promise} Promise resolved when done. + * @param refresh Empty events array first. + * @param sync Whether it should try to synchronize offline events. + * @param showErrors Whether to show sync errors to the user. + * @return Promise resolved when done. */ fetchData(refresh?: boolean, sync?: boolean, showErrors?: boolean): Promise { this.initialTime = this.timeUtils.timestamp(); @@ -314,8 +314,8 @@ export class AddonCalendarListPage implements OnDestroy { /** * Fetches the events and updates the view. * - * @param {boolean} [refresh] Empty events array first. - * @return {Promise} Promise resolved when done. + * @param refresh Empty events array first. + * @return Promise resolved when done. */ fetchEvents(refresh?: boolean): Promise { this.loadMoreError = false; @@ -388,8 +388,8 @@ export class AddonCalendarListPage implements OnDestroy { /** * Function to load more events. * - * @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. - * @return {Promise} Resolved when done. + * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. + * @return Resolved when done. */ loadMoreEvents(infiniteComplete?: any): Promise { return this.fetchEvents().finally(() => { @@ -400,7 +400,7 @@ export class AddonCalendarListPage implements OnDestroy { /** * Get filtered events. * - * @return {any[]} Filtered events. + * @return Filtered events. */ protected getFilteredEvents(): any[] { if (!this.courseId) { @@ -415,8 +415,8 @@ export class AddonCalendarListPage implements OnDestroy { /** * Returns if the current state should load categories or not. - * @param {any[]} events Events to parse. - * @return {boolean} True if categories should be loaded. + * @param events Events to parse. + * @return True if categories should be loaded. */ protected shouldLoadCategories(events: any[]): boolean { if (this.categoriesRetrieved || this.getCategories) { @@ -433,7 +433,7 @@ export class AddonCalendarListPage implements OnDestroy { /** * Load categories to be able to filter events. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected loadCategories(): Promise { 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. * - * @param {any[]} onlineEvents Online events. - * @return {any[]} Merged events. + * @param onlineEvents Online events. + * @return Merged events. */ protected mergeEvents(onlineEvents: any[]): any[] { if (!this.offlineEvents.length && !this.deletedEvents.length) { @@ -501,7 +501,7 @@ export class AddonCalendarListPage implements OnDestroy { /** * Sort events by timestart. * - * @param {any[]} events List to sort. + * @param events List to sort. */ protected sortEvents(events: any[]): any[] { return events.sort((a, b) => { @@ -516,10 +516,10 @@ export class AddonCalendarListPage implements OnDestroy { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @param {Function} [done] Function to call when done. - * @param {boolean} [showErrors] Whether to show sync errors to the user. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @param done Function to call when done. + * @param showErrors Whether to show sync errors to the user. + * @return Promise resolved when done. */ doRefresh(refresher?: any, done?: () => void, showErrors?: boolean): Promise { if (this.eventsLoaded) { @@ -535,9 +535,9 @@ export class AddonCalendarListPage implements OnDestroy { /** * Refresh the events. * - * @param {boolean} [sync] Whether it should try to synchronize offline events. - * @param {boolean} [showErrors] Whether to show sync errors to the user. - * @return {Promise} Promise resolved when done. + * @param sync Whether it should try to synchronize offline events. + * @param showErrors Whether to show sync errors to the user. + * @return Promise resolved when done. */ refreshEvents(sync?: boolean, showErrors?: boolean): Promise { this.syncIcon = 'spinner'; @@ -561,9 +561,9 @@ export class AddonCalendarListPage implements OnDestroy { * 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. * - * @param {any} event Current event where to show the date. - * @param {any} [prevEvent] Previous event where to compare the date with. - * @return {boolean} If date has changed and should be shown. + * @param event Current event where to show the date. + * @param prevEvent Previous event where to compare the date with. + * @return If date has changed and should be shown. */ protected showDate(event: any, prevEvent?: any): boolean { if (!prevEvent) { @@ -578,8 +578,8 @@ export class AddonCalendarListPage implements OnDestroy { /** * Check if event ends the same date or not. * - * @param {any} event Event info. - * @return {boolean} If date has changed and should be shown. + * @param event Event info. + * @return If date has changed and should be shown. */ protected endsSameDay(event: any): boolean { if (!event.timeduration) { @@ -594,7 +594,7 @@ export class AddonCalendarListPage implements OnDestroy { /** * Show the context menu. * - * @param {MouseEvent} event Event. + * @param event Event. */ openCourseFilter(event: MouseEvent): void { 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. * - * @param {number} [eventId] Event ID to edit. + * @param eventId Event ID to edit. */ openEdit(eventId?: number): void { this.eventId = undefined; @@ -644,7 +644,7 @@ export class AddonCalendarListPage implements OnDestroy { /** * Navigate to a particular event. * - * @param {number} eventId Event to load. + * @param eventId Event to load. */ gotoEvent(eventId: number): void { this.eventId = eventId; @@ -662,8 +662,8 @@ export class AddonCalendarListPage implements OnDestroy { /** * Find an event and mark it as deleted. * - * @param {number} eventId Event ID. - * @param {boolean} deleted Whether to mark it as deleted or not. + * @param eventId Event ID. + * @param deleted Whether to mark it as deleted or not. */ protected markAsDeleted(eventId: number, deleted: boolean): void { const event = this.onlineEvents.find((event) => { diff --git a/src/addon/calendar/pages/settings/settings.ts b/src/addon/calendar/pages/settings/settings.ts index bebc4f1e9..9027272db 100644 --- a/src/addon/calendar/pages/settings/settings.ts +++ b/src/addon/calendar/pages/settings/settings.ts @@ -45,7 +45,7 @@ export class AddonCalendarSettingsPage { /** * Update default time. * - * @param {number} newTime New time. + * @param newTime New time. */ updateDefaultTime(newTime: number): void { this.calendarProvider.setDefaultNotificationTime(newTime); diff --git a/src/addon/calendar/providers/calendar-offline.ts b/src/addon/calendar/providers/calendar-offline.ts index 5b0f02436..868d8558b 100644 --- a/src/addon/calendar/providers/calendar-offline.ts +++ b/src/addon/calendar/providers/calendar-offline.ts @@ -148,9 +148,9 @@ export class AddonCalendarOfflineProvider { /** * Delete an offline event. * - * @param {number} eventId Event ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if deleted, rejected if failure. + * @param eventId Event ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if deleted, rejected if failure. */ deleteEvent(eventId: number, siteId?: string): Promise { 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. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the IDs. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the IDs. */ getAllEventsIds(siteId?: string): Promise { const promises = []; @@ -182,8 +182,8 @@ export class AddonCalendarOfflineProvider { /** * Get all the events deleted in offline. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with all the events deleted in offline. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with all the events deleted in offline. */ getAllDeletedEvents(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -194,8 +194,8 @@ export class AddonCalendarOfflineProvider { /** * Get the IDs of all the events deleted in offline. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the IDs of all the events deleted in offline. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the IDs of all the events deleted in offline. */ getAllDeletedEventsIds(siteId?: string): Promise { return this.getAllDeletedEvents(siteId).then((events) => { @@ -208,8 +208,8 @@ export class AddonCalendarOfflineProvider { /** * Get all the events created/edited in offline. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with events. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with events. */ getAllEditedEvents(siteId?: string): Promise { 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. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with events IDs. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with events IDs. */ getAllEditedEventsIds(siteId?: string): Promise { return this.getAllEditedEvents(siteId).then((events) => { @@ -234,9 +234,9 @@ export class AddonCalendarOfflineProvider { /** * Get an event deleted in offline. * - * @param {number} eventId Event ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the deleted event. + * @param eventId Event ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the deleted event. */ getDeletedEvent(eventId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -251,9 +251,9 @@ export class AddonCalendarOfflineProvider { /** * Get an offline event. * - * @param {number} eventId Event ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the event. + * @param eventId Event ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the event. */ getEvent(eventId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -268,8 +268,8 @@ export class AddonCalendarOfflineProvider { /** * Check if there are offline events to send. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if has offline events, false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if has offline events, false otherwise. */ hasEditedEvents(siteId?: string): Promise { return this.getAllEditedEvents(siteId).then((events) => { @@ -283,8 +283,8 @@ export class AddonCalendarOfflineProvider { /** * Check whether there's offline data for a site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if has offline data, false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if has offline data, false otherwise. */ hasOfflineData(siteId?: string): Promise { return this.getAllEventsIds(siteId).then((ids) => { @@ -295,9 +295,9 @@ export class AddonCalendarOfflineProvider { /** * Check if an event is deleted. * - * @param {number} eventId Event ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether the event is deleted. + * @param eventId Event ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether the event is deleted. */ isEventDeleted(eventId: number, siteId?: string): Promise { return this.getDeletedEvent(eventId, siteId).then((event) => { @@ -310,11 +310,11 @@ export class AddonCalendarOfflineProvider { /** * Mark an event as deleted. * - * @param {number} eventId Event ID to delete. - * @param {number} 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 {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param eventId Event ID to delete. + * @param name Name of the event to delete. + * @param deleteAll If it's a repeated event. whether to delete all events of the series. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ markDeleted(eventId: number, name: string, deleteAll?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -332,11 +332,11 @@ export class AddonCalendarOfflineProvider { /** * 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 {any} data Event data. - * @param {number} [timeCreated] The time the event was created. If not defined, current time. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the stored event. + * @param eventId Event ID. If it's a new event, set it to undefined/null. + * @param data Event data. + * @param timeCreated The time the event was created. If not defined, current time. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the stored event. */ saveEvent(eventId: number, data: any, timeCreated?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -373,9 +373,9 @@ export class AddonCalendarOfflineProvider { /** * Unmark an event as deleted. * - * @param {number} eventId Event ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if deleted, rejected if failure. + * @param eventId Event ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if deleted, rejected if failure. */ unmarkDeleted(eventId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/calendar/providers/calendar-sync.ts b/src/addon/calendar/providers/calendar-sync.ts index bc9d96f33..d237e0897 100644 --- a/src/addon/calendar/providers/calendar-sync.ts +++ b/src/addon/calendar/providers/calendar-sync.ts @@ -59,9 +59,9 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider { /** * 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 {boolean} [force] Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncAllEvents(siteId?: string, force?: boolean): Promise { 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. * - * @param {string} siteId Site ID to sync. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ protected syncAllEventsFunc(siteId: string, force?: boolean): Promise { @@ -93,8 +93,8 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider { /** * 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. - * @return {Promise} Promise resolved when the events are synced or if it doesn't need to be synced. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the events are synced or if it doesn't need to be synced. */ syncEventsIfNeeded(siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -109,8 +109,8 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider { /** * Synchronize all offline events of a certain site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncEvents(siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -182,10 +182,10 @@ export class AddonCalendarSyncProvider extends CoreSyncBaseProvider { /** * Synchronize an offline event. * - * @param {number} eventId The event ID to sync. - * @param {any} result Object where to store the result of the sync. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param eventId The event ID to sync. + * @param result Object where to store the result of the sync. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ protected syncOfflineEvent(eventId: number, result: any, siteId?: string): Promise { diff --git a/src/addon/calendar/providers/calendar.ts b/src/addon/calendar/providers/calendar.ts index 892cb35cd..c518a989d 100644 --- a/src/addon/calendar/providers/calendar.ts +++ b/src/addon/calendar/providers/calendar.ts @@ -335,8 +335,8 @@ export class AddonCalendarProvider { /** * Check if a certain site allows deleting events. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if can delete. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if can delete. * @since 3.3 */ canDeleteEvents(siteId?: string): Promise { @@ -350,8 +350,8 @@ export class AddonCalendarProvider { /** * Check if a certain site allows deleting events. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether events can be deleted. + * @param site Site. If not defined, use current site. + * @return Whether events can be deleted. * @since 3.3 */ canDeleteEventsInSite(site?: CoreSite): boolean { @@ -363,8 +363,8 @@ export class AddonCalendarProvider { /** * Check if a certain site allows creating and editing events. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if can create/edit. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if can create/edit. * @since 3.7.1 */ canEditEvents(siteId?: string): Promise { @@ -378,8 +378,8 @@ export class AddonCalendarProvider { /** * Check if a certain site allows creating and editing events. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether events can be created and edited. + * @param site Site. If not defined, use current site. + * @return Whether events can be created and edited. * @since 3.7.1 */ canEditEventsInSite(site?: CoreSite): boolean { @@ -392,8 +392,8 @@ export class AddonCalendarProvider { /** * Check if a certain site allows viewing events in monthly view. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if monthly view is supported. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if monthly view is supported. * @since 3.4 */ canViewMonth(siteId?: string): Promise { @@ -407,8 +407,8 @@ export class AddonCalendarProvider { /** * Check if a certain site allows viewing events in monthly view. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether monthly view is supported. + * @param site Site. If not defined, use current site. + * @return Whether monthly view is supported. * @since 3.4 */ canViewMonthInSite(site?: CoreSite): boolean { @@ -420,8 +420,8 @@ export class AddonCalendarProvider { /** * Removes expired events from local DB. * - * @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. - * @return {Promise} Promise resolved when done. + * @param siteId ID of the site the event belongs to. If not defined, use current site. + * @return Promise resolved when done. */ cleanExpiredEvents(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -442,12 +442,12 @@ export class AddonCalendarProvider { /** * Delete an event. * - * @param {number} eventId Event ID to delete. - * @param {string} 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 {boolean} [forceOffline] True to always save it in offline. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param eventId Event ID to delete. + * @param name Name of the event to delete. + * @param deleteAll If it's a repeated event. whether to delete all events of the series. + * @param forceOffline True to always save it in offline. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ deleteEvent(eventId: number, name: string, deleteAll?: boolean, forceOffline?: boolean, siteId?: string): Promise { @@ -484,10 +484,10 @@ export class AddonCalendarProvider { /** * Delete an event. It will fail if offline or cannot connect. * - * @param {number} eventId Event ID to delete. - * @param {boolean} [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. - * @return {Promise} Promise resolved when done. + * @param eventId Event ID to delete. + * @param deleteAll If it's a repeated event. whether to delete all events of the series. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ deleteEventOnline(eventId: number, deleteAll?: boolean, siteId?: string): Promise { 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. * - * @param {number} eventId Event ID. - * @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. - * @return {Promise} Resolved when done. + * @param eventId Event ID. + * @param siteId ID of the site the event belongs to. If not defined, use current site. + * @return Resolved when done. */ protected deleteLocalEvent(eventId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -538,8 +538,8 @@ export class AddonCalendarProvider { /** * Check if event ends the same day or not. * - * @param {any} event Event info. - * @return {boolean} If the . + * @param event Event info. + * @return If the . */ endsSameDay(event: any): boolean { if (!event.timeduration) { @@ -554,13 +554,13 @@ export class AddonCalendarProvider { /** * Format event time. Similar to calendar_format_event_time. * - * @param {any} event Event to format. - * @param {string} format Calendar time format (from getCalendarTimeFormat). - * @param {boolean} [useCommonWords=true] 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 {number} [showTime=0] Determine the show time GMT timestamp. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the formatted event time. + * @param event Event to format. + * @param format Calendar time format (from getCalendarTimeFormat). + * @param useCommonWords Whether to use common words like "Today", "Yesterday", etc. + * @param seenDay Timestamp of day currently seen. If set, the function will not add links to this day. + * @param showTime Determine the show time GMT timestamp. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the formatted event time. */ formatEventTime(event: any, format: string, useCommonWords: boolean = true, seenDay?: number, showTime: number = 0, siteId?: string): Promise { @@ -630,9 +630,9 @@ export class AddonCalendarProvider { /** * Get access information for a calendar (either course calendar or site calendar). * - * @param {number} [courseId] Course ID. If not defined, site calendar. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with object with access information. + * @param courseId Course ID. If not defined, site calendar. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with object with access information. * @since 3.7 */ getAccessInformation(courseId?: number, siteId?: string): Promise { @@ -653,8 +653,8 @@ export class AddonCalendarProvider { /** * Get cache key for calendar access information WS calls. * - * @param {number} [courseId] Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getAccessInformationCacheKey(courseId?: number): string { return this.ROOT_CACHE_KEY + 'accessInformation:' + (courseId || 0); @@ -663,8 +663,8 @@ export class AddonCalendarProvider { /** * Get all calendar events from local Db. * - * @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. - * @return {Promise} Promise resolved with all the events. + * @param siteId ID of the site the event belongs to. If not defined, use current site. + * @return Promise resolved with all the events. */ getAllEventsFromLocalDb(siteId?: string): Promise { 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). * - * @param {number} [courseId] Course ID. If not defined, site calendar. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with an object indicating the types. + * @param courseId Course ID. If not defined, site calendar. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with an object indicating the types. * @since 3.7 */ getAllowedEventTypes(courseId?: number, siteId?: string): Promise { @@ -709,8 +709,8 @@ export class AddonCalendarProvider { /** * Get cache key for calendar allowed event types WS calls. * - * @param {number} [courseId] Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getAllowedEventTypesCacheKey(courseId?: number): string { return this.ROOT_CACHE_KEY + 'allowedEventTypes:' + (courseId || 0); @@ -719,8 +719,8 @@ export class AddonCalendarProvider { /** * Get the "look ahead" for a certain user. * - * @param {string} [siteId] ID of the site. If not defined, use current site. - * @return {Promise} Promise resolved with the look ahead (number of days). + * @param siteId ID of the site. If not defined, use current site. + * @return Promise resolved with the look ahead (number of days). */ getCalendarLookAhead(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -739,8 +739,8 @@ export class AddonCalendarProvider { /** * Get the time format to use in calendar. * - * @param {string} [siteId] ID of the site. If not defined, use current site. - * @return {Promise} Promise resolved with the format. + * @param siteId ID of the site. If not defined, use current site. + * @return Promise resolved with the format. */ getCalendarTimeFormat(siteId?: string): Promise { 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. * - * @param {number} time Timestamp to get the day from. - * @param {boolean} [useCommonWords=true] Whether to use common words like "Today", "Yesterday", etc. - * @return {string} The formatted date/time. + * @param time Timestamp to get the day from. + * @param useCommonWords Whether to use common words like "Today", "Yesterday", etc. + * @return The formatted date/time. */ getDayRepresentation(time: number, useCommonWords: boolean = true): string { @@ -797,8 +797,8 @@ export class AddonCalendarProvider { /** * Get the configured default notification time. * - * @param {string} [siteId] ID of the site. If not defined, use current site. - * @return {Promise} Promise resolved with the default time. + * @param siteId ID of the site. If not defined, use current site. + * @return Promise resolved with the default time. */ getDefaultNotificationTime(siteId?: string): Promise { 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. * - * @param {number} id Event ID. - * @param {boolean} [refresh] True when we should update the event data. - * @param {string} [siteId] ID of the site. If not defined, use current site. - * @return {Promise} Promise resolved when the event data is retrieved. + * @param id Event ID. + * @param refresh True when we should update the event data. + * @param siteId ID of the site. If not defined, use current site. + * @return Promise resolved when the event data is retrieved. */ getEvent(id: number, siteId?: string): Promise { 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. * - * @param {number} id Event ID. - * @param {boolean} [refresh] True when we should update the event data. - * @param {string} [siteId] ID of the site. If not defined, use current site. - * @return {Promise} Promise resolved when the event data is retrieved. + * @param id Event ID. + * @param refresh True when we should update the event data. + * @param siteId ID of the site. If not defined, use current site. + * @return Promise resolved when the event data is retrieved. * @since 3.4 */ getEventById(id: number, siteId?: string): Promise { @@ -877,8 +877,8 @@ export class AddonCalendarProvider { /** * Get cache key for a single event WS call. * - * @param {number} id Event ID. - * @return {string} Cache key. + * @param id Event ID. + * @return Cache key. */ protected getEventCacheKey(id: number): string { return this.ROOT_CACHE_KEY + 'events:' + id; @@ -887,9 +887,9 @@ export class AddonCalendarProvider { /** * Get a calendar event from local Db. * - * @param {number} id Event ID. - * @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. - * @return {Promise} Promise resolved when the event data is retrieved. + * @param id Event ID. + * @param siteId ID of the site the event belongs to. If not defined, use current site. + * @return Promise resolved when the event data is retrieved. */ getEventFromLocalDb(id: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -913,10 +913,10 @@ export class AddonCalendarProvider { /** * Adds an event reminder and schedule a new notification. * - * @param {any} event Event to update its notification time. - * @param {number} time New notification setting timestamp. - * @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. - * @return {Promise} Promise resolved when the notification is updated. + * @param event Event to update its notification time. + * @param time New notification setting timestamp. + * @param siteId ID of the site the event belongs to. If not defined, use current site. + * @return Promise resolved when the notification is updated. */ addEventReminder(event: any, time: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -935,8 +935,8 @@ export class AddonCalendarProvider { * Return the normalised event type. * Activity events are normalised to be course events. * - * @param {any} event The event to get its type. - * @return {string} Event type. + * @param event The event to get its type. + * @return Event type. */ getEventType(event: any): string { if (event.modulename) { @@ -949,9 +949,9 @@ export class AddonCalendarProvider { /** * Remove an event reminder and cancel the notification. * - * @param {number} id Reminder ID. - * @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. - * @return {Promise} Promise resolved when the notification is updated. + * @param id Reminder ID. + * @param siteId ID of the site the event belongs to. If not defined, use current site. + * @return Promise resolved when the notification is updated. */ deleteEventReminder(id: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -966,14 +966,14 @@ export class AddonCalendarProvider { /** * Get calendar events for a certain day. * - * @param {number} year Year to get. - * @param {number} month Month to get. - * @param {number} day Day to get. - * @param {number} [courseId] Course to get. - * @param {number} [categoryId] Category to get. - * @param {boolean} [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. - * @return {Promise} Promise resolved with the response. + * @param year Year to get. + * @param month Month to get. + * @param day Day to get. + * @param courseId Course to get. + * @param categoryId Category to get. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the response. */ getDayEvents(year: number, month: number, day: number, courseId?: number, categoryId?: number, ignoreCache?: boolean, siteId?: string): Promise { @@ -1014,7 +1014,7 @@ export class AddonCalendarProvider { /** * Get prefix cache key for day events WS calls. * - * @return {string} Prefix Cache key. + * @return Prefix Cache key. */ protected getDayEventsPrefixCacheKey(): string { 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. * - * @param {number} year Year to get. - * @param {number} month Month to get. - * @param {number} day Day to get. - * @return {string} Prefix Cache key. + * @param year Year to get. + * @param month Month to get. + * @param day Day to get. + * @return Prefix Cache key. */ protected getDayEventsDayPrefixCacheKey(year: number, month: number, day: number): string { return this.getDayEventsPrefixCacheKey() + year + ':' + month + ':' + day + ':'; @@ -1035,12 +1035,12 @@ export class AddonCalendarProvider { /** * Get cache key for day events WS calls. * - * @param {number} year Year to get. - * @param {number} month Month to get. - * @param {number} day Day to get. - * @param {number} [courseId] Course to get. - * @param {number} [categoryId] Category to get. - * @return {string} Cache key. + * @param year Year to get. + * @param month Month to get. + * @param day Day to get. + * @param courseId Course to get. + * @param categoryId Category to get. + * @return Cache key. */ protected getDayEventsCacheKey(year: number, month: number, day: number, courseId?: number, categoryId?: number): string { return this.getDayEventsDayPrefixCacheKey(year, month, day) + (courseId ? courseId : '') + ':' + @@ -1050,9 +1050,9 @@ export class AddonCalendarProvider { /** * Get a calendar reminders from local Db. * - * @param {number} id Event ID. - * @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. - * @return {Promise} Promise resolved when the event data is retrieved. + * @param id Event ID. + * @param siteId ID of the site the event belongs to. If not defined, use current site. + * @return Promise resolved when the event data is retrieved. */ getEventReminders(id: number, siteId?: string): Promise { 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 * and ending before 60 days from now. * - * @param {number} [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 {number} [daysInterval=30] Number of days between timestart and timeend. - * @param {string} [siteId] Site to get the events from. If not defined, use current site. - * @return {Promise} Promise to be resolved when the participants are retrieved. + * @param initialTime Timestamp when the first fetch was done. If not defined, current time. + * @param daysToStart Number of days from now to start getting events. + * @param daysInterval Number of days between timestart and timeend. + * @param siteId Site to get the events from. If not defined, use current site. + * @return Promise to be resolved when the participants are retrieved. */ getEventsList(initialTime?: number, daysToStart: number = 0, daysInterval: number = AddonCalendarProvider.DAYS_INTERVAL, siteId?: string): Promise { @@ -1137,7 +1137,7 @@ export class AddonCalendarProvider { /** * Get prefix cache key for events list WS calls. * - * @return {string} Prefix Cache key. + * @return Prefix Cache key. */ protected getEventsListPrefixCacheKey(): string { return this.ROOT_CACHE_KEY + 'events:'; @@ -1146,9 +1146,9 @@ export class AddonCalendarProvider { /** * Get cache key for events list WS calls. * - * @param {number} daysToStart Number of days from now to start getting events. - * @param {number} daysInterval Number of days between timestart and timeend. - * @return {string} Cache key. + * @param daysToStart Number of days from now to start getting events. + * @param daysInterval Number of days between timestart and timeend. + * @return Cache key. */ protected getEventsListCacheKey(daysToStart: number, daysInterval: number): string { return this.getEventsListPrefixCacheKey() + daysToStart + ':' + daysInterval; @@ -1157,9 +1157,9 @@ export class AddonCalendarProvider { /** * Get calendar events from local Db that have the same repeatid. * - * @param {number} [repeatId] Repeat Id of the event. - * @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. - * @return {Promise} Promise resolved with all the events. + * @param repeatId Repeat Id of the event. + * @param siteId ID of the site the event belongs to. If not defined, use current site. + * @return Promise resolved with all the events. */ getLocalEventsByRepeatIdFromLocalDb(repeatId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1169,13 +1169,13 @@ export class AddonCalendarProvider { /** * Get monthly calendar events. * - * @param {number} year Year to get. - * @param {number} month Month to get. - * @param {number} [courseId] Course to get. - * @param {number} [categoryId] Category to get. - * @param {boolean} [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. - * @return {Promise} Promise resolved with the response. + * @param year Year to get. + * @param month Month to get. + * @param courseId Course to get. + * @param categoryId Category to get. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the response. */ getMonthlyEvents(year: number, month: number, courseId?: number, categoryId?: number, ignoreCache?: boolean, siteId?: string) : Promise { @@ -1230,7 +1230,7 @@ export class AddonCalendarProvider { /** * Get prefix cache key for monthly events WS calls. * - * @return {string} Prefix Cache key. + * @return Prefix Cache key. */ protected getMonthlyEventsPrefixCacheKey(): string { 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. * - * @param {number} year Year to get. - * @param {number} month Month to get. - * @return {string} Prefix Cache key. + * @param year Year to get. + * @param month Month to get. + * @return Prefix Cache key. */ protected getMonthlyEventsMonthPrefixCacheKey(year: number, month: number): string { return this.getMonthlyEventsPrefixCacheKey() + year + ':' + month + ':'; @@ -1250,11 +1250,11 @@ export class AddonCalendarProvider { /** * Get cache key for monthly events WS calls. * - * @param {number} year Year to get. - * @param {number} month Month to get. - * @param {number} [courseId] Course to get. - * @param {number} [categoryId] Category to get. - * @return {string} Cache key. + * @param year Year to get. + * @param month Month to get. + * @param courseId Course to get. + * @param categoryId Category to get. + * @return Cache key. */ protected getMonthlyEventsCacheKey(year: number, month: number, courseId?: number, categoryId?: number): string { return this.getMonthlyEventsMonthPrefixCacheKey(year, month) + (courseId ? courseId : '') + ':' + @@ -1264,11 +1264,11 @@ export class AddonCalendarProvider { /** * Get upcoming calendar events. * - * @param {number} [courseId] Course to get. - * @param {number} [categoryId] Category to get. - * @param {boolean} [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. - * @return {Promise} Promise resolved with the response. + * @param courseId Course to get. + * @param categoryId Category to get. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the response. */ getUpcomingEvents(courseId?: number, categoryId?: number, ignoreCache?: boolean, siteId?: string): Promise { @@ -1304,7 +1304,7 @@ export class AddonCalendarProvider { /** * Get prefix cache key for upcoming events WS calls. * - * @return {string} Prefix Cache key. + * @return Prefix Cache key. */ protected getUpcomingEventsPrefixCacheKey(): string { return this.ROOT_CACHE_KEY + 'upcoming:'; @@ -1313,9 +1313,9 @@ export class AddonCalendarProvider { /** * Get cache key for upcoming events WS calls. * - * @param {number} [courseId] Course to get. - * @param {number} [categoryId] Category to get. - * @return {string} Cache key. + * @param courseId Course to get. + * @param categoryId Category to get. + * @return Cache key. */ protected getUpcomingEventsCacheKey(courseId?: number, categoryId?: number): string { return this.getUpcomingEventsPrefixCacheKey() + (courseId ? courseId : '') + ':' + (categoryId ? categoryId : ''); @@ -1324,11 +1324,11 @@ export class AddonCalendarProvider { /** * Get URL to view a calendar. * - * @param {string} view The view to load: 'month', 'day', 'upcoming', etc. - * @param {number} [time] Time to load. If not defined, current time. - * @param {string} [courseId] Course to load. If not defined, all courses. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the URL.x + * @param view The view to load: 'month', 'day', 'upcoming', etc. + * @param time Time to load. If not defined, current time. + * @param courseId Course to load. If not defined, all courses. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the URL.x */ getViewUrl(view: string, time?: number, courseId?: string, siteId?: string): Promise { 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. * - * @param {number} [startingDay=0] Starting day. 0=Sunday, 1=Monday, ... - * @return {any[]} Week days. + * @param startingDay Starting day. 0=Sunday, 1=Monday, ... + * @return Week days. */ getWeekDays(startingDay?: number): any[] { startingDay = startingDay || 0; @@ -1361,9 +1361,9 @@ export class AddonCalendarProvider { /** * Invalidates access information. * - * @param {number} [courseId] Course ID. If not defined, site calendar. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. If not defined, site calendar. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAccessInformation(courseId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1374,9 +1374,9 @@ export class AddonCalendarProvider { /** * Invalidates allowed event types. * - * @param {number} [courseId] Course ID. If not defined, site calendar. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. If not defined, site calendar. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAllowedEventTypes(courseId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1387,8 +1387,8 @@ export class AddonCalendarProvider { /** * Invalidates day events for all days. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateAllDayEvents(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1399,10 +1399,10 @@ export class AddonCalendarProvider { /** * Invalidates day events for a certain day. * - * @param {number} year Year. - * @param {number} month Month. - * @param {number} day Day. - * @return {Promise} Promise resolved when the data is invalidated. + * @param year Year. + * @param month Month. + * @param day Day. + * @return Promise resolved when the data is invalidated. */ invalidateDayEvents(year: number, month: number, day: number, siteId?: string): Promise { 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. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the list is invalidated. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the list is invalidated. */ invalidateEventsList(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1433,9 +1433,9 @@ export class AddonCalendarProvider { /** * Invalidates a single event. * - * @param {number} eventId List of courses or course ids. - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the list is invalidated. + * @param eventId List of courses or course ids. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the list is invalidated. */ invalidateEvent(eventId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1446,8 +1446,8 @@ export class AddonCalendarProvider { /** * Invalidates monthly events for all months. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateAllMonthlyEvents(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1458,9 +1458,9 @@ export class AddonCalendarProvider { /** * Invalidates monthly events for a certain months. * - * @param {number} year Year. - * @param {number} month Month. - * @return {Promise} Promise resolved when the data is invalidated. + * @param year Year. + * @param month Month. + * @return Promise resolved when the data is invalidated. */ invalidateMonthlyEvents(year: number, month: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1471,8 +1471,8 @@ export class AddonCalendarProvider { /** * Invalidates upcoming events for all courses and categories. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateAllUpcomingEvents(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1483,10 +1483,10 @@ export class AddonCalendarProvider { /** * Invalidates upcoming events for a certain course or category. * - * @param {number} [courseId] Course ID. - * @param {number} [categoryId] Category ID. - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param categoryId Category ID. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateUpcomingEvents(courseId?: number, categoryId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1497,8 +1497,8 @@ export class AddonCalendarProvider { /** * Invalidates look ahead setting. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateLookAhead(siteId?: string): Promise { return this.userProvider.invalidateUserPreference('calendar_lookahead', siteId); @@ -1507,8 +1507,8 @@ export class AddonCalendarProvider { /** * Invalidates time format setting. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateTimeFormat(siteId?: string): Promise { return this.userProvider.invalidateUserPreference('calendar_timeformat', siteId); @@ -1517,8 +1517,8 @@ export class AddonCalendarProvider { /** * Check if Calendar is disabled in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's disabled. + * @param site Site. If not defined, use current site. + * @return Whether it's disabled. */ isCalendarDisabledInSite(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -1529,8 +1529,8 @@ export class AddonCalendarProvider { /** * Check if Calendar is disabled in a certain site. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. */ isDisabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1541,8 +1541,8 @@ export class AddonCalendarProvider { /** * Check if the get event by ID WS is available. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if available. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if available. * @since 3.4 */ isGetEventByIdAvailable(siteId?: string): Promise { @@ -1556,8 +1556,8 @@ export class AddonCalendarProvider { /** * Check if the get event by ID WS is available in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's available. + * @param site Site. If not defined, use current site. + * @return Whether it's available. * @since 3.4 */ 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 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 { 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. * If local notification plugin is not enabled, resolve the promise. * - * @param {any} event Event to schedule. - * @param {number} 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. - * @return {Promise} Promise resolved when the notification is scheduled. + * @param event Event to schedule. + * @param time Notification setting time (in minutes). E.g. 10 means "notificate 10 minutes before start". + * @param siteId Site ID the event belongs to. If not defined, use current site. + * @return Promise resolved when the notification is scheduled. */ protected scheduleEventNotification(event: any, reminderId: number, time: number, siteId?: string): Promise { 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 local notification plugin is not enabled, resolve the promise. * - * @param {any[]} events Events to schedule. - * @param {string} [siteId] ID of the site the events belong to. If not defined, use current site. - * @return {Promise} Promise resolved when all the notifications have been scheduled. + * @param events Events to schedule. + * @param siteId ID of the site the events belong to. If not defined, use current site. + * @return Promise resolved when all the notifications have been scheduled. */ scheduleEventsNotifications(events: any[], siteId?: string): Promise { @@ -1699,9 +1699,9 @@ export class AddonCalendarProvider { /** * Set the default notification time. * - * @param {number} time New default time. - * @param {string} [siteId] ID of the site. If not defined, use current site. - * @return {Promise} Promise resolved when stored. + * @param time New default time. + * @param siteId ID of the site. If not defined, use current site. + * @return Promise resolved when stored. */ setDefaultNotificationTime(time: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -1714,9 +1714,9 @@ export class AddonCalendarProvider { /** * Store an event in local DB as it is. * - * @param {any} event Event to store. - * @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. - * @return {Promise} Promise resolved when stored. + * @param event Event to store. + * @param siteId ID of the site the event belongs to. If not defined, use current site. + * @return Promise resolved when stored. */ storeEventInLocalDb(event: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1780,9 +1780,9 @@ export class AddonCalendarProvider { /** * Store events in local DB. * - * @param {any[]} events Events to store. - * @param {string} [siteId] ID of the site the event belongs to. If not defined, use current site. - * @return {Promise} Promise resolved when the events are stored. + * @param events Events to store. + * @param siteId ID of the site the event belongs to. If not defined, use current site. + * @return Promise resolved when the events are stored. */ protected storeEventsInLocalDB(events: any[], siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1798,13 +1798,13 @@ export class AddonCalendarProvider { /** * Submit a calendar event. * - * @param {number} eventId ID of the event. If undefined/null, create a new event. - * @param {any} formData Form data. - * @param {number} [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 {string} [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 - * sent to server or stored in offline. + * @param eventId ID of the event. If undefined/null, create a new event. + * @param formData Form data. + * @param timeCreated The time the event was created. Only if modifying a new offline event. + * @param forceOffline True to always save it in offline. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the event and a boolean indicating if data was + * sent to server or stored in offline. */ submitEvent(eventId: number, formData: any, timeCreated?: number, forceOffline?: boolean, siteId?: string): 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. * - * @param {number} eventId ID of the event. If undefined/null, create a new event. - * @param {any} formData Form data. - * @param {string} [siteId] Site ID. If not provided, current site. - * @return {Promise} Promise resolved when done. + * @param eventId ID of the event. If undefined/null, create a new event. + * @param formData Form data. + * @param siteId Site ID. If not provided, current site. + * @return Promise resolved when done. */ submitEventOnline(eventId: number, formData: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/calendar/providers/helper.ts b/src/addon/calendar/providers/helper.ts index 7fd222659..6c2cd8a6b 100644 --- a/src/addon/calendar/providers/helper.ts +++ b/src/addon/calendar/providers/helper.ts @@ -49,8 +49,8 @@ export class AddonCalendarHelperProvider { /** * Calculate some day data based on a list of events for that day. * - * @param {any} day Day. - * @param {any[]} events Events. + * @param day Day. + * @param events Events. */ calculateDayData(day: any, events: any[]): void { day.hasevents = events.length > 0; @@ -71,9 +71,9 @@ export class AddonCalendarHelperProvider { /** * Check if current user can create/edit events. * - * @param {number} [courseId] Course ID. If not defined, site calendar. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether the user can create events. + * @param courseId Course ID. If not defined, site calendar. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether the user can create events. */ canEditEvents(courseId?: number, siteId?: string): Promise { 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, * it will be included in all the days it lasts. * - * @param {any[]} events Events to classify. - * @return {{[monthId: string]: {[day: number]: any[]}}} Object with the classified events. + * @param events Events to classify. + * @return Object with the classified events. */ 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. * - * @param {any} e Event to format. + * @param e Event to format. */ formatEventData(e: any): void { e.icon = this.EVENTICONS[e.eventtype] || false; @@ -157,8 +157,8 @@ export class AddonCalendarHelperProvider { /** * Get options (name & value) for each allowed event type. * - * @param {any} eventTypes Result of getAllowedEventTypes. - * @return {{name: string, value: string}[]} Options. + * @param eventTypes Result of getAllowedEventTypes. + * @return Options. */ getEventTypeOptions(eventTypes: any): {name: string, value: string}[] { const options = []; @@ -185,9 +185,9 @@ export class AddonCalendarHelperProvider { /** * Get the month "id" (year + month). * - * @param {number} year Year. - * @param {number} month Month. - * @return {string} The "id". + * @param year Year. + * @param month Month. + * @return The "id". */ getMonthId(year: number, month: number): string { 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. * - * @param {number} year Year to get. - * @param {number} month Month to get. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the response. + * @param year Year to get. + * @param month Month to get. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the response. */ getOfflineMonthWeeks(year: number, month: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -256,9 +256,9 @@ export class AddonCalendarHelperProvider { /** * Check if the data of an event has changed. * - * @param {any} data Current data. - * @param {any} [original] Original data. - * @return {boolean} True if data has changed, false otherwise. + * @param data Current data. + * @param original Original data. + * @return True if data has changed, false otherwise. */ hasEventDataChanged(data: any, original?: any): boolean { if (!original) { @@ -297,11 +297,11 @@ export class AddonCalendarHelperProvider { /** * Check if an event should be displayed based on the filter. * - * @param {any} event Event object. - * @param {number} courseId Course ID to filter. - * @param {number} categoryId Category ID the course belongs to. - * @param {any} categories Categories indexed by ID. - * @return {boolean} Whether it should be displayed. + * @param event Event object. + * @param courseId Course ID to filter. + * @param categoryId Category ID the course belongs to. + * @param categories Categories indexed by ID. + * @return Whether it should be displayed. */ shouldDisplayEvent(event: any, courseId: number, categoryId: number, categories: any): boolean { 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 * 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 {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when done. + * @param events Events that have been touched and number of times each event is repeated. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when done. */ refreshAfterChangeEvents(events: {event: any, repeated: number}[], siteId?: string): Promise { 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 * for their repeated events if needed. * - * @param {any} event Event that has been touched. - * @param {number} repeated Number of times the event is repeated. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when done. + * @param event Event that has been touched. + * @param repeated Number of times the event is repeated. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when done. */ refreshAfterChangeEvent(event: any, repeated: number, siteId?: string): Promise { return this.refreshAfterChangeEvents([{event: event, repeated: repeated}], siteId); diff --git a/src/addon/calendar/providers/mainmenu-handler.ts b/src/addon/calendar/providers/mainmenu-handler.ts index 0568eeb01..2b38a6507 100644 --- a/src/addon/calendar/providers/mainmenu-handler.ts +++ b/src/addon/calendar/providers/mainmenu-handler.ts @@ -29,7 +29,7 @@ export class AddonCalendarMainMenuHandler implements CoreMainMenuHandler { /** * 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 { return !this.calendarProvider.isCalendarDisabledInSite(); @@ -38,7 +38,7 @@ export class AddonCalendarMainMenuHandler implements CoreMainMenuHandler { /** * 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 { return { diff --git a/src/addon/calendar/providers/sync-cron-handler.ts b/src/addon/calendar/providers/sync-cron-handler.ts index 6aabcca74..a73e8d1a8 100644 --- a/src/addon/calendar/providers/sync-cron-handler.ts +++ b/src/addon/calendar/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class AddonCalendarSyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.calendarSync.syncAllEvents(siteId, force); @@ -40,7 +40,7 @@ export class AddonCalendarSyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return this.calendarSync.syncInterval; diff --git a/src/addon/calendar/providers/view-link-handler.ts b/src/addon/calendar/providers/view-link-handler.ts index e0ba641c0..630c4c4fb 100644 --- a/src/addon/calendar/providers/view-link-handler.ts +++ b/src/addon/calendar/providers/view-link-handler.ts @@ -35,11 +35,11 @@ export class AddonCalendarViewLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -90,11 +90,11 @@ export class AddonCalendarViewLinkHandler extends CoreContentLinksHandlerBase { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { if (params.view && this.SUPPORTED_VIEWS.indexOf(params.view) == -1) { diff --git a/src/addon/competency/components/course/course.ts b/src/addon/competency/components/course/course.ts index 65cdb0643..c9c2a0c15 100644 --- a/src/addon/competency/components/course/course.ts +++ b/src/addon/competency/components/course/course.ts @@ -52,7 +52,7 @@ export class AddonCompetencyCourseComponent { /** * Fetches the competencies and updates the view. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchCourseCompetencies(): Promise { return this.competencyProvider.getCourseCompetencies(this.courseId, this.userId).then((competencies) => { @@ -70,7 +70,7 @@ export class AddonCompetencyCourseComponent { /** * Opens a competency. * - * @param {number} competencyId + * @param competencyId */ openCompetency(competencyId: number): void { if (this.appProvider.isWide()) { @@ -83,7 +83,7 @@ export class AddonCompetencyCourseComponent { /** * Opens the summary of a competency. * - * @param {number} competencyId + * @param competencyId */ openCompetencySummary(competencyId: number): void { this.navCtrl.push('AddonCompetencyCompetencySummaryPage', {competencyId}); @@ -92,7 +92,7 @@ export class AddonCompetencyCourseComponent { /** * Refreshes the competencies. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshCourseCompetencies(refresher: any): void { this.competencyProvider.invalidateCourseCompetencies(this.courseId, this.userId).finally(() => { diff --git a/src/addon/competency/pages/competencies/competencies.ts b/src/addon/competency/pages/competencies/competencies.ts index 1278e318f..40eed9b3d 100644 --- a/src/addon/competency/pages/competencies/competencies.ts +++ b/src/addon/competency/pages/competencies/competencies.ts @@ -69,7 +69,7 @@ export class AddonCompetencyCompetenciesPage { /** * Fetches the competencies and updates the view. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchCompetencies(): Promise { let promise; @@ -102,7 +102,7 @@ export class AddonCompetencyCompetenciesPage { /** * Opens a competency. * - * @param {number} competencyId + * @param competencyId */ openCompetency(competencyId: number): void { this.competencyId = competencyId; @@ -118,7 +118,7 @@ export class AddonCompetencyCompetenciesPage { /** * Refreshes the competencies. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshCompetencies(refresher: any): void { let promise; diff --git a/src/addon/competency/pages/competency/competency.ts b/src/addon/competency/pages/competency/competency.ts index c3930b945..a9999c740 100644 --- a/src/addon/competency/pages/competency/competency.ts +++ b/src/addon/competency/pages/competency/competency.ts @@ -76,7 +76,7 @@ export class AddonCompetencyCompetencyPage { /** * Fetches the competency and updates the view. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchCompetency(): Promise { let promise; @@ -124,7 +124,7 @@ export class AddonCompetencyCompetencyPage { /** * Refreshes the competency. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshCompetency(refresher: any): void { let promise; @@ -144,7 +144,7 @@ export class AddonCompetencyCompetencyPage { /** * Opens the summary of a competency. * - * @param {number} competencyId + * @param competencyId */ openCompetencySummary(competencyId: number): void { // Decide which navCtrl to use. If this page is inside a split view, use the split view's master nav. diff --git a/src/addon/competency/pages/competencysummary/competencysummary.ts b/src/addon/competency/pages/competencysummary/competencysummary.ts index db4c7a32d..fc81a80fc 100644 --- a/src/addon/competency/pages/competencysummary/competencysummary.ts +++ b/src/addon/competency/pages/competencysummary/competencysummary.ts @@ -55,7 +55,7 @@ export class AddonCompetencyCompetencySummaryPage { /** * Fetches the competency summary and updates the view. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchCompetency(): Promise { return this.competencyProvider.getCompetencySummary(this.competencyId).then((competency) => { @@ -68,7 +68,7 @@ export class AddonCompetencyCompetencySummaryPage { /** * Refreshes the competency summary. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshCompetency(refresher: any): void { this.competencyProvider.invalidateCompetencySummary(this.competencyId).finally(() => { @@ -81,7 +81,7 @@ export class AddonCompetencyCompetencySummaryPage { /** * Opens the summary of a competency. * - * @param {number} competencyId + * @param competencyId */ openCompetencySummary(competencyId: number): void { // Decide which navCtrl to use. If this page is inside a split view, use the split view's master nav. diff --git a/src/addon/competency/pages/plan/plan.ts b/src/addon/competency/pages/plan/plan.ts index 33a01c8b8..acbb1e419 100644 --- a/src/addon/competency/pages/plan/plan.ts +++ b/src/addon/competency/pages/plan/plan.ts @@ -52,7 +52,7 @@ export class AddonCompetencyPlanPage { /** * Fetches the learning plan and updates the view. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchLearningPlan(): Promise { return this.competencyProvider.getLearningPlan(this.planId).then((plan) => { @@ -74,7 +74,7 @@ export class AddonCompetencyPlanPage { /** * Navigates to a particular competency. * - * @param {number} competencyId + * @param competencyId */ openCompetency(competencyId: number): void { const navCtrl = this.svComponent ? this.svComponent.getMasterNav() : this.navCtrl; @@ -88,7 +88,7 @@ export class AddonCompetencyPlanPage { /** * Refreshes the learning plan. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshLearningPlan(refresher: any): void { this.competencyProvider.invalidateLearningPlan(this.planId).finally(() => { diff --git a/src/addon/competency/pages/planlist/planlist.ts b/src/addon/competency/pages/planlist/planlist.ts index 6c05ab924..04994ac20 100644 --- a/src/addon/competency/pages/planlist/planlist.ts +++ b/src/addon/competency/pages/planlist/planlist.ts @@ -62,7 +62,7 @@ export class AddonCompetencyPlanListPage { /** * Fetches the learning plans and updates the view. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchLearningPlans(): Promise { return this.competencyProvider.getLearningPlans(this.userId).then((plans) => { @@ -89,7 +89,7 @@ export class AddonCompetencyPlanListPage { /** * Refreshes the learning plans. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshLearningPlans(refresher: any): void { this.competencyProvider.invalidateLearningPlans(this.userId).finally(() => { @@ -102,7 +102,7 @@ export class AddonCompetencyPlanListPage { /** * Opens a learning plan. * - * @param {number} planId Learning plan to load. + * @param planId Learning plan to load. */ openPlan(planId: number): void { this.planId = planId; diff --git a/src/addon/competency/providers/competency-link-handler.ts b/src/addon/competency/providers/competency-link-handler.ts index a85c8d1bb..9facae6b8 100644 --- a/src/addon/competency/providers/competency-link-handler.ts +++ b/src/addon/competency/providers/competency-link-handler.ts @@ -33,11 +33,11 @@ export class AddonCompetencyCompetencyLinkHandler extends CoreContentLinksHandle /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -59,11 +59,11 @@ export class AddonCompetencyCompetencyLinkHandler extends CoreContentLinksHandle * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { // Handler is disabled if all competency features are disabled. diff --git a/src/addon/competency/providers/competency.ts b/src/addon/competency/providers/competency.ts index f2ba8f2a6..ea0f6df89 100644 --- a/src/addon/competency/providers/competency.ts +++ b/src/addon/competency/providers/competency.ts @@ -48,8 +48,8 @@ export class AddonCompetencyProvider { /** * Check if all competencies features are disabled. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether all competency features are disabled. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether all competency features are disabled. */ allCompetenciesDisabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -62,8 +62,8 @@ export class AddonCompetencyProvider { /** * Get cache key for user learning plans data WS calls. * - * @param {number} userId User ID. - * @return {string} Cache key. + * @param userId User ID. + * @return Cache key. */ protected getLearningPlansCacheKey(userId: number): string { return this.ROOT_CACHE_KEY + 'userplans:' + userId; @@ -72,8 +72,8 @@ export class AddonCompetencyProvider { /** * Get cache key for learning plan data WS calls. * - * @param {number} planId Plan ID. - * @return {string} Cache key. + * @param planId Plan ID. + * @return Cache key. */ protected getLearningPlanCacheKey(planId: number): string { return this.ROOT_CACHE_KEY + 'learningplan:' + planId; @@ -82,9 +82,9 @@ export class AddonCompetencyProvider { /** * Get cache key for competency in plan data WS calls. * - * @param {number} planId Plan ID. - * @param {number} competencyId Competency ID. - * @return {string} Cache key. + * @param planId Plan ID. + * @param competencyId Competency ID. + * @return Cache key. */ protected getCompetencyInPlanCacheKey(planId: number, competencyId: number): string { 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. * - * @param {number} courseId Course ID. - * @param {number} competencyId Competency ID. - * @param {number} userId User ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @param competencyId Competency ID. + * @param userId User ID. + * @return Cache key. */ protected getCompetencyInCourseCacheKey(courseId: number, competencyId: number, userId: number): string { 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. * - * @param {number} competencyId Competency ID. - * @param {number} userId User ID. - * @return {string} Cache key. + * @param competencyId Competency ID. + * @param userId User ID. + * @return Cache key. */ protected getCompetencySummaryCacheKey(competencyId: number, userId: number): string { return this.ROOT_CACHE_KEY + 'competencysummary:' + userId + ':' + competencyId; @@ -116,8 +116,8 @@ export class AddonCompetencyProvider { /** * Get cache key for course competencies data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getCourseCompetenciesCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'coursecompetencies:' + courseId; @@ -126,9 +126,9 @@ export class AddonCompetencyProvider { /** * Returns whether competencies are enabled. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} competencies if enabled for the given course, false otherwise. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return competencies if enabled for the given course, false otherwise. */ isPluginForCourseEnabled(courseId: number, siteId?: string): Promise { if (!this.sitesProvider.isLoggedIn()) { @@ -143,9 +143,9 @@ export class AddonCompetencyProvider { /** * Get plans for a certain user. * - * @param {number} [userId] ID of the user. If not defined, current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise to be resolved when the plans are retrieved. + * @param userId ID of the user. If not defined, current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise to be resolved when the plans are retrieved. */ getLearningPlans(userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -174,9 +174,9 @@ export class AddonCompetencyProvider { /** * Get a certain plan. * - * @param {number} planId ID of the plan. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise to be resolved when the plans are retrieved. + * @param planId ID of the plan. + * @param siteId Site ID. If not defined, current site. + * @return Promise to be resolved when the plans are retrieved. */ getLearningPlan(planId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -204,10 +204,10 @@ export class AddonCompetencyProvider { /** * Get a certain competency in a plan. * - * @param {number} planId ID of the plan. - * @param {number} competencyId ID of the competency. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise to be resolved when the plans are retrieved. + * @param planId ID of the plan. + * @param competencyId ID of the competency. + * @param siteId Site ID. If not defined, current site. + * @return Promise to be resolved when the plans are retrieved. */ getCompetencyInPlan(planId: number, competencyId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -236,12 +236,12 @@ export class AddonCompetencyProvider { /** * Get a certain competency in a course. * - * @param {number} courseId ID of the course. - * @param {number} competencyId ID of the competency. - * @param {number} [userId] ID of the user. If not defined, current user. - * @param {string} [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). - * @return {Promise} Promise to be resolved when the plans are retrieved. + * @param courseId ID of the course. + * @param competencyId ID of the competency. + * @param userId ID of the user. If not defined, current user. + * @param siteId Site ID. If not defined, current site. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise to be resolved when the plans are retrieved. */ getCompetencyInCourse(courseId: number, competencyId: number, userId?: number, siteId?: string, ignoreCache?: boolean) : Promise { @@ -279,11 +279,11 @@ export class AddonCompetencyProvider { /** * Get a certain competency summary. * - * @param {number} competencyId ID of the competency. - * @param {number} [userId] ID of the user. If not defined, current user. - * @param {string} [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). - * @return {Promise} Promise to be resolved when the plans are retrieved. + * @param competencyId ID of the competency. + * @param userId ID of the user. If not defined, current user. + * @param siteId Site ID. If not defined, current site. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise to be resolved when the plans are retrieved. */ getCompetencySummary(competencyId: number, userId?: number, siteId?: string, ignoreCache?: boolean): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -318,11 +318,11 @@ export class AddonCompetencyProvider { /** * Get all competencies in a course. * - * @param {number} courseId ID of the course. - * @param {number} [userId] ID of the user. - * @param {string} [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). - * @return {Promise} Promise to be resolved when the course competencies are retrieved. + * @param courseId ID of the course. + * @param userId ID of the user. + * @param siteId Site ID. If not defined, current site. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise to be resolved when the course competencies are retrieved. */ getCourseCompetencies(courseId: number, userId?: number, siteId?: string, ignoreCache?: boolean): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -373,9 +373,9 @@ export class AddonCompetencyProvider { /** * Invalidates User Learning Plans data. * - * @param {number} [userId] ID of the user. If not defined, current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param userId ID of the user. If not defined, current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateLearningPlans(userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -388,9 +388,9 @@ export class AddonCompetencyProvider { /** * Invalidates Learning Plan data. * - * @param {number} planId ID of the plan. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param planId ID of the plan. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateLearningPlan(planId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -401,10 +401,10 @@ export class AddonCompetencyProvider { /** * Invalidates Competency in Plan data. * - * @param {number} planId ID of the plan. - * @param {number} competencyId ID of the competency. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param planId ID of the plan. + * @param competencyId ID of the competency. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateCompetencyInPlan(planId: number, competencyId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -415,11 +415,11 @@ export class AddonCompetencyProvider { /** * Invalidates Competency in Course data. * - * @param {number} courseId ID of the course. - * @param {number} competencyId ID of the competency. - * @param {number} [userId] ID of the user. If not defined, current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId ID of the course. + * @param competencyId ID of the competency. + * @param userId ID of the user. If not defined, current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateCompetencyInCourse(courseId: number, competencyId: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -432,10 +432,10 @@ export class AddonCompetencyProvider { /** * Invalidates Competency Summary data. * - * @param {number} competencyId ID of the competency. - * @param {number} [userId] ID of the user. If not defined, current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param competencyId ID of the competency. + * @param userId ID of the user. If not defined, current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateCompetencySummary(competencyId: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -448,10 +448,10 @@ export class AddonCompetencyProvider { /** * Invalidates Course Competencies data. * - * @param {number} courseId ID of the course. - * @param {number} [userId] ID of the user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId ID of the course. + * @param userId ID of the user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateCourseCompetencies(courseId: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -477,13 +477,13 @@ export class AddonCompetencyProvider { /** * Report the competency as being viewed in plan. * - * @param {number} planId ID of the plan. - * @param {number} competencyId ID of the competency. - * @param {number} planStatus Current plan Status to decide what action should be logged. - * @param {string} [name] Name of the competency. - * @param {number} [userId] User ID. If not defined, current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param planId ID of the plan. + * @param competencyId ID of the competency. + * @param planStatus Current plan Status to decide what action should be logged. + * @param name Name of the competency. + * @param userId User ID. If not defined, current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logCompetencyInPlanView(planId: number, competencyId: number, planStatus: number, name?: string, userId?: number, siteId?: string): Promise { @@ -519,12 +519,12 @@ export class AddonCompetencyProvider { /** * Report the competency as being viewed in course. * - * @param {number} courseId ID of the course. - * @param {number} competencyId ID of the competency. - * @param {string} [name] Name of the competency. - * @param {number} [userId] User ID. If not defined, current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param courseId ID of the course. + * @param competencyId ID of the competency. + * @param name Name of the competency. + * @param userId User ID. If not defined, current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logCompetencyInCourseView(courseId: number, competencyId: number, name?: string, userId?: number, siteId?: string) : Promise { @@ -558,10 +558,10 @@ export class AddonCompetencyProvider { /** * Report the competency as being viewed. * - * @param {number} competencyId ID of the competency. - * @param {string} [name] Name of the competency. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param competencyId ID of the competency. + * @param name Name of the competency. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logCompetencyView(competencyId: number, name?: string, siteId?: string): Promise { if (competencyId) { diff --git a/src/addon/competency/providers/course-option-handler.ts b/src/addon/competency/providers/course-option-handler.ts index 2f8176995..8462d1ef2 100644 --- a/src/addon/competency/providers/course-option-handler.ts +++ b/src/addon/competency/providers/course-option-handler.ts @@ -30,7 +30,7 @@ export class AddonCompetencyCourseOptionHandler implements CoreCourseOptionsHand /** * Whether or not the handler is enabled ona site level. - * @return {boolean|Promise} 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 { return true; @@ -39,11 +39,11 @@ export class AddonCompetencyCourseOptionHandler implements CoreCourseOptionsHand /** * Whether or not the handler is enabled for a certain course. * - * @param {number} courseId The course ID. - * @param {any} accessData Access type and data. Default, guest, ... - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @param courseId The course ID. + * @param accessData Access type and data. Default, guest, ... + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return True or promise resolved with true if enabled. */ isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise { if (accessData && accessData.type == CoreCourseProvider.ACCESS_GUEST) { @@ -62,9 +62,9 @@ export class AddonCompetencyCourseOptionHandler implements CoreCourseOptionsHand /** * Returns the data needed to render the handler. * - * @param {Injector} injector Injector. - * @param {number} course The course. - * @return {CoreCourseOptionsHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param course The course. + * @return Data or promise resolved with the data. */ getDisplayData?(injector: Injector, course: any): CoreCourseOptionsHandlerData | Promise { 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. * - * @param {number} courseId The course ID. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {Promise} Promise resolved when done. + * @param courseId The course ID. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved when done. */ invalidateEnabledForCourse(courseId: number, navOptions?: any, admOptions?: any): Promise { 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. * - * @param {any} course The course. - * @return {Promise} Promise resolved when done. + * @param course The course. + * @return Promise resolved when done. */ prefetch(course: any): Promise { // Get the competencies in the course. diff --git a/src/addon/competency/providers/helper.ts b/src/addon/competency/providers/helper.ts index bf95bd3ac..65f990a65 100644 --- a/src/addon/competency/providers/helper.ts +++ b/src/addon/competency/providers/helper.ts @@ -31,8 +31,8 @@ export class AddonCompetencyHelperProvider { /** * Convenient helper to get the user profile image. * - * @param {number} userId User Id - * @return {Promise} User profile Image URL or true if default icon. + * @param userId User Id + * @return User profile Image URL or true if default icon. */ getProfile(userId: number): Promise { if (!userId || userId == this.sitesProvider.getCurrentSiteUserId()) { @@ -50,8 +50,7 @@ export class AddonCompetencyHelperProvider { /** * Get the review status name translated. * - * @param {number} status - * @return {string} + * @param status */ getCompetencyStatusName(status: number): string { let statusTranslateName; @@ -76,8 +75,7 @@ export class AddonCompetencyHelperProvider { /** * Get the status name translated. * - * @param {number} status - * @return {string} + * @param status */ getPlanStatusName(status: number): string { let statusTranslateName; diff --git a/src/addon/competency/providers/mainmenu-handler.ts b/src/addon/competency/providers/mainmenu-handler.ts index b45e84459..eea927c3d 100644 --- a/src/addon/competency/providers/mainmenu-handler.ts +++ b/src/addon/competency/providers/mainmenu-handler.ts @@ -29,7 +29,7 @@ export class AddonCompetencyMainMenuHandler implements CoreMainMenuHandler { /** * 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 { // 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. * - * @return {CoreMainMenuHandlerData} Data needed to render the handler. + * @return Data needed to render the handler. */ getDisplayData(): CoreMainMenuHandlerData { return { diff --git a/src/addon/competency/providers/plan-link-handler.ts b/src/addon/competency/providers/plan-link-handler.ts index 1e20c5fe7..07a7ae848 100644 --- a/src/addon/competency/providers/plan-link-handler.ts +++ b/src/addon/competency/providers/plan-link-handler.ts @@ -33,11 +33,11 @@ export class AddonCompetencyPlanLinkHandler extends CoreContentLinksHandlerBase /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -53,11 +53,11 @@ export class AddonCompetencyPlanLinkHandler extends CoreContentLinksHandlerBase * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { // Handler is disabled if all competency features are disabled. diff --git a/src/addon/competency/providers/plans-link-handler.ts b/src/addon/competency/providers/plans-link-handler.ts index da08f33da..37a6f97c0 100644 --- a/src/addon/competency/providers/plans-link-handler.ts +++ b/src/addon/competency/providers/plans-link-handler.ts @@ -33,11 +33,11 @@ export class AddonCompetencyPlansLinkHandler extends CoreContentLinksHandlerBase /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -54,11 +54,11 @@ export class AddonCompetencyPlansLinkHandler extends CoreContentLinksHandlerBase * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { // Handler is disabled if all competency features are disabled. diff --git a/src/addon/competency/providers/push-click-handler.ts b/src/addon/competency/providers/push-click-handler.ts index eca567205..2122fe313 100644 --- a/src/addon/competency/providers/push-click-handler.ts +++ b/src/addon/competency/providers/push-click-handler.ts @@ -33,8 +33,8 @@ export class AddonCompetencyPushClickHandler implements CorePushNotificationsCli /** * Check if a notification click is handled by this handler. * - * @param {any} notification The notification to check. - * @return {boolean} Whether the notification click is handled by this handler + * @param notification The notification to check. + * @return Whether the notification click is handled by this handler */ handles(notification: any): boolean | Promise { if (this.utils.isTrueOrOne(notification.notif) && notification.moodlecomponent == 'moodle' && @@ -51,8 +51,8 @@ export class AddonCompetencyPushClickHandler implements CorePushNotificationsCli /** * Handle the notification click. * - * @param {any} notification The notification to check. - * @return {Promise} Promise resolved when done. + * @param notification The notification to check. + * @return Promise resolved when done. */ handleClick(notification: any): Promise { const contextUrlParams = this.urlUtils.extractUrlParams(notification.contexturl); diff --git a/src/addon/competency/providers/user-competency-link-handler.ts b/src/addon/competency/providers/user-competency-link-handler.ts index 06cee4f90..0af9deeef 100644 --- a/src/addon/competency/providers/user-competency-link-handler.ts +++ b/src/addon/competency/providers/user-competency-link-handler.ts @@ -33,11 +33,11 @@ export class AddonCompetencyUserCompetencyLinkHandler extends CoreContentLinksHa /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -53,11 +53,11 @@ export class AddonCompetencyUserCompetencyLinkHandler extends CoreContentLinksHa * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { // Handler is disabled if all competency features are disabled. diff --git a/src/addon/competency/providers/user-handler.ts b/src/addon/competency/providers/user-handler.ts index 7cdbaadac..b377f4e4d 100644 --- a/src/addon/competency/providers/user-handler.ts +++ b/src/addon/competency/providers/user-handler.ts @@ -47,7 +47,7 @@ export class AddonCompetencyUserHandler implements CoreUserProfileHandler { /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return true; @@ -56,11 +56,11 @@ export class AddonCompetencyUserHandler implements CoreUserProfileHandler { /** * Check if handler is enabled for this user in this context. * - * @param {any} user User to check. - * @param {number} courseId Course ID. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} Promise resolved with true if enabled, resolved with false otherwise. + * @param user User to check. + * @param courseId Course ID. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved with true if enabled, resolved with false otherwise. */ isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise { if (courseId) { @@ -100,7 +100,7 @@ export class AddonCompetencyUserHandler implements CoreUserProfileHandler { /** * 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 { if (courseId) { diff --git a/src/addon/coursecompletion/components/report/report.ts b/src/addon/coursecompletion/components/report/report.ts index 50d12cf90..3b6371244 100644 --- a/src/addon/coursecompletion/components/report/report.ts +++ b/src/addon/coursecompletion/components/report/report.ts @@ -54,7 +54,7 @@ export class AddonCourseCompletionReportComponent implements OnInit { /** * Fetch compleiton data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchCompletion(): Promise { return this.courseCompletionProvider.getCompletion(this.courseId, this.userId).then((completion) => { @@ -77,7 +77,7 @@ export class AddonCourseCompletionReportComponent implements OnInit { /** * Refresh completion data on PTR. * - * @param {any} [refresher] Refresher instance. + * @param refresher Refresher instance. */ refreshCompletion(refresher?: any): void { this.courseCompletionProvider.invalidateCourseCompletion(this.courseId, this.userId).finally(() => { diff --git a/src/addon/coursecompletion/providers/course-option-handler.ts b/src/addon/coursecompletion/providers/course-option-handler.ts index d0483b68a..fa71437db 100644 --- a/src/addon/coursecompletion/providers/course-option-handler.ts +++ b/src/addon/coursecompletion/providers/course-option-handler.ts @@ -30,7 +30,7 @@ export class AddonCourseCompletionCourseOptionHandler implements CoreCourseOptio /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return this.courseCompletionProvider.isPluginViewEnabled(); @@ -39,11 +39,11 @@ export class AddonCourseCompletionCourseOptionHandler implements CoreCourseOptio /** * Whether or not the handler is enabled for a certain course. * - * @param {number} courseId The course ID. - * @param {any} accessData Access type and data. Default, guest, ... - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @param courseId The course ID. + * @param accessData Access type and data. Default, guest, ... + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return True or promise resolved with true if enabled. */ isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise { if (accessData && accessData.type == CoreCourseProvider.ACCESS_GUEST) { @@ -64,8 +64,8 @@ export class AddonCourseCompletionCourseOptionHandler implements CoreCourseOptio /** * Returns the data needed to render the handler. * - * @param {number} courseId The course ID. - * @return {CoreCourseOptionsHandlerData} Data. + * @param courseId The course ID. + * @return Data. */ getDisplayData?(injector: Injector, courseId: number): CoreCourseOptionsHandlerData { 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. * - * @param {number} courseId The course ID. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {Promise} Promise resolved when done. + * @param courseId The course ID. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved when done. */ invalidateEnabledForCourse(courseId: number, navOptions?: any, admOptions?: any): Promise { 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. * - * @param {any} course The course. - * @return {Promise} Promise resolved when done. + * @param course The course. + * @return Promise resolved when done. */ prefetch(course: any): Promise { return this.courseCompletionProvider.getCompletion(course.id, undefined, { diff --git a/src/addon/coursecompletion/providers/coursecompletion.ts b/src/addon/coursecompletion/providers/coursecompletion.ts index 0a79a4766..64b4c6f01 100644 --- a/src/addon/coursecompletion/providers/coursecompletion.ts +++ b/src/addon/coursecompletion/providers/coursecompletion.ts @@ -39,9 +39,9 @@ export class AddonCourseCompletionProvider { * 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. * - * @param {number} userId User ID. - * @param {any} completion Course completion. - * @return {boolean} True if user can mark course as self completed, false otherwise. + * @param userId User ID. + * @param completion Course completion. + * @return True if user can mark course as self completed, false otherwise. */ canMarkSelfCompleted(userId: number, completion: any): boolean { let selfCompletionActive = false, @@ -65,8 +65,8 @@ export class AddonCourseCompletionProvider { /** * Get completed status text. The language code returned is meant to be translated. * - * @param {any} completion Course completion. - * @return {string} Language code of the text to show. + * @param completion Course completion. + * @return Language code of the text to show. */ getCompletedStatusText(completion: any): string { if (completion.completed) { @@ -90,11 +90,11 @@ export class AddonCourseCompletionProvider { /** * Get course completion status for a certain course and user. * - * @param {number} courseId Course ID. - * @param {number} [userId] User ID. If not defined, use current user. - * @param {any} [preSets] Presets to use when calling the WebService. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise to be resolved when the completion is retrieved. + * @param courseId Course ID. + * @param userId User ID. If not defined, use current user. + * @param preSets Presets to use when calling the WebService. + * @param siteId Site ID. If not defined, use current site. + * @return Promise to be resolved when the completion is retrieved. */ getCompletion(courseId: number, userId?: number, preSets?: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -125,9 +125,9 @@ export class AddonCourseCompletionProvider { /** * Get cache key for get completion WS calls. * - * @param {number} courseId Course ID. - * @param {number} useIid User ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @param useIid User ID. + * @return Cache key. */ protected getCompletionCacheKey(courseId: number, userId: number): string { return this.ROOT_CACHE_KEY + 'view:' + courseId + ':' + userId; @@ -136,9 +136,9 @@ export class AddonCourseCompletionProvider { /** * Invalidates view course completion WS call. * - * @param {number} courseId Course ID. - * @param {number} [userId] User ID. If not defined, use current user. - * @return {Promise} Promise resolved when the list is invalidated. + * @param courseId Course ID. + * @param userId User ID. If not defined, use current user. + * @return Promise resolved when the list is invalidated. */ invalidateCourseCompletion(courseId: number, userId?: number): Promise { 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. * - * @return {boolean} True if plugin enabled, false otherwise. + * @return True if plugin enabled, false otherwise. */ isPluginViewEnabled(): boolean { 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. * - * @param {number} courseId Course ID. - * @param {boolean} [preferCache=true] True if shouldn't call WS if data is cached, false otherwise. - * @return {Promise} Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @param courseId Course ID. + * @param preferCache True if shouldn't call WS if data is cached, false otherwise. + * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ isPluginViewEnabledForCourse(courseId: number, preferCache: boolean = true): Promise { if (!courseId) { @@ -187,9 +187,9 @@ export class AddonCourseCompletionProvider { /** * Returns whether or not the view course completion plugin is enabled for a certain user. * - * @param {number} courseId Course ID. - * @param {number} [userId] User ID. If not defined, use current user. - * @return {Promise} Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @param courseId Course ID. + * @param userId User ID. If not defined, use current user. + * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ isPluginViewEnabledForUser(courseId: number, userId?: number): Promise { // Check if user wants to view his own completion. @@ -242,8 +242,8 @@ export class AddonCourseCompletionProvider { /** * Mark a course as self completed. * - * @param {number} courseId Course ID. - * @return {Promise} Resolved on success. + * @param courseId Course ID. + * @return Resolved on success. */ markCourseAsSelfCompleted(courseId: number): Promise { const params = { diff --git a/src/addon/coursecompletion/providers/user-handler.ts b/src/addon/coursecompletion/providers/user-handler.ts index 8faf49ccd..5e3924689 100644 --- a/src/addon/coursecompletion/providers/user-handler.ts +++ b/src/addon/coursecompletion/providers/user-handler.ts @@ -42,7 +42,7 @@ export class AddonCourseCompletionUserHandler implements CoreUserProfileHandler /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return this.courseCompletionProvider.isPluginViewEnabled(); @@ -51,11 +51,11 @@ export class AddonCourseCompletionUserHandler implements CoreUserProfileHandler /** * Check if handler is enabled for this user in this context. * - * @param {any} user User to check. - * @param {number} courseId Course ID. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} Promise resolved with true if enabled, resolved with false otherwise. + * @param user User to check. + * @param courseId Course ID. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved with true if enabled, resolved with false otherwise. */ isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise { if (!courseId) { @@ -84,7 +84,7 @@ export class AddonCourseCompletionUserHandler implements CoreUserProfileHandler /** * 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 { return { diff --git a/src/addon/files/pages/list/list.ts b/src/addon/files/pages/list/list.ts index 2867acb5c..24aeb0390 100644 --- a/src/addon/files/pages/list/list.ts +++ b/src/addon/files/pages/list/list.ts @@ -89,7 +89,7 @@ export class AddonFilesListPage implements OnDestroy { /** * Refresh the data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshData(refresher: any): void { this.refreshFiles().finally(() => { @@ -144,7 +144,7 @@ export class AddonFilesListPage implements OnDestroy { /** * Fetch the files. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchFiles(): Promise { let promise; @@ -193,7 +193,7 @@ export class AddonFilesListPage implements OnDestroy { /** * Refresh the displayed files. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected refreshFiles(): Promise { const promises = []; diff --git a/src/addon/files/providers/files.ts b/src/addon/files/providers/files.ts index 1db49f1da..f9051494f 100644 --- a/src/addon/files/providers/files.ts +++ b/src/addon/files/providers/files.ts @@ -31,7 +31,7 @@ export class AddonFilesProvider { /** * 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 { 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. * - * @return {boolean} Whether the user can view his private files. + * @return Whether the user can view his private files. */ canViewPrivateFiles(): boolean { return this.sitesProvider.getCurrentSite().canAccessMyFiles() && !this.isPrivateFilesDisabledInSite(); @@ -49,7 +49,7 @@ export class AddonFilesProvider { /** * 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 { return !this.isSiteFilesDisabledInSite(); @@ -58,7 +58,7 @@ export class AddonFilesProvider { /** * 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 { const currentSite = this.sitesProvider.getCurrentSite(); @@ -69,9 +69,9 @@ export class AddonFilesProvider { /** * Get the list of files. * - * @param {any} params A list of parameters accepted by the Web service. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the files. + * @param params A list of parameters accepted by the Web service. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the files. */ getFiles(params: any, siteId?: string): Promise { @@ -121,8 +121,8 @@ export class AddonFilesProvider { /** * Get cache key for file list WS calls. * - * @param {any} params Params of the WS. - * @return {string} Cache key. + * @param params Params of the WS. + * @return Cache key. */ protected getFilesListCacheKey(params: any): string { const root = !params.component ? 'site' : 'my'; @@ -133,7 +133,7 @@ export class AddonFilesProvider { /** * Get the private files of the current user. * - * @return {Promise} Promise resolved with the files. + * @return Promise resolved with the files. */ getPrivateFiles(): Promise { return this.getFiles(this.getPrivateFilesRootParams()); @@ -142,7 +142,7 @@ export class AddonFilesProvider { /** * Get params to get root private files directory. * - * @return {any} Params. + * @return Params. */ protected getPrivateFilesRootParams(): any { return { @@ -160,9 +160,9 @@ export class AddonFilesProvider { /** * Get private files info. * - * @param {number} [userId] User ID. If not defined, current user in the site. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved with the info. + * @param userId User ID. If not defined, current user in the site. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with the info. */ getPrivateFilesInfo(userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -183,8 +183,8 @@ export class AddonFilesProvider { /** * Get the cache key for private files info WS calls. * - * @param {number} userId User ID. - * @return {string} Cache key. + * @param userId User ID. + * @return Cache key. */ protected getPrivateFilesInfoCacheKey(userId: number): string { 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. * - * @return {string} Cache key. + * @return Cache key. */ protected getPrivateFilesInfoCommonCacheKey(): string { return this.ROOT_CACHE_KEY + 'privateInfo'; @@ -202,7 +202,7 @@ export class AddonFilesProvider { /** * Get the site files. * - * @return {Promise} Promise resolved with the files. + * @return Promise resolved with the files. */ getSiteFiles(): Promise { return this.getFiles(this.getSiteFilesRootParams()); @@ -211,7 +211,7 @@ export class AddonFilesProvider { /** * Get params to get root site files directory. * - * @return {any} Params. + * @return Params. */ protected getSiteFilesRootParams(): any { return { @@ -227,10 +227,10 @@ export class AddonFilesProvider { /** * Invalidates list of files in a certain directory. * - * @param {string} root Root of the directory ('my' for private files, 'site' for site files). - * @param {string} path Path to the directory. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param root Root of the directory ('my' for private files, 'site' for site files). + * @param path Path to the directory. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateDirectory(root: string, path: string, siteId?: string): Promise { let params; @@ -252,8 +252,8 @@ export class AddonFilesProvider { /** * Invalidates private files info for all users. * - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidatePrivateFilesInfo(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -264,9 +264,9 @@ export class AddonFilesProvider { /** * Invalidates private files info for a certain user. * - * @param {number} [userId] User ID. If not defined, current user in the site. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param userId User ID. If not defined, current user in the site. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidatePrivateFilesInfoForUser(userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -279,8 +279,8 @@ export class AddonFilesProvider { /** * Check if Files is disabled in a certain site. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. */ isDisabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -291,8 +291,8 @@ export class AddonFilesProvider { /** * Check if Files is disabled in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's disabled. + * @param site Site. If not defined, use current site. + * @return Whether it's disabled. */ isDisabledInSite(site: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -303,7 +303,7 @@ export class AddonFilesProvider { /** * Return whether or not the plugin is enabled. * - * @return {boolean} True if enabled, false otherwise. + * @return True if enabled, false otherwise. */ isPluginEnabled(): boolean { return this.canViewPrivateFiles() || this.canViewSiteFiles() || this.canUploadFiles(); @@ -312,8 +312,8 @@ export class AddonFilesProvider { /** * Check if private files is disabled in a certain site. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. */ isPrivateFilesDisabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -324,8 +324,8 @@ export class AddonFilesProvider { /** * Check if private files is disabled in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's disabled. + * @param site Site. If not defined, use current site. + * @return Whether it's disabled. */ isPrivateFilesDisabledInSite(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -336,8 +336,8 @@ export class AddonFilesProvider { /** * Check if site files is disabled in a certain site. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. */ isSiteFilesDisabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -348,8 +348,8 @@ export class AddonFilesProvider { /** * Check if site files is disabled in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's disabled. + * @param site Site. If not defined, use current site. + * @return Whether it's disabled. */ isSiteFilesDisabledInSite(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -360,8 +360,8 @@ export class AddonFilesProvider { /** * Check if upload files is disabled in a certain site. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. */ isUploadDisabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -372,8 +372,8 @@ export class AddonFilesProvider { /** * Check if upload files is disabled in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's disabled. + * @param site Site. If not defined, use current site. + * @return Whether it's disabled. */ isUploadDisabledInSite(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -384,9 +384,9 @@ export class AddonFilesProvider { /** * Move a file from draft area to private files. * - * @param {number} draftId The draft area ID of the file. - * @param {string} [siteid] ID of the site. If not defined, use current site. - * @return {Promise} Promise resolved in success, rejected otherwise. + * @param draftId The draft area ID of the file. + * @param siteid ID of the site. If not defined, use current site. + * @return Promise resolved in success, rejected otherwise. */ moveFromDraftToPrivate(draftId: number, siteId?: string): Promise { const params = { @@ -404,8 +404,8 @@ export class AddonFilesProvider { /** * Check the Moodle version in order to check if upload files is working. * - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved with true if WS is working, false otherwise. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with true if WS is working, false otherwise. */ versionCanUploadFiles(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/files/providers/helper.ts b/src/addon/files/providers/helper.ts index 4962b88e0..7cb3fa32d 100644 --- a/src/addon/files/providers/helper.ts +++ b/src/addon/files/providers/helper.ts @@ -30,8 +30,8 @@ export class AddonFilesHelperProvider { /** * Select a file, upload it and move it to private files. * - * @param {any} [info] Private files info. See AddonFilesProvider.getPrivateFilesInfo. - * @return {Promise} Promise resolved when a file is uploaded, rejected otherwise. + * @param info Private files info. See AddonFilesProvider.getPrivateFilesInfo. + * @return Promise resolved when a file is uploaded, rejected otherwise. */ uploadPrivateFile(info?: any): Promise { // Calculate the max size. diff --git a/src/addon/files/providers/mainmenu-handler.ts b/src/addon/files/providers/mainmenu-handler.ts index bb47f8cb5..d362a44a8 100644 --- a/src/addon/files/providers/mainmenu-handler.ts +++ b/src/addon/files/providers/mainmenu-handler.ts @@ -29,7 +29,7 @@ export class AddonFilesMainMenuHandler implements CoreMainMenuHandler { /** * 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 { return this.filesProvider.isPluginEnabled(); @@ -38,7 +38,7 @@ export class AddonFilesMainMenuHandler implements CoreMainMenuHandler { /** * 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 { return { diff --git a/src/addon/messageoutput/airnotifier/pages/devices/devices.ts b/src/addon/messageoutput/airnotifier/pages/devices/devices.ts index ddb966afa..a9b581f37 100644 --- a/src/addon/messageoutput/airnotifier/pages/devices/devices.ts +++ b/src/addon/messageoutput/airnotifier/pages/devices/devices.ts @@ -47,7 +47,7 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnDestroy { /** * Fetches the list of devices. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchDevices(): Promise { return this.airnotifierProivder.getUserDevices().then((devices) => { @@ -94,7 +94,7 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnDestroy { /** * Refresh the list of devices. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshDevices(refresher: any): void { this.airnotifierProivder.invalidateUserDevices().finally(() => { @@ -107,8 +107,8 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnDestroy { /** * Enable or disable a certain device. * - * @param {any} device The device object. - * @param {boolean} enable True to enable the device, false to disable it. + * @param device The device object. + * @param enable True to enable the device, false to disable it. */ enableDevice(device: any, enable: boolean): void { device.updating = true; diff --git a/src/addon/messageoutput/airnotifier/providers/airnotifier.ts b/src/addon/messageoutput/airnotifier/providers/airnotifier.ts index 129c1ebf0..e67e134bb 100644 --- a/src/addon/messageoutput/airnotifier/providers/airnotifier.ts +++ b/src/addon/messageoutput/airnotifier/providers/airnotifier.ts @@ -34,10 +34,10 @@ export class AddonMessageOutputAirnotifierProvider { /** * Enables or disables a device. * - * @param {number} deviceId Device ID. - * @param {boolean} enable True to enable, false to disable. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success. + * @param deviceId Device ID. + * @param enable True to enable, false to disable. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success. */ enableDevice(deviceId: number, enable: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -62,7 +62,7 @@ export class AddonMessageOutputAirnotifierProvider { /** * Get the cache key for the get user devices call. * - * @return {string} Cache key. + * @return Cache key. */ protected getUserDevicesCacheKey(): string { return this.ROOT_CACHE_KEY + 'userDevices'; @@ -71,8 +71,8 @@ export class AddonMessageOutputAirnotifierProvider { /** * Get user devices. * - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved with the devices. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with the devices. */ getUserDevices(siteId?: string): Promise { this.logger.debug('Get user devices'); @@ -95,8 +95,8 @@ export class AddonMessageOutputAirnotifierProvider { /** * Invalidate get user devices. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when data is invalidated. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when data is invalidated. */ invalidateUserDevices(siteId?: string): Promise { 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. * - * @return {boolean} True if enabled, false otherwise. + * @return True if enabled, false otherwise. * @since 3.2 */ isEnabled(): boolean { diff --git a/src/addon/messageoutput/airnotifier/providers/handler.ts b/src/addon/messageoutput/airnotifier/providers/handler.ts index 8d5cc15ae..555c6e238 100644 --- a/src/addon/messageoutput/airnotifier/providers/handler.ts +++ b/src/addon/messageoutput/airnotifier/providers/handler.ts @@ -29,7 +29,7 @@ export class AddonMessageOutputAirnotifierHandler implements AddonMessageOutputH /** * 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 { return this.airnotifierProvider.isEnabled(); @@ -38,8 +38,8 @@ export class AddonMessageOutputAirnotifierHandler implements AddonMessageOutputH /** * Returns the data needed to render the handler. * - * @param {any} processor The processor object. - * @return {CoreMainMenuHandlerData} Data. + * @param processor The processor object. + * @return Data. */ getDisplayData(processor: any): AddonMessageOutputHandlerData { return { diff --git a/src/addon/messageoutput/providers/delegate.ts b/src/addon/messageoutput/providers/delegate.ts index 36ef9f416..dc11821cb 100644 --- a/src/addon/messageoutput/providers/delegate.ts +++ b/src/addon/messageoutput/providers/delegate.ts @@ -24,15 +24,14 @@ import { CoreSitesProvider } from '@providers/sites'; export interface AddonMessageOutputHandler extends CoreDelegateHandler { /** * The name of the processor. E.g. 'airnotifier'. - * @type {string} */ processorName: string; /** * Returns the data needed to render the handler. * - * @param {any} processor The processor object. - * @return {CoreMainMenuHandlerData} Data. + * @param processor The processor object. + * @return Data. */ getDisplayData(processor: any): AddonMessageOutputHandlerData; } @@ -43,31 +42,26 @@ export interface AddonMessageOutputHandler extends CoreDelegateHandler { export interface AddonMessageOutputHandlerData { /** * Handler's priority. - * @type {number} */ priority: number; /** * Name of the page to load for the handler. - * @type {string} */ page: string; /** * Label to display for the handler. - * @type {string} */ label: string; /** * Name of the icon to display for the handler. - * @type {string} */ icon: string; /** * Params to pass to the page. - * @type {any} */ pageParams?: any; } @@ -88,8 +82,8 @@ export interface AddonMessageOutputHandlerData { /** * Get the display data of the handler. * - * @param {string} processor The processor object. - * @return {AddonMessageOutputHandlerData} Data. + * @param processor The processor object. + * @return Data. */ getDisplayData(processor: any): AddonMessageOutputHandlerData { return this.executeFunctionOnEnabled(processor.name, 'getDisplayData', processor); diff --git a/src/addon/messages/components/confirmed-contacts/confirmed-contacts.ts b/src/addon/messages/components/confirmed-contacts/confirmed-contacts.ts index 528b48a9a..53983afe9 100644 --- a/src/addon/messages/components/confirmed-contacts/confirmed-contacts.ts +++ b/src/addon/messages/components/confirmed-contacts/confirmed-contacts.ts @@ -80,8 +80,8 @@ export class AddonMessagesConfirmedContactsComponent implements OnInit, OnDestro /** * Fetch contacts. * - * @param {boolean} [refresh=false] True if we are refreshing contacts, false if we are loading more. - * @return {Promise} Promise resolved when done. + * @param refresh True if we are refreshing contacts, false if we are loading more. + * @return Promise resolved when done. */ fetchData(refresh: boolean = false): Promise { this.loadMoreError = false; @@ -112,8 +112,8 @@ export class AddonMessagesConfirmedContactsComponent implements OnInit, OnDestro /** * Refresh contacts. * - * @param {any} [refresher] Refresher. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @return Promise resolved when done. */ refreshData(refresher?: any): Promise { // 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. * - * @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. - * @return {Promise} Resolved when done. + * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. + * @return Resolved when done. */ loadMore(infiniteComplete?: any): Promise { return this.fetchData().finally(() => { @@ -137,8 +137,8 @@ export class AddonMessagesConfirmedContactsComponent implements OnInit, OnDestro /** * Notify that a contact has been selected. * - * @param {number} userId User id. - * @param {boolean} [onInit=false] Whether the contact is selected on initial load. + * @param userId User id. + * @param onInit Whether the contact is selected on initial load. */ selectUser(userId: number, onInit: boolean = false): void { this.selectedUserId = userId; diff --git a/src/addon/messages/components/contact-requests/contact-requests.ts b/src/addon/messages/components/contact-requests/contact-requests.ts index 4a77bfdd1..1eb5aba36 100644 --- a/src/addon/messages/components/contact-requests/contact-requests.ts +++ b/src/addon/messages/components/contact-requests/contact-requests.ts @@ -71,8 +71,8 @@ export class AddonMessagesContactRequestsComponent implements OnInit, OnDestroy /** * Fetch contact requests. * - * @param {boolean} [refresh=false] True if we are refreshing contact requests, false if we are loading more. - * @return {Promise} Promise resolved when done. + * @param refresh True if we are refreshing contact requests, false if we are loading more. + * @return Promise resolved when done. */ fetchData(refresh: boolean = false): Promise { this.loadMoreError = false; @@ -103,8 +103,8 @@ export class AddonMessagesContactRequestsComponent implements OnInit, OnDestroy /** * Refresh contact requests. * - * @param {any} [refresher] Refresher. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @return Promise resolved when done. */ refreshData(refresher?: any): Promise { // Refresh the number of contacts requests to update badges. @@ -119,8 +119,8 @@ export class AddonMessagesContactRequestsComponent implements OnInit, OnDestroy /** * Load more contact requests. * - * @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. - * @return {Promise} Resolved when done. + * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. + * @return Resolved when done. */ loadMore(infiniteComplete?: any): Promise { return this.fetchData().finally(() => { @@ -131,8 +131,8 @@ export class AddonMessagesContactRequestsComponent implements OnInit, OnDestroy /** * Notify that a contact has been selected. * - * @param {number} userId User id. - * @param {boolean} [onInit=false] Whether the contact is selected on initial load. + * @param userId User id. + * @param onInit Whether the contact is selected on initial load. */ selectUser(userId: number, onInit: boolean = false): void { this.selectedUserId = userId; diff --git a/src/addon/messages/components/contacts/contacts.ts b/src/addon/messages/components/contacts/contacts.ts index 8df67aabb..311196532 100644 --- a/src/addon/messages/components/contacts/contacts.ts +++ b/src/addon/messages/components/contacts/contacts.ts @@ -101,8 +101,8 @@ export class AddonMessagesContactsComponent { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @return Promise resolved when done. */ refreshData(refresher?: any): Promise { let promise; @@ -125,7 +125,7 @@ export class AddonMessagesContactsComponent { /** * Fetch contacts. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchData(): Promise { this.loadingMessage = this.loadingMessages; @@ -147,8 +147,8 @@ export class AddonMessagesContactsComponent { /** * Sort user list by fullname - * @param {any[]} list List to sort. - * @return {any[]} Sorted list. + * @param list List to sort. + * @return Sorted list. */ protected sortUsers(list: any[]): any[] { return list.sort((a, b) => { @@ -179,8 +179,8 @@ export class AddonMessagesContactsComponent { /** * Search users from the UI. * - * @param {string} query Text to search for. - * @return {Promise} Resolved when done. + * @param query Text to search for. + * @return Resolved when done. */ search(query: string): Promise { this.appProvider.closeKeyboard(); @@ -196,8 +196,8 @@ export class AddonMessagesContactsComponent { /** * Perform the search of users. * - * @param {string} query Text to search for. - * @return {Promise} Resolved when done. + * @param query Text to search for. + * @return Resolved when done. */ protected performSearch(query: string): Promise { return this.messagesProvider.searchContacts(query).then((result) => { @@ -214,8 +214,8 @@ export class AddonMessagesContactsComponent { /** * Navigate to a particular discussion. * - * @param {number} discussionUserId Discussion Id to load. - * @param {boolean} [onlyWithSplitView=false] Only go to Discussion if split view is on. + * @param discussionUserId Discussion Id to load. + * @param onlyWithSplitView Only go to Discussion if split view is on. */ gotoDiscussion(discussionUserId: number, onlyWithSplitView: boolean = false): void { this.discussionUserId = discussionUserId; diff --git a/src/addon/messages/components/discussions/discussions.ts b/src/addon/messages/components/discussions/discussions.ts index 983e27a13..ddbd5c3f2 100644 --- a/src/addon/messages/components/discussions/discussions.ts +++ b/src/addon/messages/components/discussions/discussions.ts @@ -139,9 +139,9 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @param {boolean} [refreshUnreadCounts=true] Whteher to refresh unread counts. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @param refreshUnreadCounts Whteher to refresh unread counts. + * @return Promise resolved when done. */ refreshData(refresher?: any, refreshUnreadCounts: boolean = true): Promise { const promises = []; @@ -163,7 +163,7 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy { /** * Fetch discussions. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchData(): Promise { this.loadingMessage = this.loadingMessages; @@ -208,8 +208,8 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy { /** * Search messages cotaining text. * - * @param {string} query Text to search for. - * @return {Promise} Resolved when done. + * @param query Text to search for. + * @return Resolved when done. */ searchMessage(query: string): Promise { this.appProvider.closeKeyboard(); @@ -229,9 +229,9 @@ export class AddonMessagesDiscussionsComponent implements OnDestroy { /** * Navigate to a particular discussion. * - * @param {number} discussionUserId Discussion Id to load. - * @param {number} [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 discussionUserId Discussion Id to load. + * @param messageId Message to scroll after loading the discussion. Used when searching. + * @param onlyWithSplitView Only go to Discussion if split view is on. */ gotoDiscussion(discussionUserId: number, messageId?: number, onlyWithSplitView: boolean = false): void { this.discussionUserId = discussionUserId; diff --git a/src/addon/messages/pages/contacts/contacts.ts b/src/addon/messages/pages/contacts/contacts.ts index 047961507..cde871624 100644 --- a/src/addon/messages/pages/contacts/contacts.ts +++ b/src/addon/messages/pages/contacts/contacts.ts @@ -91,9 +91,9 @@ export class AddonMessagesContactsPage implements OnDestroy { /** * Set the selected user and open the conversation in the split view if needed. * - * @param {string} 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 {boolean} [onInit=false] Whether the contact was selected on initial load. + * @param tab Active tab: "contacts" or "requests". + * @param userId Id of the selected user, undefined to use the last selected user in the tab. + * @param onInit Whether the contact was selected on initial load. */ selectUser(tab: string, userId?: number, onInit: boolean = false): void { userId = userId || this.selectedUserId[tab]; diff --git a/src/addon/messages/pages/conversation-info/conversation-info.ts b/src/addon/messages/pages/conversation-info/conversation-info.ts index b79ece62b..f28253463 100644 --- a/src/addon/messages/pages/conversation-info/conversation-info.ts +++ b/src/addon/messages/pages/conversation-info/conversation-info.ts @@ -52,7 +52,7 @@ export class AddonMessagesConversationInfoPage implements OnInit { /** * Fetch the required data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchData(): Promise { // Get the conversation data first. @@ -69,8 +69,8 @@ export class AddonMessagesConversationInfoPage implements OnInit { /** * Get conversation members. * - * @param {boolean} [loadingMore} Whether we are loading more data or just the first ones. - * @return {Promise} Promise resolved when done. + * @param [loadingMore} Whether we are loading more data or just the first ones. + * @return Promise resolved when done. */ protected fetchMembers(loadingMore?: boolean): Promise { this.loadMoreError = false; @@ -91,8 +91,8 @@ export class AddonMessagesConversationInfoPage implements OnInit { /** * Function to load more members. * - * @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. - * @return {Promise} Resolved when done. + * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. + * @return Resolved when done. */ loadMoreMembers(infiniteComplete?: any): Promise { return this.fetchMembers(true).catch((error) => { @@ -106,8 +106,8 @@ export class AddonMessagesConversationInfoPage implements OnInit { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @return Promise resolved when done. */ refreshData(refresher?: any): Promise { const promises = []; @@ -125,7 +125,7 @@ export class AddonMessagesConversationInfoPage implements OnInit { /** * Close modal. * - * @param {number} [userId] User conversation to load. + * @param userId User conversation to load. */ closeModal(userId?: number): void { this.viewCtrl.dismiss(userId); diff --git a/src/addon/messages/pages/discussion/discussion.ts b/src/addon/messages/pages/discussion/discussion.ts index 26c1eb0fb..ef908e1c9 100644 --- a/src/addon/messages/pages/discussion/discussion.ts +++ b/src/addon/messages/pages/discussion/discussion.ts @@ -136,8 +136,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * Adds a new message to the message list. * - * @param {any} message Message to be added. - * @param {boolean} [keep=true] If set the keep flag or not. + * @param message Message to be added. + * @param keep If set the keep flag or not. */ 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 @@ -156,7 +156,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * 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 { if (this.keepMessageMap[hash]) { @@ -197,7 +197,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * Convenience function to fetch the conversation data. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected fetchData(): Promise { let loader; @@ -300,7 +300,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * Convenience function to fetch messages. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected fetchMessages(): Promise { this.loadMoreError = false; @@ -351,7 +351,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * 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 { if (this.viewDestroyed) { @@ -406,9 +406,9 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * Get the conversation. * - * @param {number} conversationId Conversation ID. - * @param {number} userId User ID. - * @return {Promise} Promise resolved with a boolean: whether the conversation exists or not. + * @param conversationId Conversation ID. + * @param userId User ID. + * @return Promise resolved with a boolean: whether the conversation exists or not. */ protected getConversation(conversationId: number, userId: number): Promise { let promise, @@ -491,9 +491,9 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * Get the messages of the conversation. Used if group messaging is supported. * - * @param {number} pagesToLoad Number of "pages" to load. - * @param {number} [offset=0] Offset for message list. - * @return {Promise} Promise resolved with the list of messages. + * @param pagesToLoad Number of "pages" to load. + * @param offset Offset for message list. + * @return Promise resolved with the list of messages. */ protected getConversationMessages(pagesToLoad: number, offset: number = 0): Promise { const excludePending = offset > 0; @@ -527,12 +527,12 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * Get a discussion. Can load several "pages". * - * @param {number} 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 {number} [lfReceivedRead=0] 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 {number} [lfSentRead=0] Number of read sent messages already fetched, so fetch will be done from this. - * @return {Promise} Resolved when done. + * @param pagesToLoad Number of pages to load. + * @param lfReceivedUnread Number of unread 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 lfSentUnread Number of unread sent messages already fetched, so fetch will be done from this. + * @param lfSentRead Number of read sent messages already fetched, so fetch will be done from this. + * @return Resolved when done. */ protected getDiscussionMessages(pagesToLoad: number, lfReceivedUnread: number = 0, lfReceivedRead: number = 0, lfSentUnread: number = 0, lfSentRead: number = 0): Promise { @@ -755,7 +755,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * Wait until fetching is false. - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected waitForFetch(): Promise { if (!this.fetching) { @@ -806,7 +806,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * Copy message to clipboard. * - * @param {any} message Message to be copied. + * @param message Message to be copied. */ copyMessage(message: any): void { const text = this.textUtils.decodeHTMLEntities(message.smallmessage || message.text || ''); @@ -816,8 +816,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * Function to delete a message. * - * @param {any} message Message object to delete. - * @param {number} index Index where the message is to delete it from the view. + * @param message Message object to delete. + * @param index Index where the message is to delete it from the view. */ deleteMessage(message: any, index: number): void { const canDeleteAll = this.conversation && this.conversation.candeletemessagesforallusers, @@ -857,8 +857,8 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * Function to load previous messages. * - * @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. - * @return {Promise} Resolved when done. + * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. + * @return Resolved when done. */ loadPrevious(infiniteComplete?: any): Promise { let infiniteHeight = this.infinite ? this.infinite.getHeight() : 0; @@ -959,7 +959,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * Sends a message to the server. * - * @param {string} text Message text. + * @param text Message text. */ sendMessage(text: string): void { let message; @@ -1046,9 +1046,9 @@ export class AddonMessagesDiscussionPage implements OnDestroy { * 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. * - * @param {any} message Current message where to show the date. - * @param {any} [prevMessage] Previous message where to compare the date with. - * @return {boolean} If date has changed and should be shown. + * @param message Current message where to show the date. + * @param prevMessage Previous message where to compare the date with. + * @return If date has changed and should be shown. */ showDate(message: any, prevMessage?: any): boolean { if (!prevMessage) { @@ -1064,9 +1064,9 @@ export class AddonMessagesDiscussionPage implements OnDestroy { * 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. * - * @param {any} message Current message where to show the user info. - * @param {any} [prevMessage] Previous message. - * @return {boolean} Whether user data should be shown. + * @param message Current message where to show the user info. + * @param prevMessage Previous message. + * @return Whether user data should be shown. */ showUserData(message: any, prevMessage?: any): boolean { 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. * - * @param {any} message Current message where to show the user info. - * @param {any} [nextMessage] Next message. - * @return {boolean} Whether user data should be shown. + * @param message Current message where to show the user info. + * @param nextMessage Next message. + * @return Whether user data should be shown. */ showTail(message: any, nextMessage?: any): boolean { 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. * - * @param {Function} [done] Function to call when done. + * @param done Function to call when done. */ changeFavourite(done?: () => void): void { this.favouriteIcon = 'spinner'; @@ -1153,7 +1153,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * 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 { this.muteIcon = 'spinner'; @@ -1218,7 +1218,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * Displays a confirmation modal to block the user of the individual conversation. * - * @return {Promise} Promise resolved when user is blocked or dialog is cancelled. + * @return Promise resolved when user is blocked or dialog is cancelled. */ blockUser(): Promise { if (!this.otherMember) { @@ -1249,7 +1249,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * Delete the conversation. * - * @param {Function} [done] Function to call when done. + * @param done Function to call when done. */ deleteConversation(done?: () => void): void { 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. * - * @return {Promise} Promise resolved when user is unblocked or dialog is cancelled. + * @return Promise resolved when user is unblocked or dialog is cancelled. */ unblockUser(): Promise { 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. * - * @return {Promise} 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 { if (!this.otherMember) { @@ -1338,7 +1338,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * Confirms the contact request of the other user of the individual conversation. * - * @return {Promise} Promise resolved when the request is confirmed. + * @return Promise resolved when the request is confirmed. */ confirmContactRequest(): Promise { if (!this.otherMember) { @@ -1360,7 +1360,7 @@ export class AddonMessagesDiscussionPage implements OnDestroy { /** * Declines the contact request of the other user of the individual conversation. * - * @return {Promise} Promise resolved when the request is confirmed. + * @return Promise resolved when the request is confirmed. */ declineContactRequest(): Promise { 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. * - * @return {Promise} 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 { if (!this.otherMember) { diff --git a/src/addon/messages/pages/group-conversations/group-conversations.ts b/src/addon/messages/pages/group-conversations/group-conversations.ts index 92b81f75e..de862bc39 100644 --- a/src/addon/messages/pages/group-conversations/group-conversations.ts +++ b/src/addon/messages/pages/group-conversations/group-conversations.ts @@ -256,8 +256,8 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Fetch conversations. * - * @param {booleam} [refreshUnreadCounts=true] Whether to refresh unread counts. - * @return {Promise} Promise resolved when done. + * @param refreshUnreadCounts Whether to refresh unread counts. + * @return Promise resolved when done. */ protected fetchData(refreshUnreadCounts: boolean = true): Promise { this.loadingMessage = this.loadingString; @@ -329,7 +329,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Fetch data for the expanded option. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchDataForExpandedOption(): Promise { const expandedOption = this.getExpandedOption(); @@ -344,10 +344,10 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Fetch data for a certain option. * - * @param {any} option The option to fetch data for. - * @param {boolean} [loadingMore} Whether we are loading more data or just the first ones. - * @param {booleam} [getCounts] Whether to get counts data. - * @return {Promise} Promise resolved when done. + * @param option The option to fetch data for. + * @param [loadingMore} Whether we are loading more data or just the first ones. + * @param getCounts Whether to get counts data. + * @return Promise resolved when done. */ fetchDataForOption(option: any, loadingMore?: boolean, getCounts?: boolean): Promise { option.loadMoreError = false; @@ -399,7 +399,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Fetch conversation counts. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchConversationCounts(): Promise { // Always try to get the latest data. @@ -417,10 +417,10 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Find a conversation in the list of loaded conversations. * - * @param {number} conversationId The conversation ID to search. - * @param {number} userId User ID to search (if no conversationId). - * @param {any} [option] The option to search in. If not defined, search in all options. - * @return {any} Conversation. + * @param conversationId The conversation ID to search. + * @param userId User ID to search (if no conversationId). + * @param option The option to search in. If not defined, search in all options. + * @return Conversation. */ protected findConversation(conversationId: number, userId?: number, option?: any): any { if (conversationId) { @@ -443,7 +443,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Get the option that is currently expanded, undefined if they are all collapsed. * - * @return {any} Option currently expanded. + * @return Option currently expanded. */ protected getExpandedOption(): any { if (this.favourites.expanded) { @@ -465,9 +465,9 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Navigate to a particular conversation. * - * @param {number} conversationId Conversation Id to load. - * @param {number} userId User of the conversation. Only if there is no conversationId. - * @param {number} [messageId] Message to scroll after loading the discussion. Used when searching. + * @param conversationId Conversation Id to load. + * @param userId User of the conversation. Only if there is no conversationId. + * @param messageId Message to scroll after loading the discussion. Used when searching. */ gotoConversation(conversationId: number, userId?: number, messageId?: number): void { this.selectedConversationId = conversationId; @@ -493,9 +493,9 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Function to load more conversations. * - * @param {any} option The option to fetch data for. - * @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. - * @return {Promise} Resolved when done. + * @param option The option to fetch data for. + * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. + * @return Resolved when done. */ loadMoreConversations(option: any, infiniteComplete?: any): Promise { return this.fetchDataForOption(option, true).catch((error) => { @@ -509,9 +509,9 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Load offline messages into the conversations. * - * @param {any} option The option where the messages should be loaded. - * @param {any[]} messages Offline messages. - * @return {Promise} Promise resolved when done. + * @param option The option where the messages should be loaded. + * @param messages Offline messages. + * @return Promise resolved when done. */ protected loadOfflineMessages(option: any, messages: any[]): Promise { const promises = []; @@ -575,7 +575,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Add an offline conversation into the right list of conversations. * - * @param {any} conversation Offline conversation to add. + * @param conversation Offline conversation to add. */ protected addOfflineConversation(conversation: any): void { const option = this.getConversationOption(conversation); @@ -585,8 +585,8 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Add a last offline message into a conversation. * - * @param {any} conversation Conversation where to put the last message. - * @param {any} message Offline message to add. + * @param conversation Conversation where to put the last message. + * @param message Offline message to add. */ protected addLastOfflineMessage(conversation: any, message: any): void { conversation.lastmessage = message.text; @@ -598,8 +598,8 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Given a conversation, return its option (favourites, group, individual). * - * @param {any} conversation Conversation to check. - * @return {any} Option object. + * @param conversation Conversation to check. + * @return Option object. */ protected getConversationOption(conversation: any): any { if (conversation.isfavourite) { @@ -614,9 +614,9 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @param {booleam} [refreshUnreadCounts=true] Whether to refresh unread counts. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @param refreshUnreadCounts Whether to refresh unread counts. + * @return Promise resolved when done. */ refreshData(refresher?: any, refreshUnreadCounts: boolean = true): Promise { // Don't invalidate conversations and so, they always try to get latest data. @@ -636,7 +636,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Toogle the visibility of an option (expand/collapse). * - * @param {any} option The option to expand/collapse. + * @param option The option to expand/collapse. */ toggle(option: any): void { if (option.expanded) { @@ -654,9 +654,9 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { /** * Expand a certain option. * - * @param {any} option The option to expand. - * @param {booleam} [getCounts] Whether to get counts data. - * @return {Promise} Promise resolved when done. + * @param option The option to expand. + * @param getCounts Whether to get counts data. + * @return Promise resolved when done. */ protected expandOption(option: any, getCounts?: boolean): Promise { // Collapse all and expand the right one. diff --git a/src/addon/messages/pages/index/index.ts b/src/addon/messages/pages/index/index.ts index 66010ab05..44730992e 100644 --- a/src/addon/messages/pages/index/index.ts +++ b/src/addon/messages/pages/index/index.ts @@ -50,8 +50,8 @@ export class AddonMessagesIndexPage implements OnDestroy { /** * Navigate to a particular discussion. * - * @param {number} discussionUserId Discussion Id to load. - * @param {number} [messageId] Message to scroll after loading the discussion. Used when searching. + * @param discussionUserId Discussion Id to load. + * @param messageId Message to scroll after loading the discussion. Used when searching. */ gotoDiscussion(discussionUserId: number, messageId?: number): void { const params = { diff --git a/src/addon/messages/pages/search/search.ts b/src/addon/messages/pages/search/search.ts index 14d5b6ab1..54e5a74c7 100644 --- a/src/addon/messages/pages/search/search.ts +++ b/src/addon/messages/pages/search/search.ts @@ -103,10 +103,10 @@ export class AddonMessagesSearchPage implements OnDestroy { /** * Start a new search or load more results. * - * @param {string} query Text to search for. - * @param {strings} loadMore Load more contacts, noncontacts or messages. If undefined, start a new search. - * @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. - * @return {Promise} Resolved when done. + * @param query Text to search for. + * @param loadMore Load more contacts, noncontacts or messages. If undefined, start a new search. + * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. + * @return Resolved when done. */ search(query: string, loadMore?: 'contacts' | 'noncontacts' | 'messages', infiniteComplete?: any): Promise { this.appProvider.closeKeyboard(); @@ -225,8 +225,8 @@ export class AddonMessagesSearchPage implements OnDestroy { /** * Open a conversation in the split view. * - * @param {any} result User or message. - * @param {boolean} [onInit=false] Whether the tser was selected on initial load. + * @param result User or message. + * @param onInit Whether the tser was selected on initial load. */ openConversation(result: any, onInit: boolean = false): void { if (!onInit || this.splitviewCtrl.isOn()) { @@ -244,8 +244,8 @@ export class AddonMessagesSearchPage implements OnDestroy { /** * Set the highlight values for each entry. * - * @param {any[]} results Results to highlight. - * @param {boolean} isUser Whether the results are from a user search or from a message search. + * @param results Results to highlight. + * @param isUser Whether the results are from a user search or from a message search. */ setHighlight(results: any[], isUser: boolean): void { results.forEach((result) => { diff --git a/src/addon/messages/pages/settings/settings.ts b/src/addon/messages/pages/settings/settings.ts index d7e30cd01..b2eed0099 100644 --- a/src/addon/messages/pages/settings/settings.ts +++ b/src/addon/messages/pages/settings/settings.ts @@ -78,7 +78,7 @@ export class AddonMessagesSettingsPage implements OnDestroy { /** * Fetches preference data. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected fetchPreferences(): Promise { return this.messagesProvider.getMessagePreferences().then((preferences) => { @@ -133,7 +133,7 @@ export class AddonMessagesSettingsPage implements OnDestroy { /** * Save the contactable privacy setting.. * - * @param {number|boolean} value The value to set. + * @param value The value to set. */ saveContactablePrivacy(value: number | boolean): void { if (this.contactablePrivacy == this.previousContactableValue) { @@ -164,9 +164,9 @@ export class AddonMessagesSettingsPage implements OnDestroy { /** * Change the value of a certain preference. * - * @param {any} notification Notification object. - * @param {string} state State name, ['loggedin', 'loggedoff']. - * @param {any} processor Notification processor. + * @param notification Notification object. + * @param state State name, ['loggedin', 'loggedoff']. + * @param processor Notification processor. */ changePreference(notification: any, state: string, processor: any): void { if (this.groupMessagingEnabled) { @@ -238,7 +238,7 @@ export class AddonMessagesSettingsPage implements OnDestroy { /** * Refresh the list of preferences. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshPreferences(refresher: any): void { this.messagesProvider.invalidateMessagePreferences().finally(() => { diff --git a/src/addon/messages/providers/contact-request-link-handler.ts b/src/addon/messages/providers/contact-request-link-handler.ts index aebf2e8cd..0b3696b41 100644 --- a/src/addon/messages/providers/contact-request-link-handler.ts +++ b/src/addon/messages/providers/contact-request-link-handler.ts @@ -33,11 +33,11 @@ export class AddonMessagesContactRequestLinkHandler extends CoreContentLinksHand /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -52,11 +52,11 @@ export class AddonMessagesContactRequestLinkHandler extends CoreContentLinksHand * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return this.messagesProvider.isPluginEnabled(siteId).then((enabled) => { diff --git a/src/addon/messages/providers/discussion-link-handler.ts b/src/addon/messages/providers/discussion-link-handler.ts index b916798c6..623738241 100644 --- a/src/addon/messages/providers/discussion-link-handler.ts +++ b/src/addon/messages/providers/discussion-link-handler.ts @@ -36,11 +36,11 @@ export class AddonMessagesDiscussionLinkHandler extends CoreContentLinksHandlerB /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -58,11 +58,11 @@ export class AddonMessagesDiscussionLinkHandler extends CoreContentLinksHandlerB * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return this.messagesProvider.isPluginEnabled(siteId).then((enabled) => { diff --git a/src/addon/messages/providers/index-link-handler.ts b/src/addon/messages/providers/index-link-handler.ts index 400bd4eb1..e711070c3 100644 --- a/src/addon/messages/providers/index-link-handler.ts +++ b/src/addon/messages/providers/index-link-handler.ts @@ -34,11 +34,11 @@ export class AddonMessagesIndexLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -58,11 +58,11 @@ export class AddonMessagesIndexLinkHandler extends CoreContentLinksHandlerBase { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return this.messagesProvider.isPluginEnabled(siteId); diff --git a/src/addon/messages/providers/mainmenu-handler.ts b/src/addon/messages/providers/mainmenu-handler.ts index 0875f19b6..b39725450 100644 --- a/src/addon/messages/providers/mainmenu-handler.ts +++ b/src/addon/messages/providers/mainmenu-handler.ts @@ -89,7 +89,7 @@ export class AddonMessagesMainMenuHandler implements CoreMainMenuHandler, CoreCr /** * 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 { return this.messagesProvider.isPluginEnabled(); @@ -98,7 +98,7 @@ export class AddonMessagesMainMenuHandler implements CoreMainMenuHandler, CoreCr /** * Returns the data needed to render the handler. * - * @return {CoreMainMenuHandlerToDisplay} Data needed to render the handler. + * @return Data needed to render the handler. */ getDisplayData(): CoreMainMenuHandlerToDisplay { this.handler.page = this.messagesProvider.isGroupMessagingEnabled() ? @@ -114,9 +114,9 @@ export class AddonMessagesMainMenuHandler implements CoreMainMenuHandler, CoreCr /** * Refreshes badge number. * - * @param {string} [siteId] Site ID or current Site if undefined. - * @param {boolean} [unreadOnly] If true only the unread conversations count is refreshed. - * @return {Promise} Resolve when done. + * @param siteId Site ID or current Site if undefined. + * @param unreadOnly If true only the unread conversations count is refreshed. + * @return Resolve when done. */ refreshBadge(siteId?: string, unreadOnly?: boolean): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -147,7 +147,7 @@ export class AddonMessagesMainMenuHandler implements CoreMainMenuHandler, CoreCr /** * Update badge number and push notifications counter from loaded data. * - * @param {string} siteId Site ID. + * @param siteId Site ID. */ updateBadge(siteId: string): void { const totalCount = this.unreadCount + (this.contactRequestsCount || 0); @@ -165,9 +165,9 @@ export class AddonMessagesMainMenuHandler implements CoreMainMenuHandler, CoreCr * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { if (this.sitesProvider.isCurrentSite(siteId)) { @@ -186,7 +186,7 @@ export class AddonMessagesMainMenuHandler implements CoreMainMenuHandler, CoreCr /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { if (this.appProvider.isDesktop()) { @@ -201,7 +201,7 @@ export class AddonMessagesMainMenuHandler implements CoreMainMenuHandler, CoreCr /** * Whether it's a synchronization process or not. * - * @return {boolean} True if is a sync process, false otherwise. + * @return True if is a sync process, false otherwise. */ isSync(): boolean { // This is done to use only wifi if using the fallback function. @@ -217,7 +217,7 @@ export class AddonMessagesMainMenuHandler implements CoreMainMenuHandler, CoreCr /** * Whether the process should be executed during a manual sync. * - * @return {boolean} True if is a manual sync process, false otherwise. + * @return True if is a manual sync process, false otherwise. */ canManualSync(): boolean { return true; @@ -226,8 +226,8 @@ export class AddonMessagesMainMenuHandler implements CoreMainMenuHandler, CoreCr /** * Get the latest unread received messages from a site. * - * @param {string} [siteId] Site ID. Default current. - * @return {Promise} Promise resolved with the notifications. + * @param siteId Site ID. Default current. + * @return Promise resolved with the notifications. */ protected fetchMessages(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -289,8 +289,8 @@ export class AddonMessagesMainMenuHandler implements CoreMainMenuHandler, CoreCr /** * Given a message, return the title and the text for the message. * - * @param {any} message Message. - * @return {Promise} Promise resolved with an object with title and text. + * @param message Message. + * @return Promise resolved with an object with title and text. */ protected getTitleAndText(message: any): Promise { const data = { diff --git a/src/addon/messages/providers/messages-offline.ts b/src/addon/messages/providers/messages-offline.ts index 38737c50e..d9818cd83 100644 --- a/src/addon/messages/providers/messages-offline.ts +++ b/src/addon/messages/providers/messages-offline.ts @@ -97,11 +97,11 @@ export class AddonMessagesOfflineProvider { /** * Delete a message. * - * @param {number} conversationId Conversation ID. - * @param {string} message The message. - * @param {number} timeCreated The time the message was created. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param conversationId Conversation ID. + * @param message The message. + * @param timeCreated The time the message was created. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ deleteConversationMessage(conversationId: number, message: string, timeCreated: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -116,9 +116,9 @@ export class AddonMessagesOfflineProvider { /** * Delete all the messages in a conversation. * - * @param {number} conversationId Conversation ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param conversationId Conversation ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ deleteConversationMessages(conversationId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -131,11 +131,11 @@ export class AddonMessagesOfflineProvider { /** * Delete a message. * - * @param {number} toUserId User ID to send the message to. - * @param {string} message The message. - * @param {number} timeCreated The time the message was created. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param toUserId User ID to send the message to. + * @param message The message. + * @param timeCreated The time the message was created. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ deleteMessage(toUserId: number, message: string, timeCreated: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -150,8 +150,8 @@ export class AddonMessagesOfflineProvider { /** * Get all messages where deviceoffline is set to 1. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with messages. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with messages. */ getAllDeviceOfflineMessages(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -171,8 +171,8 @@ export class AddonMessagesOfflineProvider { /** * Get all offline messages. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with messages. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with messages. */ getAllMessages(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -192,9 +192,9 @@ export class AddonMessagesOfflineProvider { /** * Get offline messages to send to a certain user. * - * @param {number} conversationId Conversation ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with messages. + * @param conversationId Conversation ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with messages. */ getConversationMessages(conversationId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -209,9 +209,9 @@ export class AddonMessagesOfflineProvider { /** * Get offline messages to send to a certain user. * - * @param {number} toUserId User ID to get messages to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with messages. + * @param toUserId User ID to get messages to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with messages. */ getMessages(toUserId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -222,9 +222,9 @@ export class AddonMessagesOfflineProvider { /** * Check if there are offline messages to send to a conversation. * - * @param {number} conversationId Conversation ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if has offline messages, false otherwise. + * @param conversationId Conversation ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if has offline messages, false otherwise. */ hasConversationMessages(conversationId: number, siteId?: string): Promise { return this.getConversationMessages(conversationId, siteId).then((messages) => { @@ -235,9 +235,9 @@ export class AddonMessagesOfflineProvider { /** * Check if there are offline messages to send to a certain user. * - * @param {number} toUserId User ID to check. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if has offline messages, false otherwise. + * @param toUserId User ID to check. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if has offline messages, false otherwise. */ hasMessages(toUserId: number, siteId?: string): Promise { return this.getMessages(toUserId, siteId).then((messages) => { @@ -248,8 +248,8 @@ export class AddonMessagesOfflineProvider { /** * Parse some fields of each offline conversation messages. * - * @param {any[]} messages List of messages to parse. - * @return {any[]} Parsed messages. + * @param messages List of messages to parse. + * @return Parsed messages. */ protected parseConversationMessages(messages: any[]): any[] { if (!messages) { @@ -268,10 +268,10 @@ export class AddonMessagesOfflineProvider { /** * Save a conversation message to be sent later. * - * @param {any} conversation Conversation. - * @param {string} message The message to send. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param conversation Conversation. + * @param message The message to send. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ saveConversationMessage(conversation: any, message: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -298,10 +298,10 @@ export class AddonMessagesOfflineProvider { /** * Save a message to be sent later. * - * @param {number} toUserId User ID recipient of the message. - * @param {string} message The message to send. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param toUserId User ID recipient of the message. + * @param message The message to send. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ saveMessage(toUserId: number, message: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -322,10 +322,10 @@ export class AddonMessagesOfflineProvider { /** * Set deviceoffline for a group of messages. * - * @param {any} messages Messages to update. Should be the same entry as retrieved from the DB. - * @param {boolean} value Value to set. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param messages Messages to update. Should be the same entry as retrieved from the DB. + * @param value Value to set. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ setMessagesDeviceOffline(messages: any, value: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/messages/providers/messages.ts b/src/addon/messages/providers/messages.ts index b4181773a..a16d9810f 100644 --- a/src/addon/messages/providers/messages.ts +++ b/src/addon/messages/providers/messages.ts @@ -67,9 +67,9 @@ export class AddonMessagesProvider { /** * Add a contact. * - * @param {number} userId User ID of the person to add. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved when done. + * @param userId User ID of the person to add. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved when done. * @deprecated since Moodle 3.6 */ addContact(userId: number, siteId?: string): Promise { @@ -87,9 +87,9 @@ export class AddonMessagesProvider { /** * Block a user. * - * @param {number} userId User ID of the person to block. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved when done. + * @param userId User ID of the person to block. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved when done. */ blockContact(userId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -120,9 +120,9 @@ export class AddonMessagesProvider { /** * Confirm a contact request from another user. * - * @param {number} userId ID of the user who made the contact request. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved when done. + * @param userId ID of the user who made the contact request. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved when done. * @since 3.6 */ confirmContactRequest(userId: number, siteId?: string): Promise { @@ -149,9 +149,9 @@ export class AddonMessagesProvider { /** * Send a contact request to another user. * - * @param {number} userId ID of the receiver of the contact request. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved when done. + * @param userId ID of the receiver of the contact request. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved when done. * @since 3.6 */ createContactRequest(userId: number, siteId?: string): Promise { @@ -173,9 +173,9 @@ export class AddonMessagesProvider { /** * Decline a contact request from another user. * - * @param {number} userId ID of the user who made the contact request. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved when done. + * @param userId ID of the user who made the contact request. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved when done. * @since 3.6 */ declineContactRequest(userId: number, siteId?: string): Promise { @@ -200,10 +200,10 @@ export class AddonMessagesProvider { /** * Delete a conversation. * - * @param {number} conversationId Conversation to delete. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Promise resolved when the conversation has been deleted. + * @param conversationId Conversation to delete. + * @param siteId Site ID. If not defined, use current site. + * @param userId User ID. If not defined, current user in the site. + * @return Promise resolved when the conversation has been deleted. */ deleteConversation(conversationId: number, siteId?: string, userId?: number): Promise { return this.deleteConversations([conversationId], siteId, userId); @@ -212,10 +212,10 @@ export class AddonMessagesProvider { /** * Delete several conversations. * - * @param {number[]} conversationIds Conversations to delete. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Promise resolved when the conversations have been deleted. + * @param conversationIds Conversations to delete. + * @param siteId Site ID. If not defined, use current site. + * @param userId User ID. If not defined, current user in the site. + * @return Promise resolved when the conversations have been deleted. */ deleteConversations(conversationIds: number[], siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -243,9 +243,9 @@ export class AddonMessagesProvider { /** * Delete a message (online or offline). * - * @param {any} message Message to delete. - * @param {boolean} [deleteForAll] Whether the message should be deleted for all users. - * @return {Promise} Promise resolved when the message has been deleted. + * @param message Message to delete. + * @param deleteForAll Whether the message should be deleted for all users. + * @return Promise resolved when the message has been deleted. */ deleteMessage(message: any, deleteForAll?: boolean): Promise { if (message.id) { @@ -268,10 +268,10 @@ export class AddonMessagesProvider { /** * Delete a message from the server. * - * @param {number} id Message ID. - * @param {number} read 1 if message is read, 0 otherwise. - * @param {number} [userId] User we want to delete the message for. If not defined, use current user. - * @return {Promise} Promise resolved when the message has been deleted. + * @param id Message ID. + * @param read 1 if message is read, 0 otherwise. + * @param userId User we want to delete the message for. If not defined, use current user. + * @return Promise resolved when the message has been deleted. */ deleteMessageOnline(id: number, read: number, userId?: number): Promise { const params: any = { @@ -291,9 +291,9 @@ export class AddonMessagesProvider { /** * Delete a message for all users. * - * @param {number} id Message ID. - * @param {number} [userId] User we want to delete the message for. If not defined, use current user. - * @return {Promise} Promise resolved when the message has been deleted. + * @param id Message ID. + * @param userId User we want to delete the message for. If not defined, use current user. + * @return Promise resolved when the message has been deleted. */ deleteMessageForAllOnline(id: number, userId?: number): Promise { const params: any = { @@ -309,9 +309,9 @@ export class AddonMessagesProvider { /** * Format a conversation. * - * @param {any} conversation Conversation to format. - * @param {number} userId User ID viewing the conversation. - * @return {any} Formatted conversation. + * @param conversation Conversation to format. + * @param userId User ID viewing the conversation. + * @return Formatted conversation. */ protected formatConversation(conversation: any, userId: number): any { const numMessages = conversation.messages.length, @@ -346,8 +346,8 @@ export class AddonMessagesProvider { /** * Get the cache key for blocked contacts. * - * @param {number} userId The user who's contacts we're looking for. - * @return {string} Cache key. + * @param userId The user who's contacts we're looking for. + * @return Cache key. */ protected getCacheKeyForBlockedContacts(userId: number): string { return this.ROOT_CACHE_KEY + 'blockedContacts:' + userId; @@ -356,7 +356,7 @@ export class AddonMessagesProvider { /** * Get the cache key for contacts. * - * @return {string} Cache key. + * @return Cache key. */ protected getCacheKeyForContacts(): string { return this.ROOT_CACHE_KEY + 'contacts'; @@ -365,7 +365,7 @@ export class AddonMessagesProvider { /** * Get the cache key for comfirmed contacts. * - * @return {string} Cache key. + * @return Cache key. */ protected getCacheKeyForUserContacts(): string { return this.ROOT_CACHE_KEY + 'userContacts'; @@ -374,7 +374,7 @@ export class AddonMessagesProvider { /** * Get the cache key for contact requests. * - * @return {string} Cache key. + * @return Cache key. */ protected getCacheKeyForContactRequests(): string { return this.ROOT_CACHE_KEY + 'contactRequests'; @@ -383,7 +383,7 @@ export class AddonMessagesProvider { /** * Get the cache key for contact requests count. * - * @return {string} Cache key. + * @return Cache key. */ protected getCacheKeyForContactRequestsCount(): string { return this.ROOT_CACHE_KEY + 'contactRequestsCount'; @@ -392,8 +392,8 @@ export class AddonMessagesProvider { /** * Get the cache key for a discussion. * - * @param {number} userId The other person with whom the current user is having the discussion. - * @return {string} Cache key. + * @param userId The other person with whom the current user is having the discussion. + * @return Cache key. */ protected getCacheKeyForDiscussion(userId: number): string { return this.ROOT_CACHE_KEY + 'discussion:' + userId; @@ -402,8 +402,8 @@ export class AddonMessagesProvider { /** * Get the cache key for the message count. * - * @param {number} userId User ID. - * @return {string} Cache key. + * @param userId User ID. + * @return Cache key. */ protected getCacheKeyForMessageCount(userId: number): string { return this.ROOT_CACHE_KEY + 'count:' + userId; @@ -412,7 +412,7 @@ export class AddonMessagesProvider { /** * Get the cache key for unread conversation counts. * - * @return {string} Cache key. + * @return Cache key. */ protected getCacheKeyForUnreadConversationCounts(): string { return this.ROOT_CACHE_KEY + 'unreadConversationCounts'; @@ -421,7 +421,7 @@ export class AddonMessagesProvider { /** * Get the cache key for the list of discussions. * - * @return {string} Cache key. + * @return Cache key. */ protected getCacheKeyForDiscussions(): string { return this.ROOT_CACHE_KEY + 'discussions'; @@ -430,9 +430,9 @@ export class AddonMessagesProvider { /** * Get cache key for get conversations. * - * @param {number} userId User ID. - * @param {number} conversationId Conversation ID. - * @return {string} Cache key. + * @param userId User ID. + * @param conversationId Conversation ID. + * @return Cache key. */ protected getCacheKeyForConversation(userId: number, conversationId: number): string { return this.ROOT_CACHE_KEY + 'conversation:' + userId + ':' + conversationId; @@ -441,9 +441,9 @@ export class AddonMessagesProvider { /** * Get cache key for get conversations between users. * - * @param {number} userId User ID. - * @param {number} otherUserId Other user ID. - * @return {string} Cache key. + * @param userId User ID. + * @param otherUserId Other user ID. + * @return Cache key. */ protected getCacheKeyForConversationBetweenUsers(userId: number, otherUserId: number): string { return this.ROOT_CACHE_KEY + 'conversationBetweenUsers:' + userId + ':' + otherUserId; @@ -452,9 +452,9 @@ export class AddonMessagesProvider { /** * Get cache key for get conversation members. * - * @param {number} userId User ID. - * @param {number} conversationId Conversation ID. - * @return {string} Cache key. + * @param userId User ID. + * @param conversationId Conversation ID. + * @return Cache key. */ protected getCacheKeyForConversationMembers(userId: number, conversationId: number): string { return this.ROOT_CACHE_KEY + 'conversationMembers:' + userId + ':' + conversationId; @@ -463,9 +463,9 @@ export class AddonMessagesProvider { /** * Get cache key for get conversation messages. * - * @param {number} userId User ID. - * @param {number} conversationId Conversation ID. - * @return {string} Cache key. + * @param userId User ID. + * @param conversationId Conversation ID. + * @return Cache key. */ protected getCacheKeyForConversationMessages(userId: number, conversationId: number): string { return this.ROOT_CACHE_KEY + 'conversationMessages:' + userId + ':' + conversationId; @@ -474,10 +474,10 @@ export class AddonMessagesProvider { /** * Get cache key for get conversations. * - * @param {number} userId User ID. - * @param {number} [type] Filter by type. - * @param {boolean} [favourites] Filter favourites. - * @return {string} Cache key. + * @param userId User ID. + * @param type Filter by type. + * @param favourites Filter favourites. + * @return Cache key. */ protected getCacheKeyForConversations(userId: number, type?: number, favourites?: boolean): string { return this.getCommonCacheKeyForUserConversations(userId) + ':' + type + ':' + favourites; @@ -486,7 +486,7 @@ export class AddonMessagesProvider { /** * Get cache key for conversation counts. * - * @return {string} Cache key. + * @return Cache key. */ protected getCacheKeyForConversationCounts(): string { return this.ROOT_CACHE_KEY + 'conversationCounts'; @@ -495,9 +495,9 @@ export class AddonMessagesProvider { /** * Get cache key for member info. * - * @param {number} userId User ID. - * @param {number} otherUserId The other user ID. - * @return {string} Cache key. + * @param userId User ID. + * @param otherUserId The other user ID. + * @return Cache key. */ protected getCacheKeyForMemberInfo(userId: number, otherUserId: number): string { return this.ROOT_CACHE_KEY + 'memberInfo:' + userId + ':' + otherUserId; @@ -506,8 +506,8 @@ export class AddonMessagesProvider { /** * Get cache key for get self conversation. * - * @param {number} userId User ID. - * @return {string} Cache key. + * @param userId User ID. + * @return Cache key. */ protected getCacheKeyForSelfConversation(userId: number): string { return this.ROOT_CACHE_KEY + 'selfconversation:' + userId; @@ -516,8 +516,8 @@ export class AddonMessagesProvider { /** * Get common cache key for get user conversations. * - * @param {number} userId User ID. - * @return {string} Cache key. + * @param userId User ID. + * @return Cache key. */ protected getCommonCacheKeyForUserConversations(userId: number): string { return this.getRootCacheKeyForConversations() + userId; @@ -526,7 +526,7 @@ export class AddonMessagesProvider { /** * Get root cache key for get conversations. * - * @return {string} Cache key. + * @return Cache key. */ protected getRootCacheKeyForConversations(): string { return this.ROOT_CACHE_KEY + 'conversations:'; @@ -535,8 +535,8 @@ export class AddonMessagesProvider { /** * Get all the contacts of the current user. * - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved with the WS data. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved with the WS data. * @deprecated since Moodle 3.6 */ getAllContacts(siteId?: string): Promise { @@ -561,8 +561,8 @@ export class AddonMessagesProvider { /** * Get all the users blocked by the current user. * - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved with the WS data. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved with the WS data. */ getBlockedContacts(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -584,8 +584,8 @@ export class AddonMessagesProvider { * * This excludes the blocked users. * - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved with the WS data. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved with the WS data. * @deprecated since Moodle 3.6 */ getContacts(siteId?: string): Promise { @@ -618,10 +618,10 @@ export class AddonMessagesProvider { /** * Get the list of user contacts. * - * @param {number} [limitFrom=0] Position of the first contact to fetch. - * @param {number} [limitNum] Number of contacts to fetch. Default is AddonMessagesProvider.LIMIT_CONTACTS. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise<{contacts: any[], canLoadMore: boolean}>} Resolved with the list of user contacts. + * @param limitFrom Position of the first contact to fetch. + * @param limitNum Number of contacts to fetch. Default is AddonMessagesProvider.LIMIT_CONTACTS. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved with the list of user contacts. * @since 3.6 */ getUserContacts(limitFrom: number = 0, limitNum: number = AddonMessagesProvider.LIMIT_CONTACTS , siteId?: string): @@ -660,10 +660,10 @@ export class AddonMessagesProvider { /** * Get the contact request sent to the current user. * - * @param {number} [limitFrom=0] Position of the first contact request to fetch. - * @param {number} [limitNum] Number of contact requests to fetch. Default is AddonMessagesProvider.LIMIT_CONTACTS. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise<{requests: any[], canLoadMore: boolean}>} Resolved with the list of contact requests. + * @param limitFrom Position of the first contact request to fetch. + * @param limitNum Number of contact requests to fetch. Default is AddonMessagesProvider.LIMIT_CONTACTS. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved with the list of contact requests. * @since 3.6 */ getContactRequests(limitFrom: number = 0, limitNum: number = AddonMessagesProvider.LIMIT_CONTACTS, siteId?: string): @@ -702,8 +702,8 @@ export class AddonMessagesProvider { /** * Get the number of contact requests sent to the current user. * - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved with the number of contact requests. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved with the number of contact requests. * @since 3.6 */ getContactRequestsCount(siteId?: string): Promise { @@ -728,19 +728,19 @@ export class AddonMessagesProvider { /** * Get a conversation by the conversation ID. * - * @param {number} conversationId Conversation ID to fetch. - * @param {boolean} [includeContactRequests] Include contact requests. - * @param {boolean} [includePrivacyInfo] Include privacy info. - * @param {number} [messageOffset=0] Offset for messages list. - * @param {number} [messageLimit=1] Limit of messages. Defaults to 1 (last message). - * We recommend getConversationMessages to get them. - * @param {number} [memberOffset=0] Offset for members list. - * @param {number} [memberLimit=2] Limit of members. Defaults to 2 (to be able to know the other user in individual ones). - * We recommend getConversationMembers to get them. - * @param {boolean} [newestFirst=true] Whether to order messages by newest first. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Promise resolved with the response. + * @param conversationId Conversation ID to fetch. + * @param includeContactRequests Include contact requests. + * @param includePrivacyInfo Include privacy info. + * @param messageOffset Offset for messages list. + * @param messageLimit Limit of messages. Defaults to 1 (last message). + * We recommend getConversationMessages to get them. + * @param memberOffset Offset for members list. + * @param memberLimit Limit of members. Defaults to 2 (to be able to know the other user in individual ones). + * We recommend getConversationMembers to get them. + * @param newestFirst Whether to order messages by newest first. + * @param siteId Site ID. If not defined, use current site. + * @param userId User ID. If not defined, current user in the site. + * @return Promise resolved with the response. * @since 3.6 */ getConversation(conversationId: number, includeContactRequests?: boolean, includePrivacyInfo?: boolean, @@ -774,20 +774,20 @@ export class AddonMessagesProvider { /** * Get a conversation between two users. * - * @param {number} otherUserId The other user ID. - * @param {boolean} [includeContactRequests] Include contact requests. - * @param {boolean} [includePrivacyInfo] Include privacy info. - * @param {number} [messageOffset=0] Offset for messages list. - * @param {number} [messageLimit=1] Limit of messages. Defaults to 1 (last message). - * We recommend getConversationMessages to get them. - * @param {number} [memberOffset=0] Offset for members list. - * @param {number} [memberLimit=2] Limit of members. Defaults to 2 (to be able to know the other user in individual ones). - * We recommend getConversationMembers to get them. - * @param {boolean} [newestFirst=true] Whether to order messages by newest first. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @param {boolean} [preferCache] True if shouldn't call WS if data is cached, false otherwise. - * @return {Promise} Promise resolved with the response. + * @param otherUserId The other user ID. + * @param includeContactRequests Include contact requests. + * @param includePrivacyInfo Include privacy info. + * @param messageOffset Offset for messages list. + * @param messageLimit Limit of messages. Defaults to 1 (last message). + * We recommend getConversationMessages to get them. + * @param memberOffset Offset for members list. + * @param memberLimit Limit of members. Defaults to 2 (to be able to know the other user in individual ones). + * We recommend getConversationMembers to get them. + * @param newestFirst Whether to order messages by newest first. + * @param siteId Site ID. If not defined, use current site. + * @param userId User ID. If not defined, current user in the site. + * @param preferCache True if shouldn't call WS if data is cached, false otherwise. + * @return Promise resolved with the response. * @since 3.6 */ getConversationBetweenUsers(otherUserId: number, includeContactRequests?: boolean, includePrivacyInfo?: boolean, @@ -822,12 +822,12 @@ export class AddonMessagesProvider { /** * Get a conversation members. * - * @param {number} conversationId Conversation ID to fetch. - * @param {number} [limitFrom=0] Offset for members list. - * @param {number} [limitTo] Limit of members. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Promise resolved with the response. + * @param conversationId Conversation ID to fetch. + * @param limitFrom Offset for members list. + * @param limitTo Limit of members. + * @param siteId Site ID. If not defined, use current site. + * @param userId User ID. If not defined, current user in the site. + * @return Promise resolved with the response. * @since 3.6 */ getConversationMembers(conversationId: number, limitFrom: number = 0, limitTo?: number, includeContactRequests?: boolean, @@ -872,15 +872,15 @@ export class AddonMessagesProvider { /** * Get a conversation by the conversation ID. * - * @param {number} conversationId Conversation ID to fetch. - * @param {boolean} excludePending True to exclude messages pending to be sent. - * @param {number} [limitFrom=0] Offset for messages list. - * @param {number} [limitTo] Limit of messages. - * @param {boolean} [newestFirst=true] Whether to order messages by newest first. - * @param {number} [timeFrom] The timestamp from which the messages were created. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Promise resolved with the response. + * @param conversationId Conversation ID to fetch. + * @param excludePending True to exclude messages pending to be sent. + * @param limitFrom Offset for messages list. + * @param limitTo Limit of messages. + * @param newestFirst Whether to order messages by newest first. + * @param timeFrom The timestamp from which the messages were created. + * @param siteId Site ID. If not defined, use current site. + * @param userId User ID. If not defined, current user in the site. + * @return Promise resolved with the response. * @since 3.6 */ getConversationMessages(conversationId: number, excludePending: boolean, limitFrom: number = 0, limitTo?: number, @@ -963,15 +963,15 @@ export class AddonMessagesProvider { * Get the discussions of a certain user. This function is used in Moodle sites higher than 3.6. * If the site is older than 3.6, please use getDiscussions. * - * @param {number} [type] Filter by type. - * @param {boolean} [favourites] Whether to restrict the results to contain NO favourite conversations (false), ONLY favourite - * conversation (true), or ignore any restriction altogether (undefined or null). - * @param {number} [limitFrom=0] The offset to start at. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @param {boolean} [forceCache] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise resolved with the conversations. + * @param type Filter by type. + * @param favourites Whether to restrict the results to contain NO favourite conversations (false), ONLY favourite + * conversation (true), or ignore any restriction altogether (undefined or null). + * @param limitFrom The offset to start at. + * @param siteId Site ID. If not defined, use current site. + * @param userId User ID. If not defined, current user in the site. + * @param forceCache True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved with the conversations. * @since 3.6 */ getConversations(type?: number, favourites?: boolean, limitFrom: number = 0, siteId?: string, userId?: number, @@ -1041,9 +1041,9 @@ export class AddonMessagesProvider { /** * Get conversation counts by type. * - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved with favourite, - * individual, group and self conversation counts. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with favourite, + * individual, group and self conversation counts. * @since 3.6 */ getConversationCounts(siteId?: string): Promise<{favourites: number, individual: number, group: number, self: number}> { @@ -1069,15 +1069,15 @@ export class AddonMessagesProvider { /** * Return the current user's discussion with another user. * - * @param {number} userId The ID of the other user. - * @param {boolean} excludePending True to exclude messages pending to be sent. - * @param {number} [lfReceivedUnread=0] 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 {number} [lfSentUnread=0] 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 {boolean} [toDisplay=true] True if messages will be displayed to the user, either in view or in a notification. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved with messages and a boolean telling if can load more messages. + * @param userId The ID of the other user. + * @param excludePending True to exclude messages pending to be sent. + * @param lfReceivedUnread Number of unread 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 lfSentUnread Number of unread sent messages already fetched, so fetch will be done from this. + * @param lfSentRead Number of read sent messages already fetched, so fetch will be done from this. + * @param toDisplay True if messages will be displayed to the user, either in view or in a notification. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with messages and a boolean telling if can load more messages. */ getDiscussion(userId: number, excludePending: boolean, lfReceivedUnread: number = 0, lfReceivedRead: number = 0, lfSentUnread: number = 0, lfSentRead: number = 0, toDisplay: boolean = true, siteId?: string): Promise { @@ -1152,8 +1152,8 @@ export class AddonMessagesProvider { * Get the discussions of the current user. This function is used in Moodle sites older than 3.6. * If the site is 3.6 or higher, please use getConversations. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved with an object where the keys are the user ID of the other user. + * @param siteId Site ID. If not defined, current site. + * @return Resolved with an object where the keys are the user ID of the other user. */ getDiscussions(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1240,9 +1240,9 @@ export class AddonMessagesProvider { /** * Get user images for all the discussions that don't have one already. * - * @param {any} discussions List of discussions. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise always resolved. Resolve param is the formatted discussions. + * @param discussions List of discussions. + * @param siteId Site ID. If not defined, current site. + * @return Promise always resolved. Resolve param is the formatted discussions. */ protected getDiscussionsUserImg(discussions: any, siteId?: string): Promise { const promises = []; @@ -1266,10 +1266,10 @@ export class AddonMessagesProvider { /** * Get conversation member info by user id, works even if no conversation betwen the users exists. * - * @param {number} otherUserId The other user ID. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Promise resolved with the member info. + * @param otherUserId The other user ID. + * @param siteId Site ID. If not defined, use current site. + * @param userId User ID. If not defined, current user in the site. + * @return Promise resolved with the member info. * @since 3.6 */ getMemberInfo(otherUserId: number, siteId?: string, userId?: number): Promise { @@ -1301,7 +1301,7 @@ export class AddonMessagesProvider { /** * Get the cache key for the get message preferences call. * - * @return {string} Cache key. + * @return Cache key. */ protected getMessagePreferencesCacheKey(): string { return this.ROOT_CACHE_KEY + 'messagePreferences'; @@ -1310,8 +1310,8 @@ export class AddonMessagesProvider { /** * Get message preferences. * - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved with the message preferences. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with the message preferences. */ getMessagePreferences(siteId?: string): Promise { this.logger.debug('Get message preferences'); @@ -1337,11 +1337,10 @@ export class AddonMessagesProvider { /** * Get messages according to the params. * - * @param {any} params Parameters to pass to the WS. - * @param {any} preSets Set of presets for the WS. - * @param {boolean} [toDisplay=true] True if messages will be displayed to the user, either in view or in a notification. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} + * @param params Parameters to pass to the WS. + * @param preSets Set of presets for the WS. + * @param toDisplay True if messages will be displayed to the user, either in view or in a notification. + * @param siteId Site ID. If not defined, use current site. */ protected getMessages(params: any, preSets: any, toDisplay: boolean = true, siteId?: string): Promise { params['type'] = 'conversations'; @@ -1372,13 +1371,12 @@ export class AddonMessagesProvider { /** * Get the most recent messages. * - * @param {any} params Parameters to pass to the WS. - * @param {any} preSets Set of presets for the WS. - * @param {number} [limitFromUnread=0] Number of read messages already fetched, so fetch will be done from this number. - * @param {number} [limitFromRead=0] Number of unread messages already fetched, so fetch will be done from this number. - * @param {boolean} [toDisplay=true] True if messages will be displayed to the user, either in view or in a notification. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} + * @param params Parameters to pass to the WS. + * @param preSets Set of presets for the WS. + * @param limitFromUnread Number of read messages already fetched, so fetch will be done from this number. + * @param limitFromRead Number of unread messages already fetched, so fetch will be done from this number. + * @param toDisplay True if messages will be displayed to the user, either in view or in a notification. + * @param siteId Site ID. If not defined, use current site. */ protected getRecentMessages(params: any, preSets: any, limitFromUnread: number = 0, limitFromRead: number = 0, toDisplay: boolean = true, siteId?: string): Promise { @@ -1419,13 +1417,13 @@ export class AddonMessagesProvider { /** * Get a self conversation. * - * @param {number} [messageOffset=0] Offset for messages list. - * @param {number} [messageLimit=1] Limit of messages. Defaults to 1 (last message). - * We recommend getConversationMessages to get them. - * @param {boolean} [newestFirst=true] Whether to order messages by newest first. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @param {string} [userId] User ID to get the self conversation for. If not defined, current user in the site. - * @return {Promise} Promise resolved with the response. + * @param messageOffset Offset for messages list. + * @param messageLimit Limit of messages. Defaults to 1 (last message). + * We recommend getConversationMessages to get them. + * @param newestFirst Whether to order messages by newest first. + * @param siteId Site ID. If not defined, use current site. + * @param userId User ID to get the self conversation for. If not defined, current user in the site. + * @return Promise resolved with the response. * @since 3.7 */ getSelfConversation(messageOffset: number = 0, messageLimit: number = 1, newestFirst: boolean = true, siteId?: string, @@ -1453,8 +1451,8 @@ export class AddonMessagesProvider { /** * Get unread conversation counts by type. * - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved with the unread favourite, individual and group conversation counts. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved with the unread favourite, individual and group conversation counts. */ getUnreadConversationCounts(siteId?: string): Promise<{favourites: number, individual: number, group: number, self: number, orMore?: boolean}> { @@ -1531,11 +1529,11 @@ export class AddonMessagesProvider { /** * Get the latest unread received messages. * - * @param {boolean} [toDisplay=true] True if messages will be displayed to the user, either in view or in a notification. - * @param {boolean} [forceCache] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [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, use current site. - * @return {Promise} Promise resolved with the message unread count. + * @param toDisplay True if messages will be displayed to the user, either in view or in a notification. + * @param forceCache True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with the message unread count. */ getUnreadReceivedMessages(toDisplay: boolean = true, forceCache: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { @@ -1563,9 +1561,9 @@ export class AddonMessagesProvider { /** * Invalidate all contacts cache. * - * @param {number} userId The user ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when done. + * @param userId The user ID. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when done. */ invalidateAllContactsCache(userId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -1578,9 +1576,8 @@ export class AddonMessagesProvider { /** * Invalidate blocked contacts cache. * - * @param {number} userId The user ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} + * @param userId The user ID. + * @param siteId Site ID. If not defined, current site. */ invalidateBlockedContactsCache(userId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1591,8 +1588,8 @@ export class AddonMessagesProvider { /** * Invalidate contacts cache. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when done. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when done. */ invalidateContactsCache(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1603,8 +1600,8 @@ export class AddonMessagesProvider { /** * Invalidate user contacts cache. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when done. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when done. */ invalidateUserContacts(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1615,8 +1612,8 @@ export class AddonMessagesProvider { /** * Invalidate contact requests cache. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when done. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when done. */ invalidateContactRequestsCache(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1627,8 +1624,8 @@ export class AddonMessagesProvider { /** * Invalidate contact requests count cache. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when done. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when done. */ invalidateContactRequestsCountCache(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1639,10 +1636,10 @@ export class AddonMessagesProvider { /** * Invalidate conversation. * - * @param {number} conversationId Conversation ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Resolved when done. + * @param conversationId Conversation ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, current user in the site. + * @return Resolved when done. */ invalidateConversation(conversationId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1655,10 +1652,10 @@ export class AddonMessagesProvider { /** * Invalidate conversation between users. * - * @param {number} otherUserId Other user ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Resolved when done. + * @param otherUserId Other user ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, current user in the site. + * @return Resolved when done. */ invalidateConversationBetweenUsers(otherUserId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1671,10 +1668,10 @@ export class AddonMessagesProvider { /** * Invalidate conversation members cache. * - * @param {number} conversationId Conversation ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Resolved when done. + * @param conversationId Conversation ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, current user in the site. + * @return Resolved when done. */ invalidateConversationMembers(conversationId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1687,10 +1684,10 @@ export class AddonMessagesProvider { /** * Invalidate conversation messages cache. * - * @param {number} conversationId Conversation ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Resolved when done. + * @param conversationId Conversation ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, current user in the site. + * @return Resolved when done. */ invalidateConversationMessages(conversationId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1703,9 +1700,9 @@ export class AddonMessagesProvider { /** * Invalidate conversations cache. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Resolved when done. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, current user in the site. + * @return Resolved when done. */ invalidateConversations(siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1718,8 +1715,8 @@ export class AddonMessagesProvider { /** * Invalidate conversation counts cache. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when done. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when done. */ invalidateConversationCounts(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1730,9 +1727,9 @@ export class AddonMessagesProvider { /** * Invalidate discussion cache. * - * @param {number} userId The user ID with whom the current user is having the discussion. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when done. + * @param userId The user ID with whom the current user is having the discussion. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when done. */ invalidateDiscussionCache(userId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1745,8 +1742,8 @@ export class AddonMessagesProvider { * * Note that {@link this.getDiscussions} uses the contacts, so we need to invalidate contacts too. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when done. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when done. */ invalidateDiscussionsCache(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1761,10 +1758,10 @@ export class AddonMessagesProvider { /** * Invalidate member info cache. * - * @param {number} otherUserId The other user ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Resolved when done. + * @param otherUserId The other user ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, current user in the site. + * @return Resolved when done. */ invalidateMemberInfo(otherUserId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1777,8 +1774,8 @@ export class AddonMessagesProvider { /** * Invalidate get message preferences. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when data is invalidated. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when data is invalidated. */ invalidateMessagePreferences(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1789,9 +1786,9 @@ export class AddonMessagesProvider { /** * Invalidate all cache entries with member info. * - * @param {number} userId Id of the user to invalidate. - * @param {CoreSite} site Site object. - * @return {Promie} Promise resolved when done. + * @param userId Id of the user to invalidate. + * @param site Site object. + * @return Promise resolved when done. */ protected invalidateAllMemberInfo(userId: number, site: CoreSite): Promise { return this.utils.allPromises([ @@ -1814,9 +1811,9 @@ export class AddonMessagesProvider { /** * Invalidate a self conversation. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Resolved when done. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, current user in the site. + * @return Resolved when done. */ invalidateSelfConversation(siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1829,8 +1826,8 @@ export class AddonMessagesProvider { /** * Invalidate unread conversation counts cache. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when done. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when done. */ invalidateUnreadConversationCounts(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1848,9 +1845,9 @@ export class AddonMessagesProvider { /** * Checks if the a user is blocked by the current user. * - * @param {number} userId The user ID to check against. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved with boolean, rejected when we do not know. + * @param userId The user ID to check against. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved with boolean, rejected when we do not know. */ isBlocked(userId: number, siteId?: string): Promise { if (this.isGroupMessagingEnabled()) { @@ -1873,9 +1870,9 @@ export class AddonMessagesProvider { /** * Checks if the a user is a contact of the current user. * - * @param {number} userId The user ID to check against. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved with boolean, rejected when we do not know. + * @param userId The user ID to check against. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved with boolean, rejected when we do not know. */ isContact(userId: number, siteId?: string): Promise { if (this.isGroupMessagingEnabled()) { @@ -1900,7 +1897,7 @@ export class AddonMessagesProvider { /** * Returns whether or not group messaging is supported. * - * @return {boolean} If related WS is available on current site. + * @return If related WS is available on current site. * @since 3.6 */ isGroupMessagingEnabled(): boolean { @@ -1910,8 +1907,8 @@ export class AddonMessagesProvider { /** * Returns whether or not group messaging is supported in a certain site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether related WS is available on a certain site. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether related WS is available on a certain site. * @since 3.6 */ isGroupMessagingEnabledInSite(siteId?: string): Promise { @@ -1925,7 +1922,7 @@ export class AddonMessagesProvider { /** * Returns whether or not we can mark all messages as read. * - * @return {boolean} If related WS is available on current site. + * @return If related WS is available on current site. * @since 3.2 */ isMarkAllMessagesReadEnabled(): boolean { @@ -1935,7 +1932,7 @@ export class AddonMessagesProvider { /** * Returns whether or not we can count unread messages. * - * @return {boolean} True if enabled, false otherwise. + * @return True if enabled, false otherwise. * @since 3.2 */ isMessageCountEnabled(): boolean { @@ -1945,7 +1942,7 @@ export class AddonMessagesProvider { /** * Returns whether or not the message preferences are enabled for the current site. * - * @return {boolean} True if enabled, false otherwise. + * @return True if enabled, false otherwise. * @since 3.2 */ isMessagePreferencesEnabled(): boolean { @@ -1957,8 +1954,8 @@ export class AddonMessagesProvider { * * This could call a WS so do not abuse this method. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when enabled, otherwise rejected. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when enabled, otherwise rejected. */ isMessagingEnabledForSite(siteId?: string): Promise { return this.isPluginEnabled(siteId).then((enabled) => { @@ -1971,8 +1968,8 @@ export class AddonMessagesProvider { /** * Returns whether or not a site supports muting or unmuting a conversation. * - * @param {CoreSite} [site] The site to check, undefined for current site. - * @return {boolean} If related WS is available on current site. + * @param site The site to check, undefined for current site. + * @return If related WS is available on current site. * @since 3.7 */ isMuteConversationEnabled(site?: CoreSite): boolean { @@ -1984,8 +1981,8 @@ export class AddonMessagesProvider { /** * Returns whether or not a site supports muting or unmuting a conversation. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether related WS is available on a certain site. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether related WS is available on a certain site. * @since 3.7 */ isMuteConversationEnabledInSite(siteId?: string): Promise { @@ -1999,8 +1996,8 @@ export class AddonMessagesProvider { /** * Returns whether or not the plugin is enabled in a certain site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if enabled, rejected or resolved with false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if enabled, rejected or resolved with false otherwise. */ isPluginEnabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2011,7 +2008,6 @@ export class AddonMessagesProvider { /** * Returns whether or not we can search messages. * - * @return {boolean} * @since 3.2 */ isSearchMessagesEnabled(): boolean { @@ -2021,8 +2017,8 @@ export class AddonMessagesProvider { /** * Returns whether or not self conversation is supported in a certain site. * - * @param {CoreSite} [site] Site. If not defined, current site. - * @return {boolean} If related WS is available on the site. + * @param site Site. If not defined, current site. + * @return If related WS is available on the site. * @since 3.7 */ isSelfConversationEnabled(site?: CoreSite): boolean { @@ -2034,8 +2030,8 @@ export class AddonMessagesProvider { /** * Returns whether or not self conversation is supported in a certain site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether related WS is available on a certain site. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether related WS is available on a certain site. * @since 3.7 */ isSelfConversationEnabledInSite(siteId?: string): Promise { @@ -2049,9 +2045,9 @@ export class AddonMessagesProvider { /** * Mark message as read. * - * @param {number} messageId ID of message to mark as read - * @param {string} [siteId] Site ID. If not defined, current site. - * @returns {Promise} Promise resolved with boolean marking success or not. + * @param messageId ID of message to mark as read + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean marking success or not. */ markMessageRead(messageId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2067,8 +2063,8 @@ export class AddonMessagesProvider { /** * Mark all messages of a conversation as read. * - * @param {number} conversationId Conversation ID. - * @returns {Promise} Promise resolved if success. + * @param conversationId Conversation ID. + * @return Promise resolved if success. * @since 3.6 */ markAllConversationMessagesRead(conversationId?: number): Promise { @@ -2086,8 +2082,8 @@ export class AddonMessagesProvider { /** * Mark all messages of a discussion as read. * - * @param {number} userIdFrom User Id for the sender. - * @returns {Promise} Promise resolved with boolean marking success or not. + * @param userIdFrom User Id for the sender. + * @return Promise resolved with boolean marking success or not. */ markAllMessagesRead(userIdFrom?: number): Promise { const params = { @@ -2104,11 +2100,11 @@ export class AddonMessagesProvider { /** * Mute or unmute a conversation. * - * @param {number} conversationId Conversation ID. - * @param {boolean} set Whether to mute or unmute. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Resolved when done. + * @param conversationId Conversation ID. + * @param set Whether to mute or unmute. + * @param siteId Site ID. If not defined, use current site. + * @param userId User ID. If not defined, current user in the site. + * @return Resolved when done. */ muteConversation(conversationId: number, set: boolean, siteId?: string, userId?: number): Promise { return this.muteConversations([conversationId], set, siteId, userId); @@ -2117,11 +2113,11 @@ export class AddonMessagesProvider { /** * Mute or unmute some conversations. * - * @param {number[]} conversations Conversation IDs. - * @param {boolean} set Whether to mute or unmute. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Resolved when done. + * @param conversations Conversation IDs. + * @param set Whether to mute or unmute. + * @param siteId Site ID. If not defined, use current site. + * @param userId User ID. If not defined, current user in the site. + * @return Resolved when done. */ muteConversations(conversations: number[], set: boolean, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2151,8 +2147,8 @@ export class AddonMessagesProvider { /** * Refresh the number of contact requests sent to the current user. * - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved with the number of contact requests. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved with the number of contact requests. * @since 3.6 */ refreshContactRequestsCount(siteId?: string): Promise { @@ -2166,8 +2162,8 @@ export class AddonMessagesProvider { /** * Refresh unread conversation counts and trigger event. * - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved with the unread favourite, individual and group conversation counts. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved with the unread favourite, individual and group conversation counts. */ refreshUnreadConversationCounts(siteId?: string): Promise<{favourites: number, individual: number, group: number, orMore?: boolean}> { @@ -2182,9 +2178,9 @@ export class AddonMessagesProvider { /** * Remove a contact. * - * @param {number} userId User ID of the person to remove. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved when done. + * @param userId User ID of the person to remove. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved when done. */ removeContact(userId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2218,10 +2214,9 @@ export class AddonMessagesProvider { * of results which would take a while to process. The limit here is just a convenience to * prevent viewed to crash because too many DOM elements are created. * - * @param {string} query The query string. - * @param {number} [limit=100] The number of results to return, 0 for none. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} + * @param query The query string. + * @param limit The number of results to return, 0 for none. + * @param siteId Site ID. If not defined, current site. */ searchContacts(query: string, limit: number = 100, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2247,12 +2242,12 @@ export class AddonMessagesProvider { /** * Search for all the messges with a specific text. * - * @param {string} query The query string. - * @param {number} [userId] The user ID. If not defined, current user. - * @param {number} [limitFrom=0] Position of the first result to get. Defaults to 0. - * @param {number} [limitNum] Number of results to get. Defaults to AddonMessagesProvider.LIMIT_SEARCH. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the results. + * @param query The query string. + * @param userId The user ID. If not defined, current user. + * @param limitFrom Position of the first result to get. Defaults to 0. + * @param limitNum Number of results to get. Defaults to AddonMessagesProvider.LIMIT_SEARCH. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the results. */ searchMessages(query: string, userId?: number, limitFrom: number = 0, limitNum: number = AddonMessagesProvider.LIMIT_SEARCH, siteId?: string): Promise<{messages: any[], canLoadMore: boolean}> { @@ -2294,11 +2289,11 @@ export class AddonMessagesProvider { /** * Search for users. * - * @param {string} query Text to search for. - * @param {number} [limitFrom=0] Position of the first found user to fetch. - * @param {number} [limitNum] Number of found users to fetch. Defaults to AddonMessagesProvider.LIMIT_SEARCH. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved with two lists of found users: contacts and non-contacts. + * @param query Text to search for. + * @param limitFrom Position of the first found user to fetch. + * @param limitNum Number of found users to fetch. Defaults to AddonMessagesProvider.LIMIT_SEARCH. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved with two lists of found users: contacts and non-contacts. * @since 3.6 */ searchUsers(query: string, limitFrom: number = 0, limitNum: number = AddonMessagesProvider.LIMIT_SEARCH, siteId?: string): @@ -2339,12 +2334,12 @@ export class AddonMessagesProvider { /** * Send a message to someone. * - * @param {number} userIdTo User ID to send the message to. - * @param {string} message The message to send - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with: - * - sent (Boolean) True if message was sent to server, false if stored in device. - * - message (Object) If sent=false, contains the stored message. + * @param userIdTo User ID to send the message to. + * @param message The message to send + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with: + * - sent (Boolean) True if message was sent to server, false if stored in device. + * - message (Object) If sent=false, contains the stored message. */ sendMessage(toUserId: number, message: string, siteId?: string): Promise { // Convenience function to store a message to be synchronized later. @@ -2395,10 +2390,10 @@ export class AddonMessagesProvider { /** * Send a message to someone. It will fail if offline or cannot connect. * - * @param {number} toUserId User ID to send the message to. - * @param {string} message The message to send - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success, rejected if failure. + * @param toUserId User ID to send the message to. + * @param message The message to send + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success, rejected if failure. */ sendMessageOnline(toUserId: number, message: string, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -2430,10 +2425,10 @@ export class AddonMessagesProvider { * IMPORTANT: Sending several messages at once for the same discussions can cause problems with display order, * since messages with same timecreated aren't ordered by ID. * - * @param {any} messages Messages to send. Each message must contain touserid, text and textformat. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success, rejected if failure. Promise resolved doesn't mean that messages - * have been sent, the resolve param can contain errors for messages not sent. + * @param messages Messages to send. Each message must contain touserid, text and textformat. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success, rejected if failure. Promise resolved doesn't mean that messages + * have been sent, the resolve param can contain errors for messages not sent. */ sendMessagesOnline(messages: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2448,12 +2443,12 @@ export class AddonMessagesProvider { /** * Send a message to a conversation. * - * @param {any} conversation Conversation. - * @param {string} message The message to send. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with: - * - sent (boolean) True if message was sent to server, false if stored in device. - * - message (any) If sent=false, contains the stored message. + * @param conversation Conversation. + * @param message The message to send. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with: + * - sent (boolean) True if message was sent to server, false if stored in device. + * - message (any) If sent=false, contains the stored message. * @since 3.6 */ sendMessageToConversation(conversation: any, message: string, siteId?: string): Promise { @@ -2505,10 +2500,10 @@ export class AddonMessagesProvider { /** * Send a message to a conversation. It will fail if offline or cannot connect. * - * @param {number} conversationId Conversation ID. - * @param {string} message The message to send - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success, rejected if failure. + * @param conversationId Conversation ID. + * @param message The message to send + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success, rejected if failure. * @since 3.6 */ sendMessageToConversationOnline(conversationId: number, message: string, siteId?: string): Promise { @@ -2533,10 +2528,10 @@ export class AddonMessagesProvider { /** * Send some messages to a conversation. It will fail if offline or cannot connect. * - * @param {number} conversationId Conversation ID. - * @param {any} messages Messages to send. Each message must contain text and, optionally, textformat. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success, rejected if failure. + * @param conversationId Conversation ID. + * @param messages Messages to send. Each message must contain text and, optionally, textformat. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success, rejected if failure. * @since 3.6 */ sendMessagesToConversationOnline(conversationId: number, messages: any, siteId?: string): Promise { @@ -2558,11 +2553,11 @@ export class AddonMessagesProvider { /** * Set or unset a conversation as favourite. * - * @param {number} conversationId Conversation ID. - * @param {boolean} set Whether to set or unset it as favourite. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Resolved when done. + * @param conversationId Conversation ID. + * @param set Whether to set or unset it as favourite. + * @param siteId Site ID. If not defined, use current site. + * @param userId User ID. If not defined, current user in the site. + * @return Resolved when done. */ setFavouriteConversation(conversationId: number, set: boolean, siteId?: string, userId?: number): Promise { return this.setFavouriteConversations([conversationId], set, siteId, userId); @@ -2571,11 +2566,11 @@ export class AddonMessagesProvider { /** * Set or unset some conversations as favourites. * - * @param {number[]} conversations Conversation IDs. - * @param {boolean} set Whether to set or unset them as favourites. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @param {number} [userId] User ID. If not defined, current user in the site. - * @return {Promise} Resolved when done. + * @param conversations Conversation IDs. + * @param set Whether to set or unset them as favourites. + * @param siteId Site ID. If not defined, use current site. + * @param userId User ID. If not defined, current user in the site. + * @return Resolved when done. */ setFavouriteConversations(conversations: number[], set: boolean, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2605,8 +2600,8 @@ export class AddonMessagesProvider { /** * Helper method to sort conversations by last message time. * - * @param {any[]} conversations Array of conversations. - * @return {any[]} Conversations sorted with most recent last. + * @param conversations Array of conversations. + * @return Conversations sorted with most recent last. */ sortConversations(conversations: any[]): any[] { return conversations.sort((a, b) => { @@ -2625,8 +2620,8 @@ export class AddonMessagesProvider { /** * Helper method to sort messages by time. * - * @param {any[]} messages Array of messages containing the key 'timecreated'. - * @return {any[]} Messages sorted with most recent last. + * @param messages Array of messages containing the key 'timecreated'. + * @return Messages sorted with most recent last. */ sortMessages(messages: any[]): any[] { return messages.sort((a, b) => { @@ -2651,10 +2646,10 @@ export class AddonMessagesProvider { /** * Store the last received message if it's newer than the last stored. * - * @param {number} convIdOrUserIdFrom Conversation ID (3.6+) or ID of the useridfrom retrieved (3.5-), 0 for all users. - * @param {any} message Last message received. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param convIdOrUserIdFrom Conversation ID (3.6+) or ID of the useridfrom retrieved (3.5-), 0 for all users. + * @param message Last message received. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ protected storeLastReceivedMessageIfNeeded(convIdOrUserIdFrom: number, message: any, siteId?: string): Promise { const component = AddonMessagesProvider.PUSH_SIMULATION_COMPONENT; @@ -2678,7 +2673,7 @@ export class AddonMessagesProvider { /** * Store user data from contacts in local DB. * - * @param {any} contactTypes List of contacts grouped in types. + * @param contactTypes List of contacts grouped in types. */ protected storeUsersFromAllContacts(contactTypes: any): void { for (const x in contactTypes) { @@ -2689,8 +2684,8 @@ export class AddonMessagesProvider { /** * Store user data from discussions in local DB. * - * @param {any} discussions List of discussions. - * @param {string} [siteId] Site ID. If not defined, current site. + * @param discussions List of discussions. + * @param siteId Site ID. If not defined, current site. */ protected storeUsersFromDiscussions(discussions: any, siteId?: string): void { const users = []; @@ -2707,9 +2702,9 @@ export class AddonMessagesProvider { /** * Unblock a user. * - * @param {number} userId User ID of the person to unblock. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Resolved when done. + * @param userId User ID of the person to unblock. + * @param siteId Site ID. If not defined, use current site. + * @return Resolved when done. */ unblockContact(userId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/messages/providers/push-click-handler.ts b/src/addon/messages/providers/push-click-handler.ts index f6fcf3c0e..7e1fcad43 100644 --- a/src/addon/messages/providers/push-click-handler.ts +++ b/src/addon/messages/providers/push-click-handler.ts @@ -33,8 +33,8 @@ export class AddonMessagesPushClickHandler implements CorePushNotificationsClick /** * Check if a notification click is handled by this handler. * - * @param {any} notification The notification to check. - * @return {boolean} Whether the notification click is handled by this handler + * @param notification The notification to check. + * @return Whether the notification click is handled by this handler */ handles(notification: any): boolean | Promise { if (this.utils.isTrueOrOne(notification.notif) && notification.name != 'messagecontactrequests') { @@ -48,8 +48,8 @@ export class AddonMessagesPushClickHandler implements CorePushNotificationsClick /** * Handle the notification click. * - * @param {any} notification The notification to check. - * @return {Promise} Promise resolved when done. + * @param notification The notification to check. + * @return Promise resolved when done. */ handleClick(notification: any): Promise { return this.messagesProvider.invalidateDiscussionsCache(notification.site).catch(() => { diff --git a/src/addon/messages/providers/settings-handler.ts b/src/addon/messages/providers/settings-handler.ts index 06a8cdbc3..870df829b 100644 --- a/src/addon/messages/providers/settings-handler.ts +++ b/src/addon/messages/providers/settings-handler.ts @@ -30,7 +30,7 @@ export class AddonMessagesSettingsHandler implements CoreSettingsHandler { /** * Check if the handler is enabled on a site level. * - * @return {boolean | Promise} 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 { return this.messagesProvider.isMessagePreferencesEnabled(); @@ -39,7 +39,7 @@ export class AddonMessagesSettingsHandler implements CoreSettingsHandler { /** * Returns the data needed to render the handler. * - * @return {CoreSettingsHandlerData} Data needed to render the handler. + * @return Data needed to render the handler. */ getDisplayData(): CoreSettingsHandlerData { return { diff --git a/src/addon/messages/providers/sync-cron-handler.ts b/src/addon/messages/providers/sync-cron-handler.ts index 466a593c3..585414b39 100644 --- a/src/addon/messages/providers/sync-cron-handler.ts +++ b/src/addon/messages/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class AddonMessagesSyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.messagesSync.syncAllDiscussions(siteId); @@ -40,7 +40,7 @@ export class AddonMessagesSyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return 300000; // 5 minutes. diff --git a/src/addon/messages/providers/sync.ts b/src/addon/messages/providers/sync.ts index d8e46f6e8..6c7d33886 100644 --- a/src/addon/messages/providers/sync.ts +++ b/src/addon/messages/providers/sync.ts @@ -46,9 +46,9 @@ export class AddonMessagesSyncProvider extends CoreSyncBaseProvider { /** * Get the ID of a discussion sync. * - * @param {number} conversationId Conversation ID. - * @param {number} userId User ID talking to (if no conversation ID). - * @return {string} Sync ID. + * @param conversationId Conversation ID. + * @param userId User ID talking to (if no conversation ID). + * @return Sync ID. */ protected getSyncId(conversationId: number, userId: number): string { if (conversationId) { @@ -61,10 +61,10 @@ export class AddonMessagesSyncProvider extends CoreSyncBaseProvider { /** * Try to synchronize all the discussions in a certain site or in all sites. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} [onlyDeviceOffline=false] True to only sync discussions that failed because device was offline, - * false to sync all. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param onlyDeviceOffline True to only sync discussions that failed because device was offline, + * false to sync all. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncAllDiscussions(siteId?: string, onlyDeviceOffline: boolean = false): Promise { const syncFunctionLog = 'all discussions' + (onlyDeviceOffline ? ' (Only offline)' : ''); @@ -75,9 +75,9 @@ export class AddonMessagesSyncProvider extends CoreSyncBaseProvider { /** * Get all messages pending to be sent in the site. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} [onlyDeviceOffline=false] True to only sync discussions that failed because device was offline. - * @param {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param onlyDeviceOffline True to only sync discussions that failed because device was offline. + * @param Promise resolved if sync is successful, rejected if sync fails. */ protected syncAllDiscussionsFunc(siteId?: string, onlyDeviceOffline: boolean = false): Promise { const promise = onlyDeviceOffline ? @@ -132,9 +132,9 @@ export class AddonMessagesSyncProvider extends CoreSyncBaseProvider { /** * Synchronize a discussion. * - * @param {number} conversationId Conversation ID. - * @param {number} userId User ID talking to (if no conversation ID). - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param conversationId Conversation ID. + * @param userId User ID talking to (if no conversation ID). + * @return Promise resolved if sync is successful, rejected otherwise. */ syncDiscussion(conversationId: number, userId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -245,11 +245,11 @@ export class AddonMessagesSyncProvider extends CoreSyncBaseProvider { /** * Handle sync errors. * - * @param {number} conversationId Conversation ID. - * @param {number} userId User ID talking to (if no conversation ID). - * @param {any[]} errors List of errors. - * @param {any[]} warnings Array where to place the warnings. - * @return {Promise} Promise resolved when done. + * @param conversationId Conversation ID. + * @param userId User ID talking to (if no conversation ID). + * @param errors List of errors. + * @param warnings Array where to place the warnings. + * @return Promise resolved when done. */ protected handleSyncErrors(conversationId: number, userId: number, errors: any[], warnings: any[]): Promise { if (errors && errors.length) { @@ -289,10 +289,10 @@ export class AddonMessagesSyncProvider extends CoreSyncBaseProvider { * If there's an ongoing sync for a certain conversation, wait for it to end. * If there's no sync ongoing the promise will be resolved right away. * - * @param {number} conversationId Conversation ID. - * @param {number} userId User ID talking to (if no conversation ID). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when there's no sync going on for the identifier. + * @param conversationId Conversation ID. + * @param userId User ID talking to (if no conversation ID). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when there's no sync going on for the identifier. */ waitForSyncConversation(conversationId: number, userId: number, siteId?: string): Promise { const syncId = this.getSyncId(conversationId, userId); diff --git a/src/addon/messages/providers/user-add-contact-handler.ts b/src/addon/messages/providers/user-add-contact-handler.ts index 903d2b2e2..913695dd9 100644 --- a/src/addon/messages/providers/user-add-contact-handler.ts +++ b/src/addon/messages/providers/user-add-contact-handler.ts @@ -28,7 +28,6 @@ import { TranslateService } from '@ngx-translate/core'; export class AddonMessagesAddContactUserHandler implements CoreUserProfileHandler, OnDestroy { /** * Update handler information event. - * @type {string} */ static UPDATED_EVENT = 'AddonMessagesAddContactUserHandler_updated_event'; @@ -51,7 +50,7 @@ export class AddonMessagesAddContactUserHandler implements CoreUserProfileHandle /** * Check if handler is enabled. * - * @return {Promise} Promise resolved with true if enabled, rejected or resolved with false otherwise. + * @return Promise resolved with true if enabled, rejected or resolved with false otherwise. */ isEnabled(): Promise { return this.messagesProvider.isPluginEnabled(); @@ -60,11 +59,11 @@ export class AddonMessagesAddContactUserHandler implements CoreUserProfileHandle /** * Check if handler is enabled for this user in this context. * - * @param {any} user User to check. - * @param {number} courseId Course ID. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} Promise resolved with true if enabled, resolved with false otherwise. + * @param user User to check. + * @param courseId Course ID. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved with true if enabled, resolved with false otherwise. */ isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise { return user.id != this.sitesProvider.getCurrentSiteUserId(); @@ -73,7 +72,7 @@ export class AddonMessagesAddContactUserHandler implements CoreUserProfileHandle /** * 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 { this.checkButton(user.id); @@ -119,8 +118,8 @@ export class AddonMessagesAddContactUserHandler implements CoreUserProfileHandle /** * Update Button with avalaible data. - * @param {number} userId User Id to update. - * @return {Promise} Promise resolved when done. + * @param userId User Id to update. + * @return Promise resolved when done. */ protected checkButton(userId: number): Promise { this.updateButton(userId, {spinner: true}); @@ -154,8 +153,8 @@ export class AddonMessagesAddContactUserHandler implements CoreUserProfileHandle /** * Triggers the event to update the handler information. * - * @param {number} userId The user ID the handler belongs to. - * @param {any} data Data that should be updated. + * @param userId The user ID the handler belongs to. + * @param data Data that should be updated. */ protected updateButton(userId: number, data: any): void { // This fails for some reason, let's just hide the button. @@ -165,8 +164,8 @@ export class AddonMessagesAddContactUserHandler implements CoreUserProfileHandle /** * Add a contact or send a contact request if group messaging is enabled. * - * @param {any} user User to add as contact. - * @return {Promise} Promise resolved when done. + * @param user User to add as contact. + * @return Promise resolved when done. */ protected addContact(user: any): Promise { if (!this.messagesProvider.isGroupMessagingEnabled()) { diff --git a/src/addon/messages/providers/user-block-contact-handler.ts b/src/addon/messages/providers/user-block-contact-handler.ts index 0b325420c..d3c36e730 100644 --- a/src/addon/messages/providers/user-block-contact-handler.ts +++ b/src/addon/messages/providers/user-block-contact-handler.ts @@ -28,7 +28,6 @@ import { TranslateService } from '@ngx-translate/core'; export class AddonMessagesBlockContactUserHandler implements CoreUserProfileHandler, OnDestroy { /** * Update handler information event. - * @type {string} */ static UPDATED_EVENT = 'AddonMessagesBlockContactUserHandler_updated_event'; @@ -51,7 +50,7 @@ export class AddonMessagesBlockContactUserHandler implements CoreUserProfileHand /** * Check if handler is enabled. * - * @return {Promise} Promise resolved with true if enabled, rejected or resolved with false otherwise. + * @return Promise resolved with true if enabled, rejected or resolved with false otherwise. */ isEnabled(): Promise { return this.messagesProvider.isPluginEnabled(); @@ -60,11 +59,11 @@ export class AddonMessagesBlockContactUserHandler implements CoreUserProfileHand /** * Check if handler is enabled for this user in this context. * - * @param {any} user User to check. - * @param {number} courseId Course ID. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} Promise resolved with true if enabled, resolved with false otherwise. + * @param user User to check. + * @param courseId Course ID. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved with true if enabled, resolved with false otherwise. */ isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise { return user.id != this.sitesProvider.getCurrentSiteUserId(); @@ -73,7 +72,7 @@ export class AddonMessagesBlockContactUserHandler implements CoreUserProfileHand /** * 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 { @@ -125,8 +124,8 @@ export class AddonMessagesBlockContactUserHandler implements CoreUserProfileHand /** * Update Button with avalaible data. - * @param {number} userId User Id to update. - * @return {Promise} Promise resolved when done. + * @param userId User Id to update. + * @return Promise resolved when done. */ protected checkButton(userId: number): Promise { this.updateButton(userId, {spinner: true}); @@ -158,8 +157,8 @@ export class AddonMessagesBlockContactUserHandler implements CoreUserProfileHand /** * Triggers the event to update the handler information. * - * @param {number} userId The user ID the handler belongs to. - * @param {any} data Data that should be updated. + * @param userId The user ID the handler belongs to. + * @param data Data that should be updated. */ protected updateButton(userId: number, data: any): void { // This fails for some reason, let's just hide the button. diff --git a/src/addon/messages/providers/user-send-message-handler.ts b/src/addon/messages/providers/user-send-message-handler.ts index 8fd8982d9..86759fb60 100644 --- a/src/addon/messages/providers/user-send-message-handler.ts +++ b/src/addon/messages/providers/user-send-message-handler.ts @@ -33,7 +33,7 @@ export class AddonMessagesSendMessageUserHandler implements CoreUserProfileHandl /** * Check if handler is enabled. * - * @return {Promise} Promise resolved with true if enabled, rejected or resolved with false otherwise. + * @return Promise resolved with true if enabled, rejected or resolved with false otherwise. */ isEnabled(): Promise { return this.messagesProvider.isPluginEnabled(); @@ -42,11 +42,11 @@ export class AddonMessagesSendMessageUserHandler implements CoreUserProfileHandl /** * Check if handler is enabled for this user in this context. * - * @param {any} user User to check. - * @param {number} courseId Course ID. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} Promise resolved with true if enabled, resolved with false otherwise. + * @param user User to check. + * @param courseId Course ID. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved with true if enabled, resolved with false otherwise. */ isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise { const currentSite = this.sitesProvider.getCurrentSite(); @@ -62,7 +62,7 @@ export class AddonMessagesSendMessageUserHandler implements CoreUserProfileHandl /** * 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 { return { diff --git a/src/addon/mod/assign/classes/base-feedback-handler.ts b/src/addon/mod/assign/classes/base-feedback-handler.ts index 61b9addbc..33e08c2d4 100644 --- a/src/addon/mod/assign/classes/base-feedback-handler.ts +++ b/src/addon/mod/assign/classes/base-feedback-handler.ts @@ -31,10 +31,10 @@ export class AddonModAssignBaseFeedbackHandler implements AddonModAssignFeedback /** * Discard the draft data of the feedback plugin. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assignId The assignment ID. + * @param userId User ID. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ discardDraft(assignId: number, userId: number, siteId?: string): void | Promise { // Nothing to do. @@ -44,9 +44,9 @@ export class AddonModAssignBaseFeedbackHandler implements AddonModAssignFeedback * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} plugin The plugin object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param plugin The plugin object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any): any | Promise { // Nothing to do. @@ -55,10 +55,10 @@ export class AddonModAssignBaseFeedbackHandler implements AddonModAssignFeedback /** * Return the draft saved data of the feedback plugin. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {any|Promise} Data (or promise resolved with the data). + * @param assignId The assignment ID. + * @param userId User ID. + * @param siteId Site ID. If not defined, current site. + * @return Data (or promise resolved with the data). */ getDraft(assignId: number, userId: number, siteId?: string): any | Promise { // Nothing to do. @@ -68,11 +68,11 @@ export class AddonModAssignBaseFeedbackHandler implements AddonModAssignFeedback * Get files used by this plugin. * The files returned by this function will be prefetched when the user prefetches the assign. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {any[]|Promise} The files (or promise resolved with the files). + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return The files (or promise resolved with the files). */ getPluginFiles(assign: any, submission: any, plugin: any, siteId?: string): any[] | Promise { return []; @@ -81,8 +81,8 @@ export class AddonModAssignBaseFeedbackHandler implements AddonModAssignFeedback /** * Get a readable name to use for the plugin. * - * @param {any} plugin The plugin object. - * @return {string} The plugin name. + * @param plugin The plugin object. + * @return The plugin name. */ getPluginName(plugin: any): string { // Check if there's a translated string for the plugin. @@ -103,11 +103,11 @@ export class AddonModAssignBaseFeedbackHandler implements AddonModAssignFeedback /** * Check if the feedback data has changed for this plugin. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the feedback. - * @return {boolean|Promise} Boolean (or promise resolved with boolean): whether the data has changed. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the feedback. + * @return Boolean (or promise resolved with boolean): whether the data has changed. */ hasDataChanged(assign: any, submission: any, plugin: any, inputData: any): boolean | Promise { return false; @@ -116,10 +116,10 @@ export class AddonModAssignBaseFeedbackHandler implements AddonModAssignFeedback /** * Check whether the plugin has draft data stored. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean|Promise} Boolean or promise resolved with boolean: whether the plugin has draft data. + * @param assignId The assignment ID. + * @param userId User ID. + * @param siteId Site ID. If not defined, current site. + * @return Boolean or promise resolved with boolean: whether the plugin has draft data. */ hasDraftData(assignId: number, userId: number, siteId?: string): boolean | Promise { return false; @@ -128,7 +128,7 @@ export class AddonModAssignBaseFeedbackHandler implements AddonModAssignFeedback /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -138,11 +138,11 @@ export class AddonModAssignBaseFeedbackHandler implements AddonModAssignFeedback * Prefetch any required data for the plugin. * This should NOT prefetch files. Files to be prefetched should be returned by the getPluginFiles function. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ prefetch(assign: any, submission: any, plugin: any, siteId?: string): Promise { return Promise.resolve(); @@ -151,12 +151,12 @@ export class AddonModAssignBaseFeedbackHandler implements AddonModAssignFeedback /** * Prepare and add to pluginData the data to send to the server based on the draft data saved. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {any} plugin The plugin object. - * @param {any} pluginData Object where to store the data to send. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assignId The assignment ID. + * @param userId User ID. + * @param plugin The plugin object. + * @param pluginData Object where to store the data to send. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ prepareFeedbackData(assignId: number, userId: number, plugin: any, pluginData: any, siteId?: string): void | Promise { // Nothing to do. @@ -165,12 +165,12 @@ export class AddonModAssignBaseFeedbackHandler implements AddonModAssignFeedback /** * Save draft data of the feedback plugin. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {any} plugin The plugin object. - * @param {any} data The data to save. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assignId The assignment ID. + * @param userId User ID. + * @param plugin The plugin object. + * @param data The data to save. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ saveDraft(assignId: number, userId: number, plugin: any, data: any, siteId?: string): void | Promise { // Nothing to do. diff --git a/src/addon/mod/assign/classes/base-submission-handler.ts b/src/addon/mod/assign/classes/base-submission-handler.ts index 7f3d52bdf..e0e6bb34e 100644 --- a/src/addon/mod/assign/classes/base-submission-handler.ts +++ b/src/addon/mod/assign/classes/base-submission-handler.ts @@ -33,10 +33,10 @@ export class AddonModAssignBaseSubmissionHandler implements AddonModAssignSubmis * plugin uses Moodle filters. The reason is that the app only prefetches filtered data, and the user should edit * unfiltered data. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @return {boolean|Promise} Boolean or promise resolved with boolean: whether it can be edited in offline. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @return Boolean or promise resolved with boolean: whether it can be edited in offline. */ canEditOffline(assign: any, submission: any, plugin: any): boolean | Promise { return false; @@ -45,10 +45,10 @@ export class AddonModAssignBaseSubmissionHandler implements AddonModAssignSubmis /** * Should clear temporary data for a cancelled submission. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. */ clearTmpData(assign: any, submission: any, plugin: any, inputData: any): void { // Nothing to do. @@ -58,12 +58,12 @@ export class AddonModAssignBaseSubmissionHandler implements AddonModAssignSubmis * This function will be called when the user wants to create a new submission based on the previous one. * It should add to pluginData the data to send to server based in the data in plugin (previous attempt). * - * @param {any} assign The assignment. - * @param {any} plugin The plugin object. - * @param {any} pluginData Object where to store the data to send. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assign The assignment. + * @param plugin The plugin object. + * @param pluginData Object where to store the data to send. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ copySubmissionData(assign: any, plugin: any, pluginData: any, userId?: number, siteId?: string): void | Promise { // Nothing to do. @@ -72,12 +72,12 @@ export class AddonModAssignBaseSubmissionHandler implements AddonModAssignSubmis /** * Delete any stored data for the plugin and submission. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} offlineData Offline data stored. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param offlineData Offline data stored. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ deleteOfflineData(assign: any, submission: any, plugin: any, offlineData: any, siteId?: string): void | Promise { // Nothing to do. @@ -87,10 +87,10 @@ export class AddonModAssignBaseSubmissionHandler implements AddonModAssignSubmis * Return the Component to use to display the plugin data, either in read or in edit mode. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} plugin The plugin object. - * @param {boolean} [edit] Whether the user is editing. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param plugin The plugin object. + * @param edit Whether the user is editing. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any, edit?: boolean): any | Promise { // Nothing to do. @@ -100,11 +100,11 @@ export class AddonModAssignBaseSubmissionHandler implements AddonModAssignSubmis * Get files used by this plugin. * The files returned by this function will be prefetched when the user prefetches the assign. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {any[]|Promise} The files (or promise resolved with the files). + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return The files (or promise resolved with the files). */ getPluginFiles(assign: any, submission: any, plugin: any, siteId?: string): any[] | Promise { return []; @@ -113,8 +113,8 @@ export class AddonModAssignBaseSubmissionHandler implements AddonModAssignSubmis /** * Get a readable name to use for the plugin. * - * @param {any} plugin The plugin object. - * @return {string} The plugin name. + * @param plugin The plugin object. + * @return The plugin name. */ getPluginName(plugin: any): string { // Check if there's a translated string for the plugin. @@ -135,9 +135,9 @@ export class AddonModAssignBaseSubmissionHandler implements AddonModAssignSubmis /** * Get the size of data (in bytes) this plugin will send to copy a previous submission. * - * @param {any} assign The assignment. - * @param {any} plugin The plugin object. - * @return {number|Promise} The size (or promise resolved with size). + * @param assign The assignment. + * @param plugin The plugin object. + * @return The size (or promise resolved with size). */ getSizeForCopy(assign: any, plugin: any): number | Promise { return 0; @@ -146,9 +146,9 @@ export class AddonModAssignBaseSubmissionHandler implements AddonModAssignSubmis /** * Get the size of data (in bytes) this plugin will send to add or edit a submission. * - * @param {any} assign The assignment. - * @param {any} plugin The plugin object. - * @return {number|Promise} The size (or promise resolved with size). + * @param assign The assignment. + * @param plugin The plugin object. + * @return The size (or promise resolved with size). */ getSizeForEdit(assign: any, plugin: any): number | Promise { return 0; @@ -157,11 +157,11 @@ export class AddonModAssignBaseSubmissionHandler implements AddonModAssignSubmis /** * Check if the submission data has changed for this plugin. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. - * @return {boolean|Promise} Boolean (or promise resolved with boolean): whether the data has changed. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. + * @return Boolean (or promise resolved with boolean): whether the data has changed. */ hasDataChanged(assign: any, submission: any, plugin: any, inputData: any): boolean | Promise { return false; @@ -170,7 +170,7 @@ export class AddonModAssignBaseSubmissionHandler implements AddonModAssignSubmis /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -178,7 +178,7 @@ export class AddonModAssignBaseSubmissionHandler implements AddonModAssignSubmis /** * Whether or not the handler is enabled for edit on a site level. - * @return {boolean|Promise} Whether or not the handler is enabled for edit on a site level. + * @return Whether or not the handler is enabled for edit on a site level. */ isEnabledForEdit(): boolean | Promise { return false; @@ -188,11 +188,11 @@ export class AddonModAssignBaseSubmissionHandler implements AddonModAssignSubmis * Prefetch any required data for the plugin. * This should NOT prefetch files. Files to be prefetched should be returned by the getPluginFiles function. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ prefetch(assign: any, submission: any, plugin: any, siteId?: string): Promise { return Promise.resolve(); @@ -201,15 +201,15 @@ export class AddonModAssignBaseSubmissionHandler implements AddonModAssignSubmis /** * Prepare and add to pluginData the data to send to the server based on the input data. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. - * @param {any} pluginData Object where to store the data to send. - * @param {boolean} [offline] Whether the user is editing in offline. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. + * @param pluginData Object where to store the data to send. + * @param offline Whether the user is editing in offline. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ prepareSubmissionData?(assign: any, submission: any, plugin: any, inputData: any, pluginData: any, offline?: boolean, userId?: number, siteId?: string): void | Promise { @@ -220,13 +220,13 @@ export class AddonModAssignBaseSubmissionHandler implements AddonModAssignSubmis * Prepare and add to pluginData the data to send to the server based on the offline data stored. * This will be used when performing a synchronization. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} offlineData Offline data stored. - * @param {any} pluginData Object where to store the data to send. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param offlineData Offline data stored. + * @param pluginData Object where to store the data to send. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ prepareSyncData?(assign: any, submission: any, plugin: any, offlineData: any, pluginData: any, siteId?: string) : void | Promise { diff --git a/src/addon/mod/assign/classes/feedback-plugin-component.ts b/src/addon/mod/assign/classes/feedback-plugin-component.ts index dfb9250cd..d315d1b7f 100644 --- a/src/addon/mod/assign/classes/feedback-plugin-component.ts +++ b/src/addon/mod/assign/classes/feedback-plugin-component.ts @@ -32,7 +32,7 @@ export class AddonModAssignFeedbackPluginComponentBase { /** * Open a modal to edit the feedback plugin. * - * @return {Promise} Promise resolved with the input data, rejected if cancelled. + * @return Promise resolved with the input data, rejected if cancelled. */ editFeedback(): Promise { if (this.canEdit) { @@ -62,7 +62,7 @@ export class AddonModAssignFeedbackPluginComponentBase { /** * Invalidate the data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ invalidate(): Promise { return Promise.resolve(); diff --git a/src/addon/mod/assign/classes/submission-plugin-component.ts b/src/addon/mod/assign/classes/submission-plugin-component.ts index 35e750585..39e8cdd2b 100644 --- a/src/addon/mod/assign/classes/submission-plugin-component.ts +++ b/src/addon/mod/assign/classes/submission-plugin-component.ts @@ -32,7 +32,7 @@ export class AddonModAssignSubmissionPluginComponent { /** * Invalidate the data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ invalidate(): Promise { return Promise.resolve(); diff --git a/src/addon/mod/assign/components/feedback-plugin/feedback-plugin.ts b/src/addon/mod/assign/components/feedback-plugin/feedback-plugin.ts index 82b9511bb..94b847fda 100644 --- a/src/addon/mod/assign/components/feedback-plugin/feedback-plugin.ts +++ b/src/addon/mod/assign/components/feedback-plugin/feedback-plugin.ts @@ -96,7 +96,7 @@ export class AddonModAssignFeedbackPluginComponent implements OnInit { /** * Invalidate the plugin data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ invalidate(): Promise { return Promise.resolve(this.dynamicComponent && this.dynamicComponent.callComponentFunction('invalidate', [])); diff --git a/src/addon/mod/assign/components/index/index.ts b/src/addon/mod/assign/components/index/index.ts index 26d57888e..2697f6c36 100644 --- a/src/addon/mod/assign/components/index/index.ts +++ b/src/addon/mod/assign/components/index/index.ts @@ -141,10 +141,10 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo /** * Get assignment data. * - * @param {boolean} [refresh=false] If it's refreshing content. - * @param {boolean} [sync=false] If it should try to sync. - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved when done. + * @param refresh If it's refreshing content. + * @param sync If it should try to sync. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved when done. */ protected fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { @@ -228,8 +228,8 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo /** * Set group to see the summary. * - * @param {number} groupId Group ID. - * @return {Promise} Resolved when done. + * @param groupId Group ID. + * @return Resolved when done. */ setGroup(groupId: number): Promise { this.group = groupId; @@ -245,8 +245,8 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo /** * Go to view a list of submissions. * - * @param {string} status Status to see. - * @param {number} count Number of submissions with the status. + * @param status Status to see. + * @param count Number of submissions with the status. */ goToSubmissionList(status: string, count: number): void { if (typeof status == 'undefined') { @@ -270,8 +270,8 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo /** * Checks if sync has succeed from result sync data. * - * @param {any} result Data returned by the sync function. - * @return {boolean} If succeed or not. + * @param result Data returned by the sync function. + * @return If succeed or not. */ protected hasSyncSucceed(result: any): boolean { if (result.updated) { @@ -284,7 +284,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -325,8 +325,8 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo /** * Compares sync event data with current data to check if refresh content is needed. * - * @param {any} syncEventData Data receiven on sync observer. - * @return {boolean} True if refresh is needed, false otherwise. + * @param syncEventData Data receiven on sync observer. + * @return True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: any): boolean { if (this.assign && syncEventData.assignId == this.assign.id) { @@ -344,7 +344,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo /** * Performs the sync of the activity. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected sync(): Promise { return this.syncProvider.syncAssign(this.assign.id); diff --git a/src/addon/mod/assign/components/submission-plugin/submission-plugin.ts b/src/addon/mod/assign/components/submission-plugin/submission-plugin.ts index 3d4d0dba5..f8ba6d005 100644 --- a/src/addon/mod/assign/components/submission-plugin/submission-plugin.ts +++ b/src/addon/mod/assign/components/submission-plugin/submission-plugin.ts @@ -90,7 +90,7 @@ export class AddonModAssignSubmissionPluginComponent implements OnInit { /** * Invalidate the plugin data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ invalidate(): Promise { return Promise.resolve(this.dynamicComponent && this.dynamicComponent.callComponentFunction('invalidate', [])); diff --git a/src/addon/mod/assign/components/submission/submission.ts b/src/addon/mod/assign/components/submission/submission.ts index 49489a9a5..762270fb6 100644 --- a/src/addon/mod/assign/components/submission/submission.ts +++ b/src/addon/mod/assign/components/submission/submission.ts @@ -131,7 +131,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy { /** * Calculate the time remaining message and class. * - * @param {any} response Response of get submission status. + * @param response Response of get submission status. */ protected calculateTimeRemaining(response: any): void { if (this.assign.duedate > 0) { @@ -178,7 +178,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy { /** * Check if the user can leave the view. If there are changes to be saved, it will ask for confirm. * - * @return {Promise} Promise resolved if can leave the view, rejected otherwise. + * @return Promise resolved if can leave the view, rejected otherwise. */ canLeave(): Promise { // Check if there is data to save. @@ -252,7 +252,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy { /** * Discard feedback drafts. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected discardDrafts(): Promise { if (this.feedback && this.feedback.plugins) { @@ -277,7 +277,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy { /** * Check if there's data to save (grade). * - * @return {Promise} Promise resolved with boolean: whether there's data to save. + * @return Promise resolved with boolean: whether there's data to save. */ protected hasDataToSave(): Promise { if (!this.canSaveGrades || !this.loaded) { @@ -329,7 +329,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy { /** * Invalidate and refresh data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ invalidateAndRefresh(): Promise { this.loaded = false; @@ -363,7 +363,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy { /** * Load the data to render the submission. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected loadData(): Promise { let isBlind = !!this.blindId; @@ -458,8 +458,8 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy { /** * Load the data to render the feedback and grade. * - * @param {any} feedback The feedback data from the submission status. - * @return {Promise} Promise resolved when done. + * @param feedback The feedback data from the submission status. + * @return Promise resolved when done. */ protected loadFeedback(feedback: any): Promise { this.grade = { @@ -623,7 +623,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy { /** * Set the submission status name and class. * - * @param {any} status Submission status. + * @param status Submission status. */ protected setStatusNameAndClass(status: any): void { if (this.hasOffline || this.submittedOffline) { @@ -679,7 +679,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy { /** * Submit for grading. * - * @param {boolean} acceptStatement Whether the statement has been accepted. + * @param acceptStatement Whether the statement has been accepted. */ submitForGrading(acceptStatement: boolean): void { if (this.assign.requiresubmissionstatement && !acceptStatement) { @@ -712,7 +712,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy { /** * Submit a grade and feedback. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ submitGrade(): Promise { // Check if there's something to be saved. @@ -774,7 +774,7 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy { /** * Treat the grade info. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected treatGradeInfo(): Promise { // Check if grading method is simple or not. @@ -857,8 +857,8 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy { /** * Treat the last attempt. * - * @param {any} response Response of get submission status. - * @param {any[]} promises List where to add the promises. + * @param response Response of get submission status. + * @param promises List where to add the promises. */ protected treatLastAttempt(response: any, promises: any[]): void { if (!response.lastattempt) { diff --git a/src/addon/mod/assign/feedback/comments/component/comments.ts b/src/addon/mod/assign/feedback/comments/component/comments.ts index 910eec587..4a0edfac3 100644 --- a/src/addon/mod/assign/feedback/comments/component/comments.ts +++ b/src/addon/mod/assign/feedback/comments/component/comments.ts @@ -98,7 +98,7 @@ export class AddonModAssignFeedbackCommentsComponent extends AddonModAssignFeedb /** * Get the text for the plugin. * - * @return {Promise} Promise resolved with the text. + * @return Promise resolved with the text. */ protected getText(): Promise { // Check if the user already modified the comment. @@ -133,8 +133,8 @@ export class AddonModAssignFeedbackCommentsComponent extends AddonModAssignFeedb /** * Replace @@PLUGINFILE@@ wildcards with the real URL of embedded files. * - * @param {string} Text to treat. - * @return {string} Treated text. + * @param Text to treat. + * @return Treated text. */ replacePluginfileUrls(text: string): string { const files = this.plugin.fileareas && this.plugin.fileareas[0] && this.plugin.fileareas[0].files; diff --git a/src/addon/mod/assign/feedback/comments/providers/handler.ts b/src/addon/mod/assign/feedback/comments/providers/handler.ts index 55c003d9a..ef4e1655b 100644 --- a/src/addon/mod/assign/feedback/comments/providers/handler.ts +++ b/src/addon/mod/assign/feedback/comments/providers/handler.ts @@ -37,10 +37,10 @@ export class AddonModAssignFeedbackCommentsHandler implements AddonModAssignFeed /** * Discard the draft data of the feedback plugin. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assignId The assignment ID. + * @param userId User ID. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ discardDraft(assignId: number, userId: number, siteId?: string): void | Promise { const id = this.getDraftId(assignId, userId, siteId); @@ -53,9 +53,9 @@ export class AddonModAssignFeedbackCommentsHandler implements AddonModAssignFeed * Return the Component to use to display the plugin data, either in read or in edit mode. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} plugin The plugin object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param plugin The plugin object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any): any | Promise { return AddonModAssignFeedbackCommentsComponent; @@ -64,10 +64,10 @@ export class AddonModAssignFeedbackCommentsHandler implements AddonModAssignFeed /** * Return the draft saved data of the feedback plugin. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {any|Promise} Data (or promise resolved with the data). + * @param assignId The assignment ID. + * @param userId User ID. + * @param siteId Site ID. If not defined, current site. + * @return Data (or promise resolved with the data). */ getDraft(assignId: number, userId: number, siteId?: string): any | Promise { const id = this.getDraftId(assignId, userId, siteId); @@ -80,10 +80,10 @@ export class AddonModAssignFeedbackCommentsHandler implements AddonModAssignFeed /** * Get a draft ID. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {string} Draft ID. + * @param assignId The assignment ID. + * @param userId User ID. + * @param siteId Site ID. If not defined, current site. + * @return Draft ID. */ protected getDraftId(assignId: number, userId: number, siteId?: string): string { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -95,11 +95,11 @@ export class AddonModAssignFeedbackCommentsHandler implements AddonModAssignFeed * Get files used by this plugin. * The files returned by this function will be prefetched when the user prefetches the assign. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {any[]|Promise} The files (or promise resolved with the files). + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return The files (or promise resolved with the files). */ getPluginFiles(assign: any, submission: any, plugin: any, siteId?: string): any[] | Promise { return this.assignProvider.getSubmissionPluginAttachments(plugin); @@ -108,10 +108,10 @@ export class AddonModAssignFeedbackCommentsHandler implements AddonModAssignFeed /** * Get the text to submit. * - * @param {CoreTextUtilsProvider} textUtils Text utils instance. - * @param {any} plugin Plugin. - * @param {any} inputData Data entered in the feedback edit form. - * @return {string} Text to submit. + * @param textUtils Text utils instance. + * @param plugin Plugin. + * @param inputData Data entered in the feedback edit form. + * @return Text to submit. */ static getTextFromInputData(textUtils: CoreTextUtilsProvider, plugin: any, inputData: any): string { const files = plugin.fileareas && plugin.fileareas[0] ? plugin.fileareas[0].files : []; @@ -128,12 +128,12 @@ export class AddonModAssignFeedbackCommentsHandler implements AddonModAssignFeed /** * Check if the feedback data has changed for this plugin. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the feedback. - * @param {number} userId User ID of the submission. - * @return {boolean|Promise} Boolean (or promise resolved with boolean): whether the data has changed. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the feedback. + * @param userId User ID of the submission. + * @return Boolean (or promise resolved with boolean): whether the data has changed. */ hasDataChanged(assign: any, submission: any, plugin: any, inputData: any, userId: number): boolean | Promise { // Get it from plugin or offline. @@ -161,10 +161,10 @@ export class AddonModAssignFeedbackCommentsHandler implements AddonModAssignFeed /** * Check whether the plugin has draft data stored. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean|Promise} Boolean or promise resolved with boolean: whether the plugin has draft data. + * @param assignId The assignment ID. + * @param userId User ID. + * @param siteId Site ID. If not defined, current site. + * @return Boolean or promise resolved with boolean: whether the plugin has draft data. */ hasDraftData(assignId: number, userId: number, siteId?: string): boolean | Promise { const draft = this.getDraft(assignId, userId, siteId); @@ -175,7 +175,7 @@ export class AddonModAssignFeedbackCommentsHandler implements AddonModAssignFeed /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -184,12 +184,12 @@ export class AddonModAssignFeedbackCommentsHandler implements AddonModAssignFeed /** * Prepare and add to pluginData the data to send to the server based on the draft data saved. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {any} plugin The plugin object. - * @param {any} pluginData Object where to store the data to send. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assignId The assignment ID. + * @param userId User ID. + * @param plugin The plugin object. + * @param pluginData Object where to store the data to send. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ prepareFeedbackData(assignId: number, userId: number, plugin: any, pluginData: any, siteId?: string): void | Promise { const draft = this.getDraft(assignId, userId, siteId); @@ -205,12 +205,12 @@ export class AddonModAssignFeedbackCommentsHandler implements AddonModAssignFeed /** * Save draft data of the feedback plugin. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {any} plugin The plugin object. - * @param {any} data The data to save. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assignId The assignment ID. + * @param userId User ID. + * @param plugin The plugin object. + * @param data The data to save. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ saveDraft(assignId: number, userId: number, plugin: any, data: any, siteId?: string): void | Promise { if (data) { diff --git a/src/addon/mod/assign/feedback/editpdf/providers/handler.ts b/src/addon/mod/assign/feedback/editpdf/providers/handler.ts index 1758fb8fe..45276e932 100644 --- a/src/addon/mod/assign/feedback/editpdf/providers/handler.ts +++ b/src/addon/mod/assign/feedback/editpdf/providers/handler.ts @@ -32,9 +32,9 @@ export class AddonModAssignFeedbackEditPdfHandler implements AddonModAssignFeedb * Return the Component to use to display the plugin data, either in read or in edit mode. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} plugin The plugin object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param plugin The plugin object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any): any | Promise { return AddonModAssignFeedbackEditPdfComponent; @@ -44,11 +44,11 @@ export class AddonModAssignFeedbackEditPdfHandler implements AddonModAssignFeedb * Get files used by this plugin. * The files returned by this function will be prefetched when the user prefetches the assign. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {any[]|Promise} The files (or promise resolved with the files). + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return The files (or promise resolved with the files). */ getPluginFiles(assign: any, submission: any, plugin: any, siteId?: string): any[] | Promise { return this.assignProvider.getSubmissionPluginAttachments(plugin); @@ -57,7 +57,7 @@ export class AddonModAssignFeedbackEditPdfHandler implements AddonModAssignFeedb /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/mod/assign/feedback/file/providers/handler.ts b/src/addon/mod/assign/feedback/file/providers/handler.ts index fb3936a26..2d55cc35d 100644 --- a/src/addon/mod/assign/feedback/file/providers/handler.ts +++ b/src/addon/mod/assign/feedback/file/providers/handler.ts @@ -32,9 +32,9 @@ export class AddonModAssignFeedbackFileHandler implements AddonModAssignFeedback * Return the Component to use to display the plugin data, either in read or in edit mode. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} plugin The plugin object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param plugin The plugin object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any): any | Promise { return AddonModAssignFeedbackFileComponent; @@ -44,11 +44,11 @@ export class AddonModAssignFeedbackFileHandler implements AddonModAssignFeedback * Get files used by this plugin. * The files returned by this function will be prefetched when the user prefetches the assign. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {any[]|Promise} The files (or promise resolved with the files). + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return The files (or promise resolved with the files). */ getPluginFiles(assign: any, submission: any, plugin: any, siteId?: string): any[] | Promise { return this.assignProvider.getSubmissionPluginAttachments(plugin); @@ -57,7 +57,7 @@ export class AddonModAssignFeedbackFileHandler implements AddonModAssignFeedback /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/mod/assign/pages/edit-feedback-modal/edit-feedback-modal.ts b/src/addon/mod/assign/pages/edit-feedback-modal/edit-feedback-modal.ts index 08f2369bb..3c60de76e 100644 --- a/src/addon/mod/assign/pages/edit-feedback-modal/edit-feedback-modal.ts +++ b/src/addon/mod/assign/pages/edit-feedback-modal/edit-feedback-modal.ts @@ -47,7 +47,7 @@ export class AddonModAssignEditFeedbackModalPage { /** * Check if we can leave the page or not. * - * @return {boolean|Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { if (this.forceLeave) { @@ -64,7 +64,7 @@ export class AddonModAssignEditFeedbackModalPage { /** * Close modal. * - * @param {any} data Data to return to the page. + * @param data Data to return to the page. */ closeModal(data: any): void { this.viewCtrl.dismiss(data); @@ -73,7 +73,7 @@ export class AddonModAssignEditFeedbackModalPage { /** * Done editing. * - * @param {Event} e Click event. + * @param e Click event. */ done(e: Event): void { e.preventDefault(); @@ -87,7 +87,7 @@ export class AddonModAssignEditFeedbackModalPage { /** * Get the input data. * - * @return {any} Object with the data. + * @return Object with the data. */ protected getInputData(): any { return this.domUtils.getDataFromForm(document.forms['addon-mod_assign-edit-feedback-form']); @@ -96,7 +96,7 @@ export class AddonModAssignEditFeedbackModalPage { /** * Check if data has changed. * - * @return {Promise} Promise resolved with boolean: whether the data has changed. + * @return Promise resolved with boolean: whether the data has changed. */ protected hasDataChanged(): Promise { return this.feedbackDelegate.hasPluginDataChanged(this.assign, this.userId, this.plugin, this.getInputData(), this.userId) diff --git a/src/addon/mod/assign/pages/edit/edit.ts b/src/addon/mod/assign/pages/edit/edit.ts index f6072f48f..51f72b0a6 100644 --- a/src/addon/mod/assign/pages/edit/edit.ts +++ b/src/addon/mod/assign/pages/edit/edit.ts @@ -80,7 +80,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy { /** * Check if we can leave the page or not. * - * @return {boolean|Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { if (this.forceLeave) { @@ -101,7 +101,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy { /** * Fetch assignment data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchAssignment(): Promise { const currentUserId = this.sitesProvider.getCurrentSiteUserId(); @@ -175,7 +175,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy { /** * Get the input data. * - * @return {any} Input data. + * @return Input data. */ protected getInputData(): any { return this.domUtils.getDataFromForm(document.forms['addon-mod_assign-edit-form']); @@ -184,7 +184,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy { /** * Check if data has changed. * - * @return {Promise} Promise resolved with boolean: whether data has changed. + * @return Promise resolved with boolean: whether data has changed. */ protected hasDataChanged(): Promise { // Usually the hasSubmissionDataChanged call will be resolved inmediately, causing the modal to be shown just an instant. @@ -220,8 +220,8 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy { /** * Get data to submit based on the input data. * - * @param {any} inputData The input data. - * @return {Promise} Promise resolved with the data to submit. + * @param inputData The input data. + * @return Promise resolved with the data to submit. */ protected prepareSubmissionData(inputData: any): Promise { // If there's offline data, always save it in offline. @@ -263,7 +263,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy { /** * Save the submission. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected saveSubmission(): Promise { const inputData = this.getInputData(); diff --git a/src/addon/mod/assign/pages/index/index.ts b/src/addon/mod/assign/pages/index/index.ts index f9b960f67..3dedd405a 100644 --- a/src/addon/mod/assign/pages/index/index.ts +++ b/src/addon/mod/assign/pages/index/index.ts @@ -40,7 +40,7 @@ export class AddonModAssignIndexPage { /** * Update some data based on the assign instance. * - * @param {any} assign Assign instance. + * @param assign Assign instance. */ updateData(assign: any): void { this.title = assign.name || this.title; diff --git a/src/addon/mod/assign/pages/submission-list/submission-list.ts b/src/addon/mod/assign/pages/submission-list/submission-list.ts index a8bcf8c6d..9cc87c045 100644 --- a/src/addon/mod/assign/pages/submission-list/submission-list.ts +++ b/src/addon/mod/assign/pages/submission-list/submission-list.ts @@ -105,7 +105,7 @@ export class AddonModAssignSubmissionListPage implements OnInit, OnDestroy { /** * Fetch assignment data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchAssignment(): Promise { @@ -138,8 +138,8 @@ export class AddonModAssignSubmissionListPage implements OnInit, OnDestroy { /** * Set group to see the summary. * - * @param {number} groupId Group ID. - * @return {Promise} Resolved when done. + * @param groupId Group ID. + * @return Resolved when done. */ setGroup(groupId: number): Promise { this.groupId = groupId; @@ -242,7 +242,7 @@ export class AddonModAssignSubmissionListPage implements OnInit, OnDestroy { /** * Load a certain submission. * - * @param {any} submission The submission to load. + * @param submission The submission to load. */ loadSubmission(submission: any): void { if (this.selectedSubmissionId === submission.submitid && this.splitviewCtrl.isOn()) { @@ -263,7 +263,7 @@ export class AddonModAssignSubmissionListPage implements OnInit, OnDestroy { /** * Refresh all the data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected refreshAllData(): Promise { const promises = []; @@ -284,7 +284,7 @@ export class AddonModAssignSubmissionListPage implements OnInit, OnDestroy { /** * Refresh the list. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshList(refresher: any): void { this.refreshAllData().finally(() => { diff --git a/src/addon/mod/assign/pages/submission-review/submission-review.ts b/src/addon/mod/assign/pages/submission-review/submission-review.ts index 44b0ca4a9..a3652667d 100644 --- a/src/addon/mod/assign/pages/submission-review/submission-review.ts +++ b/src/addon/mod/assign/pages/submission-review/submission-review.ts @@ -67,7 +67,7 @@ export class AddonModAssignSubmissionReviewPage implements OnInit { /** * Check if we can leave the page or not. * - * @return {boolean|Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { if (!this.submissionComponent || this.forceLeave) { @@ -95,7 +95,7 @@ export class AddonModAssignSubmissionReviewPage implements OnInit { /** * Get the submission. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchSubmission(): Promise { return this.assignProvider.getAssignment(this.courseId, this.moduleId).then((assignment) => { @@ -123,7 +123,7 @@ export class AddonModAssignSubmissionReviewPage implements OnInit { /** * Refresh all the data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected refreshAllData(): Promise { const promises = []; @@ -146,7 +146,7 @@ export class AddonModAssignSubmissionReviewPage implements OnInit { /** * Refresh the data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshSubmission(refresher: any): void { this.refreshAllData().finally(() => { diff --git a/src/addon/mod/assign/providers/assign-offline.ts b/src/addon/mod/assign/providers/assign-offline.ts index 87d630837..f870bae6d 100644 --- a/src/addon/mod/assign/providers/assign-offline.ts +++ b/src/addon/mod/assign/providers/assign-offline.ts @@ -138,10 +138,10 @@ export class AddonModAssignOfflineProvider { /** * Delete a submission. * - * @param {number} assignId Assignment ID. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if deleted, rejected if failure. + * @param assignId Assignment ID. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if deleted, rejected if failure. */ deleteSubmission(assignId: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -155,10 +155,10 @@ export class AddonModAssignOfflineProvider { /** * Delete a submission grade. * - * @param {number} assignId Assignment ID. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if deleted, rejected if failure. + * @param assignId Assignment ID. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if deleted, rejected if failure. */ deleteSubmissionGrade(assignId: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -172,8 +172,8 @@ export class AddonModAssignOfflineProvider { /** * Get all the assignments ids that have something to be synced. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with assignments id that have something to be synced. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with assignments id that have something to be synced. */ getAllAssigns(siteId?: string): Promise { const promises = []; @@ -202,8 +202,8 @@ export class AddonModAssignOfflineProvider { /** * Get all the stored submissions from all the assignments. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -222,8 +222,8 @@ export class AddonModAssignOfflineProvider { /** * Get all the stored submissions grades from all the assignments. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with submissions grades. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with submissions grades. */ protected getAllSubmissionsGrade(siteId?: string): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -243,9 +243,9 @@ export class AddonModAssignOfflineProvider { /** * Get all the stored submissions for a certain assignment. * - * @param {number} assignId Assignment ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with submissions. + * @param assignId Assignment ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with submissions. */ getAssignSubmissions(assignId: number, siteId?: string): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -264,9 +264,9 @@ export class AddonModAssignOfflineProvider { /** * Get all the stored submissions grades for a certain assignment. * - * @param {number} assignId Assignment ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with submissions grades. + * @param assignId Assignment ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with submissions grades. */ getAssignSubmissionsGrade(assignId: number, siteId?: string): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -286,10 +286,10 @@ export class AddonModAssignOfflineProvider { /** * Get a stored submission. * - * @param {number} assignId Assignment ID. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with submission. + * @param assignId Assignment ID. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with submission. */ getSubmission(assignId: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -308,10 +308,10 @@ export class AddonModAssignOfflineProvider { /** * Get the path to the folder where to store files for an offline submission. * - * @param {number} assignId Assignment ID. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the path. + * @param assignId Assignment ID. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the path. */ getSubmissionFolder(assignId: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -328,10 +328,10 @@ export class AddonModAssignOfflineProvider { * Get a stored submission grade. * Submission grades are not identified using attempt number so it can retrieve the feedback for a previous attempt. * - * @param {number} assignId Assignment ID. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with submission grade. + * @param assignId Assignment ID. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with submission grade. */ getSubmissionGrade(assignId: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -352,11 +352,11 @@ export class AddonModAssignOfflineProvider { /** * Get the path to the folder where to store files for a certain plugin in an offline submission. * - * @param {number} assignId Assignment ID. - * @param {string} pluginName Name of the plugin. Must be unique (both in submission and feedback plugins). - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the path. + * @param assignId Assignment ID. + * @param pluginName Name of the plugin. Must be unique (both in submission and feedback plugins). + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the path. */ getSubmissionPluginFolder(assignId: number, pluginName: string, userId?: number, siteId?: string): Promise { return this.getSubmissionFolder(assignId, userId, siteId).then((folderPath) => { @@ -367,9 +367,9 @@ export class AddonModAssignOfflineProvider { /** * Check if the assignment has something to be synced. * - * @param {number} assignId Assignment ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether the assignment has something to be synced. + * @param assignId Assignment ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether the assignment has something to be synced. */ hasAssignOfflineData(assignId: number, siteId?: string): Promise { const promises = []; @@ -396,14 +396,14 @@ export class AddonModAssignOfflineProvider { /** * Mark/Unmark a submission as being submitted. * - * @param {number} assignId Assignment ID. - * @param {number} courseId Course ID the assign belongs to. - * @param {boolean} submitted True to mark as submitted, false to mark as not submitted. - * @param {boolean} acceptStatement True to accept the submission statement, false otherwise. - * @param {number} timemodified The time the submission was last modified in online. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if marked, rejected if failure. + * @param assignId Assignment ID. + * @param courseId Course ID the assign belongs to. + * @param submitted True to mark as submitted, false to mark as not submitted. + * @param acceptStatement True to accept the submission statement, false otherwise. + * @param timemodified The time the submission was last modified in online. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if marked, rejected if failure. */ markSubmitted(assignId: number, courseId: number, submitted: boolean, acceptStatement: boolean, timemodified: number, userId?: number, siteId?: string): Promise { @@ -438,14 +438,14 @@ export class AddonModAssignOfflineProvider { /** * Save a submission to be sent later. * - * @param {number} assignId Assignment ID. - * @param {number} courseId Course ID the assign belongs to. - * @param {any} pluginData Data to save. - * @param {number} timemodified The time the submission was last modified in online. - * @param {boolean} submitted True if submission has been submitted, false otherwise. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param assignId Assignment ID. + * @param courseId Course ID the assign belongs to. + * @param pluginData Data to save. + * @param timemodified The time the submission was last modified in online. + * @param submitted True if submission has been submitted, false otherwise. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ saveSubmission(assignId: number, courseId: number, pluginData: any, timemodified: number, submitted: boolean, userId?: number, siteId?: string): Promise { @@ -472,18 +472,18 @@ export class AddonModAssignOfflineProvider { /** * Save a grading to be sent later. * - * @param {number} assignId Assign ID. - * @param {number} userId User ID. - * @param {number} courseId Course ID the assign belongs to. - * @param {number} grade Grade to submit. - * @param {number} attemptNumber Number of the attempt being graded. - * @param {boolean} addAttempt Admit the user to attempt again. - * @param {string} workflowState Next workflow State. - * @param {boolean} applyToAll If it's a team submission, whether the grade applies to all group members. - * @param {any} outcomes Object including all outcomes values. If empty, any of them will be sent. - * @param {any} pluginData Plugin data to save. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param assignId Assign ID. + * @param userId User ID. + * @param courseId Course ID the assign belongs to. + * @param grade Grade to submit. + * @param attemptNumber Number of the attempt being graded. + * @param addAttempt Admit the user to attempt again. + * @param workflowState Next workflow State. + * @param applyToAll If it's a team submission, whether the grade applies to all group members. + * @param outcomes Object including all outcomes values. If empty, any of them will be sent. + * @param pluginData Plugin data to save. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ submitGradingForm(assignId: number, userId: number, courseId: number, grade: number, attemptNumber: number, addAttempt: boolean, workflowState: string, applyToAll: boolean, outcomes: any, pluginData: any, siteId?: string): Promise { diff --git a/src/addon/mod/assign/providers/assign-sync.ts b/src/addon/mod/assign/providers/assign-sync.ts index 049b44ba3..60967dc07 100644 --- a/src/addon/mod/assign/providers/assign-sync.ts +++ b/src/addon/mod/assign/providers/assign-sync.ts @@ -36,13 +36,11 @@ import { AddonModAssignSubmissionDelegate } from './submission-delegate'; export interface AddonModAssignSyncResult { /** * List of warnings. - * @type {string[]} */ warnings: string[]; /** * Whether data was updated in the site. - * @type {boolean} */ updated: boolean; } @@ -74,9 +72,9 @@ export class AddonModAssignSyncProvider extends CoreSyncBaseProvider { /** * Convenience function to get scale selected option. * - * @param {string} options Possible options. - * @param {number} selected Selected option to search. - * @return {number} Index of the selected option. + * @param options Possible options. + * @param selected Selected option to search. + * @return Index of the selected option. */ protected getSelectedScaleId(options: string, selected: string): number { let optionsList = options.split(','); @@ -98,9 +96,9 @@ export class AddonModAssignSyncProvider extends CoreSyncBaseProvider { /** * Check if an assignment has data to synchronize. * - * @param {number} assignId Assign ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether it has data to sync. + * @param assignId Assign ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether it has data to sync. */ hasDataToSync(assignId: number, siteId?: string): Promise { return this.assignOfflineProvider.hasAssignOfflineData(assignId, siteId); @@ -109,9 +107,9 @@ export class AddonModAssignSyncProvider extends CoreSyncBaseProvider { /** * Try to synchronize all the assignments in a certain site or in all sites. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} force Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncAllAssignments(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all assignments', this.syncAllAssignmentsFunc.bind(this), [force], siteId); @@ -120,9 +118,9 @@ export class AddonModAssignSyncProvider extends CoreSyncBaseProvider { /** * Sync all assignments on a site. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @param {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @param Promise resolved if sync is successful, rejected if sync fails. */ protected syncAllAssignmentsFunc(siteId?: string, force?: boolean): Promise { // Get all assignments that have offline data. @@ -149,9 +147,9 @@ export class AddonModAssignSyncProvider extends CoreSyncBaseProvider { /** * Sync an assignment only if a certain time has passed since the last time. * - * @param {number} assignId Assign ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the assign is synced or it doesn't need to be synced. + * @param assignId Assign ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the assign is synced or it doesn't need to be synced. */ syncAssignIfNeeded(assignId: number, siteId?: string): Promise { return this.isSyncNeeded(assignId, siteId).then((needed) => { @@ -164,9 +162,9 @@ export class AddonModAssignSyncProvider extends CoreSyncBaseProvider { /** * Try to synchronize an assign. * - * @param {number} assignId Assign ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success. + * @param assignId Assign ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success. */ syncAssign(assignId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -265,11 +263,11 @@ export class AddonModAssignSyncProvider extends CoreSyncBaseProvider { /** * Synchronize a submission. * - * @param {any} assign Assignment. - * @param {any} offlineData Submission offline data. - * @param {string[]} warnings List of warnings. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success, rejected otherwise. + * @param assign Assignment. + * @param offlineData Submission offline data. + * @param warnings List of warnings. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success, rejected otherwise. */ protected syncSubmission(assign: any, offlineData: any, warnings: string[], siteId?: string): Promise { const userId = offlineData.userid, @@ -353,12 +351,12 @@ export class AddonModAssignSyncProvider extends CoreSyncBaseProvider { /** * Synchronize a submission grade. * - * @param {any} assign Assignment. - * @param {any} offlineData Submission grade offline data. - * @param {string[]} warnings List of warnings. - * @param {number} courseId Course Id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success, rejected otherwise. + * @param assign Assignment. + * @param offlineData Submission grade offline data. + * @param warnings List of warnings. + * @param courseId Course Id. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success, rejected otherwise. */ protected syncSubmissionGrade(assign: any, offlineData: any, warnings: string[], courseId: number, siteId?: string) : Promise { diff --git a/src/addon/mod/assign/providers/assign.ts b/src/addon/mod/assign/providers/assign.ts index 26c6ecf41..e819751a6 100644 --- a/src/addon/mod/assign/providers/assign.ts +++ b/src/addon/mod/assign/providers/assign.ts @@ -78,9 +78,9 @@ export class AddonModAssignProvider { * be used (offline usage). * This function doesn't check if the submission is empty, it should be checked before calling this function. * - * @param {any} assign Assignment instance. - * @param {any} submissionStatus Submission status returned by getSubmissionStatus. - * @return {boolean} Whether it can submit. + * @param assign Assignment instance. + * @param submissionStatus Submission status returned by getSubmissionStatus. + * @return Whether it can submit. */ canSubmitOffline(assign: any, submissionStatus: any): boolean { if (!this.isSubmissionOpen(assign, submissionStatus)) { @@ -117,11 +117,11 @@ export class AddonModAssignProvider { /** * Get an assignment by course module ID. * - * @param {number} courseId Course ID the assignment belongs to. - * @param {number} cmId Assignment module ID. - * @param {boolean} [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. - * @return {Promise} Promise resolved with the assignment. + * @param courseId Course ID the assignment belongs to. + * @param cmId Assignment module ID. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the assignment. */ getAssignment(courseId: number, cmId: number, ignoreCache?: boolean, siteId?: string): Promise { return this.getAssignmentByField(courseId, 'cmid', cmId, ignoreCache, siteId); @@ -130,12 +130,12 @@ export class AddonModAssignProvider { /** * Get an assigment with key=value. If more than one is found, only the first will be returned. * - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {boolean} [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. - * @return {Promise} Promise resolved when the assignment is retrieved. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the assignment is retrieved. */ protected getAssignmentByField(courseId: number, key: string, value: any, ignoreCache?: boolean, siteId?: string) : Promise { @@ -181,11 +181,11 @@ export class AddonModAssignProvider { /** * Get an assignment by instance ID. * - * @param {number} courseId Course ID the assignment belongs to. - * @param {number} cmId Assignment instance ID. - * @param {boolean} [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. - * @return {Promise} Promise resolved with the assignment. + * @param courseId Course ID the assignment belongs to. + * @param cmId Assignment instance ID. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the assignment. */ getAssignmentById(courseId: number, id: number, ignoreCache?: boolean, siteId?: string): Promise { return this.getAssignmentByField(courseId, 'id', id, ignoreCache, siteId); @@ -194,8 +194,8 @@ export class AddonModAssignProvider { /** * Get cache key for assignment data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getAssignmentCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'assignment:' + courseId; @@ -204,11 +204,11 @@ export class AddonModAssignProvider { /** * Get an assignment user mapping for blind marking. * - * @param {number} assignId Assignment Id. - * @param {number} userId User Id to be blinded. - * @param {boolean} [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. - * @return {Promise} Promise resolved with the user blind id. + * @param assignId Assignment Id. + * @param userId User Id to be blinded. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the user blind id. */ getAssignmentUserMappings(assignId: number, userId: number, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -256,8 +256,8 @@ export class AddonModAssignProvider { /** * Get cache key for assignment user mappings data WS calls. * - * @param {number} assignId Assignment ID. - * @return {string} Cache key. + * @param assignId Assignment ID. + * @return Cache key. */ protected getAssignmentUserMappingsCacheKey(assignId: number): string { return this.ROOT_CACHE_KEY + 'usermappings:' + assignId; @@ -266,10 +266,10 @@ export class AddonModAssignProvider { /** * Returns grade information from assign_grades for the requested assignment id * - * @param {number} assignId Assignment Id. - * @param {boolean} [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. - * @return {Promise} Resolved with requested info when done. + * @param assignId Assignment Id. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Resolved with requested info when done. */ getAssignmentGrades(assignId: number, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -310,8 +310,8 @@ export class AddonModAssignProvider { /** * Get cache key for assignment grades data WS calls. * - * @param {number} assignId Assignment ID. - * @return {string} Cache key. + * @param assignId Assignment ID. + * @return Cache key. */ protected getAssignmentGradesCacheKey(assignId: number): string { return this.ROOT_CACHE_KEY + 'assigngrades:' + assignId; @@ -320,8 +320,8 @@ export class AddonModAssignProvider { /** * Returns the color name for a given grading status name. * - * @param {string} status Grading status name - * @return {string} The color name. + * @param status Grading status name + * @return The color name. */ getSubmissionGradingStatusColor(status: string): string { if (!status) { @@ -339,8 +339,8 @@ export class AddonModAssignProvider { /** * Returns the translation id for a given grading status name. * - * @param {string} status Grading Status name - * @return {string} The status translation identifier. + * @param status Grading Status name + * @return The status translation identifier. */ getSubmissionGradingStatusTranslationId(status: string): string { if (!status) { @@ -358,9 +358,9 @@ export class AddonModAssignProvider { /** * Get the submission object from an attempt. * - * @param {any} assign Assign. - * @param {any} attempt Attempt. - * @return {any} Submission object or null. + * @param assign Assign. + * @param attempt Attempt. + * @return Submission object or null. */ getSubmissionObjectFromAttempt(assign: any, attempt: any): any { if (!attempt) { @@ -373,8 +373,8 @@ export class AddonModAssignProvider { /** * Get attachments of a submission plugin. * - * @param {any} submissionPlugin Submission plugin. - * @return {any[]} Submission plugin attachments. + * @param submissionPlugin Submission plugin. + * @return Submission plugin attachments. */ getSubmissionPluginAttachments(submissionPlugin: any): any[] { const files = []; @@ -403,9 +403,9 @@ export class AddonModAssignProvider { /** * Get text of a submission plugin. * - * @param {any} submissionPlugin Submission plugin. - * @param {boolean} [keepUrls] True if it should keep original URLs, false if they should be replaced. - * @return {string} Submission text. + * @param submissionPlugin Submission plugin. + * @param keepUrls True if it should keep original URLs, false if they should be replaced. + * @return Submission text. */ getSubmissionPluginText(submissionPlugin: any, keepUrls?: boolean): string { let text = ''; @@ -426,10 +426,10 @@ export class AddonModAssignProvider { /** * Get an assignment submissions. * - * @param {number} assignId Assignment id. - * @param {boolean} [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. - * @return {Promise<{canviewsubmissions: boolean, submissions?: any[]}>} Promise resolved when done. + * @param assignId Assignment id. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ getSubmissions(assignId: number, ignoreCache?: boolean, siteId?: string) : Promise<{canviewsubmissions: boolean, submissions?: any[]}> { @@ -469,8 +469,8 @@ export class AddonModAssignProvider { /** * Get cache key for assignment submissions data WS calls. * - * @param {number} assignId Assignment id. - * @return {string} Cache key. + * @param assignId Assignment id. + * @return Cache key. */ protected getSubmissionsCacheKey(assignId: number): string { return this.ROOT_CACHE_KEY + 'submissions:' + assignId; @@ -479,14 +479,14 @@ export class AddonModAssignProvider { /** * Get information about an assignment submission status for a given user. * - * @param {number} assignId Assignment instance id. - * @param {number} [userId] User Id (empty for current user). - * @param {number} [groupId] Group Id (empty for all participants). - * @param {boolean} [isBlind] If blind marking is enabled or not. - * @param {number} [filter=true] True to filter WS response and rewrite URLs, false otherwise. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site id (empty for current site). - * @return {Promise} Promise always resolved with the user submission status. + * @param assignId Assignment instance id. + * @param userId User Id (empty for current user). + * @param groupId Group Id (empty for all participants). + * @param isBlind If blind marking is enabled or not. + * @param filter True to filter WS response and rewrite URLs, false otherwise. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site id (empty for current site). + * @return Promise always resolved with the user submission status. */ getSubmissionStatus(assignId: number, userId?: number, groupId?: number, isBlind?: boolean, filter: boolean = true, ignoreCache?: boolean, siteId?: string): Promise { @@ -530,14 +530,14 @@ export class AddonModAssignProvider { * Get information about an assignment submission status for a given user. * If the data doesn't include the user submission, retry ignoring cache. * - * @param {any} assign Assignment. - * @param {number} [userId] User id (empty for current user). - * @param {number} [groupId] Group Id (empty for all participants). - * @param {boolean} [isBlind] If blind marking is enabled or not. - * @param {number} [filter=true] True to filter WS response and rewrite URLs, false otherwise. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site id (empty for current site). - * @return {Promise} Promise always resolved with the user submission status. + * @param assign Assignment. + * @param userId User id (empty for current user). + * @param groupId Group Id (empty for all participants). + * @param isBlind If blind marking is enabled or not. + * @param filter True to filter WS response and rewrite URLs, false otherwise. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site id (empty for current site). + * @return Promise always resolved with the user submission status. */ getSubmissionStatusWithRetry(assign: any, userId?: number, groupId?: number, isBlind?: boolean, filter: boolean = true, ignoreCache?: boolean, siteId?: string): Promise { @@ -560,11 +560,11 @@ export class AddonModAssignProvider { /** * Get cache key for get submission status data WS calls. * - * @param {number} assignId Assignment instance id. - * @param {number} [userId] User id (empty for current user). - * @param {number} [groupId] Group Id (empty for all participants). - * @param {number} [isBlind] If blind marking is enabled or not. - * @return {string} Cache key. + * @param assignId Assignment instance id. + * @param userId User id (empty for current user). + * @param groupId Group Id (empty for all participants). + * @param isBlind If blind marking is enabled or not. + * @return Cache key. */ protected getSubmissionStatusCacheKey(assignId: number, userId: number, groupId?: number, isBlind?: boolean): string { if (!userId) { @@ -578,8 +578,8 @@ export class AddonModAssignProvider { /** * Returns the color name for a given status name. * - * @param {string} status Status name - * @return {string} The color name. + * @param status Status name + * @return The color name. */ getSubmissionStatusColor(status: string): string { switch (status) { @@ -601,8 +601,8 @@ export class AddonModAssignProvider { /** * Given a list of plugins, returns the plugin names that aren't supported for editing. * - * @param {any[]} plugins Plugins to check. - * @return {Promise} Promise resolved with unsupported plugin names. + * @param plugins Plugins to check. + * @return Promise resolved with unsupported plugin names. */ getUnsupportedEditPlugins(plugins: any[]): Promise { const notSupported = [], @@ -624,11 +624,11 @@ export class AddonModAssignProvider { /** * List the participants for a single assignment, with some summary info about their submissions. * - * @param {number} assignId Assignment id. - * @param {number} [groupId] Group id. If not defined, 0. - * @param {boolean} [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. - * @return {Promise} Promise resolved with the list of participants and summary of submissions. + * @param assignId Assignment id. + * @param groupId Group id. If not defined, 0. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of participants and summary of submissions. */ listParticipants(assignId: number, groupId?: number, ignoreCache?: boolean, siteId?: string): Promise { groupId = groupId || 0; @@ -661,9 +661,9 @@ export class AddonModAssignProvider { /** * Get cache key for assignment list participants data WS calls. * - * @param {number} assignId Assignment id. - * @param {number} groupId Group id. - * @return {string} Cache key. + * @param assignId Assignment id. + * @param groupId Group id. + * @return Cache key. */ protected listParticipantsCacheKey(assignId: number, groupId: number): string { return this.listParticipantsPrefixCacheKey(assignId) + ':' + groupId; @@ -672,8 +672,8 @@ export class AddonModAssignProvider { /** * Get prefix cache key for assignment list participants data WS calls. * - * @param {number} assignId Assignment id. - * @return {string} Cache key. + * @param assignId Assignment id. + * @return Cache key. */ protected listParticipantsPrefixCacheKey(assignId: number): string { return this.ROOT_CACHE_KEY + 'participants:' + assignId; @@ -682,9 +682,9 @@ export class AddonModAssignProvider { /** * Invalidates all submission status data. * - * @param {number} assignId Assignment instance id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param assignId Assignment instance id. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAllSubmissionData(assignId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -695,9 +695,9 @@ export class AddonModAssignProvider { /** * Invalidates assignment data WS calls. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAssignmentData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -708,9 +708,9 @@ export class AddonModAssignProvider { /** * Invalidates assignment user mappings data WS calls. * - * @param {number} assignId Assignment ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param assignId Assignment ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAssignmentUserMappingsData(assignId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -721,9 +721,9 @@ export class AddonModAssignProvider { /** * Invalidates assignment grades data WS calls. * - * @param {number} assignId Assignment ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param assignId Assignment ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAssignmentGradesData(assignId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -735,10 +735,10 @@ export class AddonModAssignProvider { * Invalidate the prefetched content except files. * To invalidate files, use AddonModAssignProvider.invalidateFiles. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -762,8 +762,8 @@ export class AddonModAssignProvider { /** * Invalidate the prefetched files. * - * @param {number} moduleId The module ID. - * @return {Promise} Promise resolved when the files are invalidated. + * @param moduleId The module ID. + * @return Promise resolved when the files are invalidated. */ invalidateFiles(moduleId: number): Promise { return this.filepoolProvider.invalidateFilesByComponent(this.sitesProvider.getCurrentSiteId(), @@ -773,9 +773,9 @@ export class AddonModAssignProvider { /** * Invalidates assignment submissions data WS calls. * - * @param {number} assignId Assignment instance id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param assignId Assignment instance id. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateSubmissionData(assignId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -786,12 +786,12 @@ export class AddonModAssignProvider { /** * Invalidates submission status data. * - * @param {number} assignId Assignment instance id. - * @param {number} [userId] User id (empty for current user). - * @param {number} [groupId] Group Id (empty for all participants). - * @param {boolean} [isBlind] Whether blind marking is enabled or not. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param assignId Assignment instance id. + * @param userId User id (empty for current user). + * @param groupId Group Id (empty for all participants). + * @param isBlind Whether blind marking is enabled or not. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateSubmissionStatusData(assignId: number, userId?: number, groupId?: number, isBlind?: boolean, siteId?: string): Promise { @@ -803,9 +803,9 @@ export class AddonModAssignProvider { /** * Invalidates assignment participants data. * - * @param {number} assignId Assignment instance id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param assignId Assignment instance id. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateListParticipantsData(assignId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -816,8 +816,8 @@ export class AddonModAssignProvider { /** * Convenience function to check if grading offline is enabled. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether grading offline is enabled. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether grading offline is enabled. */ protected isGradingOfflineEnabled(siteId?: string): Promise { if (typeof this.gradingOfflineEnabled[siteId] != 'undefined') { @@ -834,8 +834,8 @@ export class AddonModAssignProvider { /** * Outcomes only can be edited if mod_assign_submit_grading_form is avalaible. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if outcomes edit is enabled, rejected or resolved with false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if outcomes edit is enabled, rejected or resolved with false otherwise. * @since 3.2 */ isOutcomesEditEnabled(siteId?: string): Promise { @@ -847,8 +847,8 @@ export class AddonModAssignProvider { /** * Check if assignments plugin is enabled in a certain site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean} Whether the plugin is enabled. + * @param siteId Site ID. If not defined, current site. + * @return Whether the plugin is enabled. */ isPluginEnabled(siteId?: string): boolean { return true; @@ -857,9 +857,9 @@ export class AddonModAssignProvider { /** * Check if a submission is open. This function is based on Moodle's submissions_open. * - * @param {any} assign Assignment instance. - * @param {any} submissionStatus Submission status returned by getSubmissionStatus. - * @return {boolean} Whether submission is open. + * @param assign Assignment instance. + * @param submissionStatus Submission status returned by getSubmissionStatus. + * @return Whether submission is open. */ isSubmissionOpen(assign: any, submissionStatus: any): boolean { if (!assign || !submissionStatus) { @@ -914,10 +914,10 @@ export class AddonModAssignProvider { /** * Report an assignment submission as being viewed. * - * @param {number} assignId Assignment ID. - * @param {string} [name] Name of the assign. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param assignId Assignment ID. + * @param name Name of the assign. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logSubmissionView(assignId: number, name?: string, siteId?: string): Promise { @@ -934,10 +934,10 @@ export class AddonModAssignProvider { /** * Report an assignment grading table is being viewed. * - * @param {number} assignId Assignment ID. - * @param {string} [name] Name of the assign. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param assignId Assignment ID. + * @param name Name of the assign. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logGradingView(assignId: number, name?: string, siteId?: string): Promise { const params = { @@ -951,10 +951,10 @@ export class AddonModAssignProvider { /** * Report an assign as being viewed. * - * @param {number} assignId Assignment ID. - * @param {string} [name] Name of the assign. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param assignId Assignment ID. + * @param name Name of the assign. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(assignId: number, name?: string, siteId?: string): Promise { const params = { @@ -968,9 +968,9 @@ export class AddonModAssignProvider { /** * Returns if a submissions needs to be graded. * - * @param {any} submission Submission. - * @param {number} assignId Assignment ID. - * @return {Promise} Promise resolved with boolean: whether it needs to be graded or not. + * @param submission Submission. + * @param assignId Assignment ID. + * @return Promise resolved with boolean: whether it needs to be graded or not. */ needsSubmissionToBeGraded(submission: any, assignId: number): Promise { if (!submission.gradingstatus) { @@ -999,15 +999,15 @@ export class AddonModAssignProvider { /** * Save current user submission for a certain assignment. * - * @param {number} assignId Assign ID. - * @param {number} courseId Course ID the assign belongs to. - * @param {any} pluginData Data to save. - * @param {boolean} allowOffline Whether to allow offline usage. - * @param {number} timemodified The time the submission was last modified in online. - * @param {boolean} [allowsDrafts] Whether the assignment allows submission drafts. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if sent to server, resolved with false if stored in offline. + * @param assignId Assign ID. + * @param courseId Course ID the assign belongs to. + * @param pluginData Data to save. + * @param allowOffline Whether to allow offline usage. + * @param timemodified The time the submission was last modified in online. + * @param allowsDrafts Whether the assignment allows submission drafts. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if sent to server, resolved with false if stored in offline. */ saveSubmission(assignId: number, courseId: number, pluginData: any, allowOffline: boolean, timemodified: number, allowsDrafts?: boolean, userId?: number, siteId?: string): Promise { @@ -1046,10 +1046,10 @@ export class AddonModAssignProvider { /** * Save current user submission for a certain assignment. It will fail if offline or cannot connect. * - * @param {number} assignId Assign ID. - * @param {any} pluginData Data to save. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when saved, rejected otherwise. + * @param assignId Assign ID. + * @param pluginData Data to save. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when saved, rejected otherwise. */ saveSubmissionOnline(assignId: number, pluginData: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1070,13 +1070,13 @@ export class AddonModAssignProvider { /** * Submit the current user assignment for grading. * - * @param {number} assignId Assign ID. - * @param {number} courseId Course ID the assign belongs to. - * @param {boolean} acceptStatement True if submission statement is accepted, false otherwise. - * @param {number} timemodified The time the submission was last modified in online. - * @param {boolean} [forceOffline] True to always mark it in offline. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if sent to server, resolved with false if stored in offline. + * @param assignId Assign ID. + * @param courseId Course ID the assign belongs to. + * @param acceptStatement True if submission statement is accepted, false otherwise. + * @param timemodified The time the submission was last modified in online. + * @param forceOffline True to always mark it in offline. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if sent to server, resolved with false if stored in offline. */ submitForGrading(assignId: number, courseId: number, acceptStatement: boolean, timemodified: number, forceOffline?: boolean, siteId?: string): Promise { @@ -1115,10 +1115,10 @@ export class AddonModAssignProvider { /** * Submit the current user assignment for grading. It will fail if offline or cannot connect. * - * @param {number} assignId Assign ID. - * @param {boolean} acceptStatement True if submission statement is accepted, false otherwise. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when submitted, rejected otherwise. + * @param assignId Assign ID. + * @param acceptStatement True if submission statement is accepted, false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when submitted, rejected otherwise. */ submitForGradingOnline(assignId: number, acceptStatement: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1139,18 +1139,18 @@ export class AddonModAssignProvider { /** * Submit the grading for the current user and assignment. It will use old or new WS depending on availability. * - * @param {number} assignId Assign ID. - * @param {number} userId User ID. - * @param {number} courseId Course ID the assign belongs to. - * @param {number} grade Grade to submit. - * @param {number} attemptNumber Number of the attempt being graded. - * @param {boolean} addAttempt Admit the user to attempt again. - * @param {string} workflowState Next workflow State. - * @param {boolean} applyToAll If it's a team submission, whether the grade applies to all group members. - * @param {any} outcomes Object including all outcomes values. If empty, any of them will be sent. - * @param {any} pluginData Feedback plugin data to save. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if sent to server, resolved with false if stored offline. + * @param assignId Assign ID. + * @param userId User ID. + * @param courseId Course ID the assign belongs to. + * @param grade Grade to submit. + * @param attemptNumber Number of the attempt being graded. + * @param addAttempt Admit the user to attempt again. + * @param workflowState Next workflow State. + * @param applyToAll If it's a team submission, whether the grade applies to all group members. + * @param outcomes Object including all outcomes values. If empty, any of them will be sent. + * @param pluginData Feedback plugin data to save. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if sent to server, resolved with false if stored offline. */ submitGradingForm(assignId: number, userId: number, courseId: number, grade: number, attemptNumber: number, addAttempt: boolean, workflowState: string, applyToAll: boolean, outcomes: any, pluginData: any, siteId?: string): Promise { @@ -1199,17 +1199,17 @@ export class AddonModAssignProvider { * Submit the grading for the current user and assignment. It will use old or new WS depending on availability. * It will fail if offline or cannot connect. * - * @param {number} assignId Assign ID. - * @param {number} userId User ID. - * @param {number} grade Grade to submit. - * @param {number} attemptNumber Number of the attempt being graded. - * @param {number} addAttempt Allow the user to attempt again. - * @param {string} workflowState Next workflow State. - * @param {boolean} applyToAll If it's a team submission, if the grade applies to all group members. - * @param {any} outcomes Object including all outcomes values. If empty, any of them will be sent. - * @param {any} pluginData Feedback plugin data to save. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when submitted, rejected otherwise. + * @param assignId Assign ID. + * @param userId User ID. + * @param grade Grade to submit. + * @param attemptNumber Number of the attempt being graded. + * @param addAttempt Allow the user to attempt again. + * @param workflowState Next workflow State. + * @param applyToAll If it's a team submission, if the grade applies to all group members. + * @param outcomes Object including all outcomes values. If empty, any of them will be sent. + * @param pluginData Feedback plugin data to save. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when submitted, rejected otherwise. */ submitGradingFormOnline(assignId: number, userId: number, grade: number, attemptNumber: number, addAttempt: boolean, workflowState: string, applyToAll: boolean, outcomes: any, pluginData: any, siteId?: string): Promise { diff --git a/src/addon/mod/assign/providers/feedback-delegate.ts b/src/addon/mod/assign/providers/feedback-delegate.ts index 6598bf4e9..c72dda969 100644 --- a/src/addon/mod/assign/providers/feedback-delegate.ts +++ b/src/addon/mod/assign/providers/feedback-delegate.ts @@ -26,17 +26,16 @@ export interface AddonModAssignFeedbackHandler extends CoreDelegateHandler { /** * Name of the type of feedback the handler supports. E.g. 'file'. - * @type {string} */ type: string; /** * Discard the draft data of the feedback plugin. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assignId The assignment ID. + * @param userId User ID. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ discardDraft?(assignId: number, userId: number, siteId?: string): void | Promise; @@ -44,19 +43,19 @@ export interface AddonModAssignFeedbackHandler extends CoreDelegateHandler { * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} plugin The plugin object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param plugin The plugin object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent?(injector: Injector, plugin: any): any | Promise; /** * Return the draft saved data of the feedback plugin. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {any|Promise} Data (or promise resolved with the data). + * @param assignId The assignment ID. + * @param userId User ID. + * @param siteId Site ID. If not defined, current site. + * @return Data (or promise resolved with the data). */ getDraft?(assignId: number, userId: number, siteId?: string): any | Promise; @@ -64,41 +63,41 @@ export interface AddonModAssignFeedbackHandler extends CoreDelegateHandler { * Get files used by this plugin. * The files returned by this function will be prefetched when the user prefetches the assign. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {any[]|Promise} The files (or promise resolved with the files). + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return The files (or promise resolved with the files). */ getPluginFiles?(assign: any, submission: any, plugin: any, siteId?: string): any[] | Promise; /** * Get a readable name to use for the plugin. * - * @param {any} plugin The plugin object. - * @return {string} The plugin name. + * @param plugin The plugin object. + * @return The plugin name. */ getPluginName?(plugin: any): string; /** * Check if the feedback data has changed for this plugin. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the feedback. - * @param {number} userId User ID of the submission. - * @return {boolean|Promise} Boolean (or promise resolved with boolean): whether the data has changed. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the feedback. + * @param userId User ID of the submission. + * @return Boolean (or promise resolved with boolean): whether the data has changed. */ hasDataChanged?(assign: any, submission: any, plugin: any, inputData: any, userId: number): boolean | Promise; /** * Check whether the plugin has draft data stored. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean|Promise} Boolean or promise resolved with boolean: whether the plugin has draft data. + * @param assignId The assignment ID. + * @param userId User ID. + * @param siteId Site ID. If not defined, current site. + * @return Boolean or promise resolved with boolean: whether the plugin has draft data. */ hasDraftData?(assignId: number, userId: number, siteId?: string): boolean | Promise; @@ -106,35 +105,35 @@ export interface AddonModAssignFeedbackHandler extends CoreDelegateHandler { * Prefetch any required data for the plugin. * This should NOT prefetch files. Files to be prefetched should be returned by the getPluginFiles function. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ prefetch?(assign: any, submission: any, plugin: any, siteId?: string): Promise; /** * Prepare and add to pluginData the data to send to the server based on the draft data saved. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {any} plugin The plugin object. - * @param {any} pluginData Object where to store the data to send. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assignId The assignment ID. + * @param userId User ID. + * @param plugin The plugin object. + * @param pluginData Object where to store the data to send. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ prepareFeedbackData?(assignId: number, userId: number, plugin: any, pluginData: any, siteId?: string): void | Promise; /** * Save draft data of the feedback plugin. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {any} plugin The plugin object. - * @param {any} data The data to save. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assignId The assignment ID. + * @param userId User ID. + * @param plugin The plugin object. + * @param data The data to save. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ saveDraft?(assignId: number, userId: number, plugin: any, data: any, siteId?: string): void | Promise; } @@ -155,11 +154,11 @@ export class AddonModAssignFeedbackDelegate extends CoreDelegate { /** * Discard the draft data of the feedback plugin. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param assignId The assignment ID. + * @param userId User ID. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ discardPluginFeedbackData(assignId: number, userId: number, plugin: any, siteId?: string): Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'discardDraft', [assignId, userId, siteId])); @@ -168,9 +167,9 @@ export class AddonModAssignFeedbackDelegate extends CoreDelegate { /** * Get the component to use for a certain feedback plugin. * - * @param {Injector} injector Injector. - * @param {any} plugin The plugin object. - * @return {Promise} Promise resolved with the component to use, undefined if not found. + * @param injector Injector. + * @param plugin The plugin object. + * @return Promise resolved with the component to use, undefined if not found. */ getComponentForPlugin(injector: Injector, plugin: any): Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'getComponent', [injector, plugin])); @@ -179,11 +178,11 @@ export class AddonModAssignFeedbackDelegate extends CoreDelegate { /** * Return the draft saved data of the feedback plugin. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the draft data. + * @param assignId The assignment ID. + * @param userId User ID. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the draft data. */ getPluginDraftData(assignId: number, userId: number, plugin: any, siteId?: string): Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'getDraft', [assignId, userId, siteId])); @@ -193,11 +192,11 @@ export class AddonModAssignFeedbackDelegate extends CoreDelegate { * Get files used by this plugin. * The files returned by this function will be prefetched when the user prefetches the assign. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the files. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the files. */ getPluginFiles(assign: any, submission: any, plugin: any, siteId?: string): Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'getPluginFiles', [assign, submission, plugin, siteId])); @@ -206,8 +205,8 @@ export class AddonModAssignFeedbackDelegate extends CoreDelegate { /** * Get a readable name to use for a certain feedback plugin. * - * @param {any} plugin Plugin to get the name for. - * @return {string} Human readable name. + * @param plugin Plugin to get the name for. + * @return Human readable name. */ getPluginName(plugin: any): string { return this.executeFunctionOnEnabled(plugin.type, 'getPluginName', [plugin]); @@ -216,12 +215,12 @@ export class AddonModAssignFeedbackDelegate extends CoreDelegate { /** * Check if the feedback data has changed for a certain plugin. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the feedback. - * @param {number} userId User ID of the submission. - * @return {Promise} Promise resolved with true if data has changed, resolved with false otherwise. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the feedback. + * @param userId User ID of the submission. + * @return Promise resolved with true if data has changed, resolved with false otherwise. */ hasPluginDataChanged(assign: any, submission: any, plugin: any, inputData: any, userId: number): Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'hasDataChanged', @@ -231,11 +230,11 @@ export class AddonModAssignFeedbackDelegate extends CoreDelegate { /** * Check whether the plugin has draft data stored. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if it has draft data. + * @param assignId The assignment ID. + * @param userId User ID. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if it has draft data. */ hasPluginDraftData(assignId: number, userId: number, plugin: any, siteId?: string): Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'hasDraftData', [assignId, userId, siteId])); @@ -244,8 +243,8 @@ export class AddonModAssignFeedbackDelegate extends CoreDelegate { /** * Check if a feedback plugin is supported. * - * @param {string} pluginType Type of the plugin. - * @return {boolean} Whether it's supported. + * @param pluginType Type of the plugin. + * @return Whether it's supported. */ isPluginSupported(pluginType: string): boolean { return this.hasHandler(pluginType, true); @@ -254,11 +253,11 @@ export class AddonModAssignFeedbackDelegate extends CoreDelegate { /** * Prefetch any required data for a feedback plugin. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ prefetch(assign: any, submission: any, plugin: any, siteId?: string): Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'prefetch', [assign, submission, plugin, siteId])); @@ -267,12 +266,12 @@ export class AddonModAssignFeedbackDelegate extends CoreDelegate { /** * Prepare and add to pluginData the data to submit for a certain feedback plugin. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {any} plugin The plugin object. - * @param {any} pluginData Object where to store the data to send. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when data has been gathered. + * @param assignId The assignment ID. + * @param userId User ID. + * @param plugin The plugin object. + * @param pluginData Object where to store the data to send. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when data has been gathered. */ preparePluginFeedbackData(assignId: number, userId: number, plugin: any, pluginData: any, siteId?: string): Promise { @@ -283,12 +282,12 @@ export class AddonModAssignFeedbackDelegate extends CoreDelegate { /** * Save draft data of the feedback plugin. * - * @param {number} assignId The assignment ID. - * @param {number} userId User ID. - * @param {any} plugin The plugin object. - * @param {any} inputData Data to save. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when data has been saved. + * @param assignId The assignment ID. + * @param userId User ID. + * @param plugin The plugin object. + * @param inputData Data to save. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when data has been saved. */ saveFeedbackDraft(assignId: number, userId: number, plugin: any, inputData: any, siteId?: string): Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'saveDraft', diff --git a/src/addon/mod/assign/providers/helper.ts b/src/addon/mod/assign/providers/helper.ts index 5f8f5df21..a634e520c 100644 --- a/src/addon/mod/assign/providers/helper.ts +++ b/src/addon/mod/assign/providers/helper.ts @@ -42,9 +42,9 @@ export class AddonModAssignHelperProvider { /** * Check if a submission can be edited in offline. * - * @param {any} assign Assignment. - * @param {any} submission Submission. - * @return {boolean} Whether it can be edited offline. + * @param assign Assignment. + * @param submission Submission. + * @return Whether it can be edited offline. */ canEditSubmissionOffline(assign: any, submission: any): Promise { if (!submission) { @@ -77,9 +77,9 @@ export class AddonModAssignHelperProvider { /** * Clear plugins temporary data because a submission was cancelled. * - * @param {any} assign Assignment. - * @param {any} submission Submission to clear the data for. - * @param {any} inputData Data entered in the submission form. + * @param assign Assignment. + * @param submission Submission to clear the data for. + * @param inputData Data entered in the submission form. */ clearSubmissionPluginTmpData(assign: any, submission: any, inputData: any): void { submission.plugins.forEach((plugin) => { @@ -91,9 +91,9 @@ export class AddonModAssignHelperProvider { * Copy the data from last submitted attempt to the current submission. * Since we don't have any WS for that we'll have to re-submit everything manually. * - * @param {any} assign Assignment. - * @param {any} previousSubmission Submission to copy. - * @return {Promise} Promise resolved when done. + * @param assign Assignment. + * @param previousSubmission Submission to copy. + * @return Promise resolved when done. */ copyPreviousAttempt(assign: any, previousSubmission: any): Promise { const pluginData = {}, @@ -115,11 +115,11 @@ export class AddonModAssignHelperProvider { /** * Delete stored submission files for a plugin. See storeSubmissionFiles. * - * @param {number} assignId Assignment ID. - * @param {string} folderName Name of the plugin folder. Must be unique (both in submission and feedback plugins). - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param assignId Assignment ID. + * @param folderName Name of the plugin folder. Must be unique (both in submission and feedback plugins). + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ deleteStoredSubmissionFiles(assignId: number, folderName: string, userId?: number, siteId?: string): Promise { return this.assignOffline.getSubmissionPluginFolder(assignId, folderName, userId, siteId).then((folderPath) => { @@ -130,11 +130,11 @@ export class AddonModAssignHelperProvider { /** * Delete all drafts of the feedback plugin data. * - * @param {number} assignId Assignment Id. - * @param {number} userId User Id. - * @param {any} feedback Feedback data. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param assignId Assignment Id. + * @param userId User Id. + * @param feedback Feedback data. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ discardFeedbackPluginData(assignId: number, userId: number, feedback: any, siteId?: string): Promise { const promises = []; @@ -149,11 +149,11 @@ export class AddonModAssignHelperProvider { /** * List the participants for a single assignment, with some summary info about their submissions. * - * @param {any} assign Assignment object. - * @param {number} [groupId] Group Id. - * @param {boolean} [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. - * @return {Promise} Promise resolved with the list of participants and summary of submissions. + * @param assign Assignment object. + * @param groupId Group Id. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of participants and summary of submissions. */ getParticipants(assign: any, groupId?: number, ignoreCache?: boolean, siteId?: string): Promise { groupId = groupId || 0; @@ -189,10 +189,10 @@ export class AddonModAssignHelperProvider { /** * Get plugin config from assignment config. * - * @param {any} assign Assignment object including all config. - * @param {string} subtype Subtype name (assignsubmission or assignfeedback) - * @param {string} type Name of the subplugin. - * @return {any} Object containing all configurations of the subplugin selected. + * @param assign Assignment object including all config. + * @param subtype Subtype name (assignsubmission or assignfeedback) + * @param type Name of the subplugin. + * @return Object containing all configurations of the subplugin selected. */ getPluginConfig(assign: any, subtype: string, type: string): any { const configs = {}; @@ -209,9 +209,9 @@ export class AddonModAssignHelperProvider { /** * Get enabled subplugins. * - * @param {any} assign Assignment object including all config. - * @param {string} subtype Subtype name (assignsubmission or assignfeedback) - * @return {any} List of enabled plugins for the assign. + * @param assign Assignment object including all config. + * @param subtype Subtype name (assignsubmission or assignfeedback) + * @return List of enabled plugins for the assign. */ getPluginsEnabled(assign: any, subtype: string): any[] { const enabled = []; @@ -231,11 +231,11 @@ export class AddonModAssignHelperProvider { /** * Get a list of stored submission files. See storeSubmissionFiles. * - * @param {number} assignId Assignment ID. - * @param {string} folderName Name of the plugin folder. Must be unique (both in submission and feedback plugins). - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the files. + * @param assignId Assignment ID. + * @param folderName Name of the plugin folder. Must be unique (both in submission and feedback plugins). + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the files. */ getStoredSubmissionFiles(assignId: number, folderName: string, userId?: number, siteId?: string): Promise { return this.assignOffline.getSubmissionPluginFolder(assignId, folderName, userId, siteId).then((folderPath) => { @@ -246,9 +246,9 @@ export class AddonModAssignHelperProvider { /** * Get the size that will be uploaded to perform an attempt copy. * - * @param {any} assign Assignment. - * @param {any} previousSubmission Submission to copy. - * @return {Promise} Promise resolved with the size. + * @param assign Assignment. + * @param previousSubmission Submission to copy. + * @return Promise resolved with the size. */ getSubmissionSizeForCopy(assign: any, previousSubmission: any): Promise { const promises = []; @@ -268,10 +268,10 @@ export class AddonModAssignHelperProvider { /** * Get the size that will be uploaded to save a submission. * - * @param {any} assign Assignment. - * @param {any} submission Submission to check data. - * @param {any} inputData Data entered in the submission form. - * @return {Promise} Promise resolved with the size. + * @param assign Assignment. + * @param submission Submission to check data. + * @param inputData Data entered in the submission form. + * @return Promise resolved with the size. */ getSubmissionSizeForEdit(assign: any, submission: any, inputData: any): Promise { const promises = []; @@ -291,12 +291,12 @@ export class AddonModAssignHelperProvider { /** * Get user data for submissions since they only have userid. * - * @param {any} assign Assignment object. - * @param {any[]} submissions Submissions to get the data for. - * @param {number} [groupId] Group Id. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site id (empty for current site). - * @return {Promise} Promise always resolved. Resolve param is the formatted submissions. + * @param assign Assignment object. + * @param submissions Submissions to get the data for. + * @param groupId Group Id. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site id (empty for current site). + * @return Promise always resolved. Resolve param is the formatted submissions. */ getSubmissionsUserData(assign: any, submissions: any[], groupId?: number, ignoreCache?: boolean, siteId?: string): Promise { @@ -389,10 +389,10 @@ export class AddonModAssignHelperProvider { /** * Check if the feedback data has changed for a certain submission and assign. * - * @param {any} assign Assignment. - * @param {number} userId User Id. - * @param {any} feedback Feedback data. - * @return {Promise} Promise resolved with true if data has changed, resolved with false otherwise. + * @param assign Assignment. + * @param userId User Id. + * @param feedback Feedback data. + * @return Promise resolved with true if data has changed, resolved with false otherwise. */ hasFeedbackDataChanged(assign: any, userId: number, feedback: any): Promise { const promises = []; @@ -418,10 +418,10 @@ export class AddonModAssignHelperProvider { /** * Check if the submission data has changed for a certain submission and assign. * - * @param {any} assign Assignment. - * @param {any} submission Submission to check data. - * @param {any} inputData Data entered in the submission form. - * @return {Promise} Promise resolved with true if data has changed, resolved with false otherwise. + * @param assign Assignment. + * @param submission Submission to check data. + * @param inputData Data entered in the submission form. + * @return Promise resolved with true if data has changed, resolved with false otherwise. */ hasSubmissionDataChanged(assign: any, submission: any, inputData: any): Promise { const promises = []; @@ -445,11 +445,11 @@ export class AddonModAssignHelperProvider { /** * Prepare and return the plugin data to send for a certain feedback and assign. * - * @param {number} assignId Assignment Id. - * @param {number} userId User Id. - * @param {any} feedback Feedback data. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with plugin data to send to server. + * @param assignId Assignment Id. + * @param userId User Id. + * @param feedback Feedback data. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with plugin data to send to server. */ prepareFeedbackPluginData(assignId: number, userId: number, feedback: any, siteId?: string): Promise { const pluginData = {}, @@ -467,11 +467,11 @@ export class AddonModAssignHelperProvider { /** * Prepare and return the plugin data to send for a certain submission and assign. * - * @param {any} assign Assignment. - * @param {any} submission Submission to check data. - * @param {any} inputData Data entered in the submission form. - * @param {boolean} [offline] True to prepare the data for an offline submission, false otherwise. - * @return {Promise} Promise resolved with plugin data to send to server. + * @param assign Assignment. + * @param submission Submission to check data. + * @param inputData Data entered in the submission form. + * @param offline True to prepare the data for an offline submission, false otherwise. + * @return Promise resolved with plugin data to send to server. */ prepareSubmissionPluginData(assign: any, submission: any, inputData: any, offline?: boolean): Promise { const pluginData = {}, @@ -491,12 +491,12 @@ export class AddonModAssignHelperProvider { * Given a list of files (either online files or local files), store the local files in a local folder * to be submitted later. * - * @param {number} assignId Assignment ID. - * @param {string} folderName Name of the plugin folder. Must be unique (both in submission and feedback plugins). - * @param {any[]} files List of files. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success, rejected otherwise. + * @param assignId Assignment ID. + * @param folderName Name of the plugin folder. Must be unique (both in submission and feedback plugins). + * @param files List of files. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success, rejected otherwise. */ storeSubmissionFiles(assignId: number, folderName: string, files: any[], userId?: number, siteId?: string): Promise { // Get the folder where to store the files. @@ -508,11 +508,11 @@ export class AddonModAssignHelperProvider { /** * Upload a file to a draft area. If the file is an online file it will be downloaded and then re-uploaded. * - * @param {number} assignId Assignment ID. - * @param {any} file Online file or local FileEntry. - * @param {number} [itemId] Draft ID to use. Undefined or 0 to create a new draft ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the itemId. + * @param assignId Assignment ID. + * @param file Online file or local FileEntry. + * @param itemId Draft ID to use. Undefined or 0 to create a new draft ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the itemId. */ uploadFile(assignId: number, file: any, itemId?: number, siteId?: string): Promise { return this.fileUploaderProvider.uploadOrReuploadFile(file, itemId, AddonModAssignProvider.COMPONENT, assignId, siteId); @@ -523,10 +523,10 @@ export class AddonModAssignHelperProvider { * Online files will be downloaded and then re-uploaded. * If there are no files to upload it will return a fake draft ID (1). * - * @param {number} assignId Assignment ID. - * @param {any[]} files List of files. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the itemId. + * @param assignId Assignment ID. + * @param files List of files. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the itemId. */ uploadFiles(assignId: number, files: any[], siteId?: string): Promise { return this.fileUploaderProvider.uploadOrReuploadFiles(files, AddonModAssignProvider.COMPONENT, assignId, siteId); @@ -535,13 +535,13 @@ export class AddonModAssignHelperProvider { /** * Upload or store some files, depending if the user is offline or not. * - * @param {number} assignId Assignment ID. - * @param {string} folderName Name of the plugin folder. Must be unique (both in submission and feedback plugins). - * @param {any[]} files List of files. - * @param {boolean} offline True if files sould be stored for offline, false to upload them. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param assignId Assignment ID. + * @param folderName Name of the plugin folder. Must be unique (both in submission and feedback plugins). + * @param files List of files. + * @param offline True if files sould be stored for offline, false to upload them. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ uploadOrStoreFiles(assignId: number, folderName: string, files: any[], offline?: boolean, userId?: number, siteId?: string) : Promise { diff --git a/src/addon/mod/assign/providers/list-link-handler.ts b/src/addon/mod/assign/providers/list-link-handler.ts index 9e5315d04..2e2b2de0d 100644 --- a/src/addon/mod/assign/providers/list-link-handler.ts +++ b/src/addon/mod/assign/providers/list-link-handler.ts @@ -33,7 +33,7 @@ export class AddonModAssignListLinkHandler extends CoreContentLinksModuleListHan /** * 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 { return this.assignProvider.isPluginEnabled(); diff --git a/src/addon/mod/assign/providers/module-handler.ts b/src/addon/mod/assign/providers/module-handler.ts index 1aa0cda0d..baa09705f 100644 --- a/src/addon/mod/assign/providers/module-handler.ts +++ b/src/addon/mod/assign/providers/module-handler.ts @@ -48,7 +48,7 @@ export class AddonModAssignModuleHandler implements CoreCourseModuleHandler { /** * 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 { return this.assignProvider.isPluginEnabled(); @@ -57,10 +57,10 @@ export class AddonModAssignModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { return { @@ -82,9 +82,9 @@ export class AddonModAssignModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModAssignIndexComponent; diff --git a/src/addon/mod/assign/providers/prefetch-handler.ts b/src/addon/mod/assign/providers/prefetch-handler.ts index 9c76f2ec8..284d558ab 100644 --- a/src/addon/mod/assign/providers/prefetch-handler.ts +++ b/src/addon/mod/assign/providers/prefetch-handler.ts @@ -59,9 +59,9 @@ export class AddonModAssignPrefetchHandler extends CoreCourseActivityPrefetchHan * If not defined, it will assume all modules can be checked. * The modules that return false will always be shown as outdated when they're downloaded. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {boolean|Promise} Whether the module can use check_updates. The promise should never be rejected. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Whether the module can use check_updates. The promise should never be rejected. */ canUseCheckUpdates(module: any, courseId: number): boolean | Promise { // Teachers cannot use the WS because it doesn't check student submissions. @@ -84,11 +84,11 @@ export class AddonModAssignPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Get list of files. If not defined, we'll assume they're in module.contents. * - * @param {any} module Module. - * @param {Number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the list of files. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of files. */ getFiles(module: any, courseId: number, single?: boolean, siteId?: string): Promise { @@ -149,11 +149,11 @@ export class AddonModAssignPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Get submission files. * - * @param {any} assign Assign. - * @param {number} submitId User ID of the submission to get. - * @param {boolean} blindMarking True if blind marking, false otherwise. - * @param {string} siteId Site ID. If not defined, current site. - * @return {Promise} Promise resolved with array of files. + * @param assign Assign. + * @param submitId User ID of the submission to get. + * @param blindMarking True if blind marking, false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with array of files. */ protected getSubmissionFiles(assign: any, submitId: number, blindMarking: boolean, siteId?: string) : Promise { @@ -195,9 +195,9 @@ export class AddonModAssignPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId The course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId The course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.assignProvider.invalidateContent(moduleId, courseId); @@ -206,9 +206,9 @@ export class AddonModAssignPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Invalidate WS calls needed to determine module status. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule(module: any, courseId: number): Promise { return this.assignProvider.invalidateAssignmentData(courseId); @@ -217,7 +217,7 @@ export class AddonModAssignPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ isEnabled(): boolean | Promise { return this.assignProvider.isPluginEnabled(); @@ -226,11 +226,11 @@ export class AddonModAssignPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string): Promise { return this.prefetchPackage(module, courseId, single, this.prefetchAssign.bind(this)); @@ -239,11 +239,11 @@ export class AddonModAssignPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Prefetch an assignment. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} single True if we're downloading a single module, false if we're downloading a whole section. - * @param {String} siteId Site ID. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. + * @return Promise resolved when done. */ protected prefetchAssign(module: any, courseId: number, single: boolean, siteId: string): Promise { const userId = this.sitesProvider.getCurrentSiteUserId(), @@ -281,12 +281,12 @@ export class AddonModAssignPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Prefetch assign submissions. * - * @param {any} assign Assign. - * @param {number} courseId Course ID. - * @param {number} moduleId Module ID. - * @param {number} userId User ID. If not defined, site's current user. - * @param {string} siteId Site ID. If not defined, current site. - * @return {Promise} Promise resolved when prefetched, rejected otherwise. + * @param assign Assign. + * @param courseId Course ID. + * @param moduleId Module ID. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when prefetched, rejected otherwise. */ protected prefetchSubmissions(assign: any, courseId: number, moduleId: number, userId: number, siteId: string): Promise { // Get submissions. @@ -377,13 +377,13 @@ export class AddonModAssignPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Prefetch a submission. * - * @param {any} assign Assign. - * @param {number} courseId Course ID. - * @param {number} moduleId Module ID. - * @param {any} submission Data returned by AddonModAssignProvider.getSubmissionStatus. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when prefetched, rejected otherwise. + * @param assign Assign. + * @param courseId Course ID. + * @param moduleId Module ID. + * @param submission Data returned by AddonModAssignProvider.getSubmissionStatus. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when prefetched, rejected otherwise. */ protected prefetchSubmission(assign: any, courseId: number, moduleId: number, submission: any, userId?: number, siteId?: string): Promise { @@ -461,10 +461,10 @@ export class AddonModAssignPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Sync a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ sync(module: any, courseId: number, siteId?: any): Promise { return this.syncProvider.syncAssign(module.instance, siteId); diff --git a/src/addon/mod/assign/providers/push-click-handler.ts b/src/addon/mod/assign/providers/push-click-handler.ts index abe6fa608..dd698cbd1 100644 --- a/src/addon/mod/assign/providers/push-click-handler.ts +++ b/src/addon/mod/assign/providers/push-click-handler.ts @@ -34,8 +34,8 @@ export class AddonModAssignPushClickHandler implements CorePushNotificationsClic /** * Check if a notification click is handled by this handler. * - * @param {any} notification The notification to check. - * @return {boolean} Whether the notification click is handled by this handler + * @param notification The notification to check. + * @return Whether the notification click is handled by this handler */ handles(notification: any): boolean | Promise { return this.utils.isTrueOrOne(notification.notif) && notification.moodlecomponent == 'mod_assign' && @@ -45,8 +45,8 @@ export class AddonModAssignPushClickHandler implements CorePushNotificationsClic /** * Handle the notification click. * - * @param {any} notification The notification to check. - * @return {Promise} Promise resolved when done. + * @param notification The notification to check. + * @return Promise resolved when done. */ handleClick(notification: any): Promise { const contextUrlParams = this.urlUtils.extractUrlParams(notification.contexturl), diff --git a/src/addon/mod/assign/providers/submission-delegate.ts b/src/addon/mod/assign/providers/submission-delegate.ts index 26d5da2f4..70c8e9752 100644 --- a/src/addon/mod/assign/providers/submission-delegate.ts +++ b/src/addon/mod/assign/providers/submission-delegate.ts @@ -26,7 +26,6 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { /** * Name of the type of submission the handler supports. E.g. 'file'. - * @type {string} */ type: string; @@ -35,20 +34,20 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * plugin uses Moodle filters. The reason is that the app only prefetches filtered data, and the user should edit * unfiltered data. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @return {boolean|Promise} Boolean or promise resolved with boolean: whether it can be edited in offline. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @return Boolean or promise resolved with boolean: whether it can be edited in offline. */ canEditOffline?(assign: any, submission: any, plugin: any): boolean | Promise; /** * Should clear temporary data for a cancelled submission. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. */ clearTmpData?(assign: any, submission: any, plugin: any, inputData: any): void; @@ -56,24 +55,24 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * This function will be called when the user wants to create a new submission based on the previous one. * It should add to pluginData the data to send to server based in the data in plugin (previous attempt). * - * @param {any} assign The assignment. - * @param {any} plugin The plugin object. - * @param {any} pluginData Object where to store the data to send. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assign The assignment. + * @param plugin The plugin object. + * @param pluginData Object where to store the data to send. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ copySubmissionData?(assign: any, plugin: any, pluginData: any, userId?: number, siteId?: string): void | Promise; /** * Delete any stored data for the plugin and submission. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} offlineData Offline data stored. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param offlineData Offline data stored. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ deleteOfflineData?(assign: any, submission: any, plugin: any, offlineData: any, siteId?: string): void | Promise; @@ -81,10 +80,10 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * Return the Component to use to display the plugin data, either in read or in edit mode. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} plugin The plugin object. - * @param {boolean} [edit] Whether the user is editing. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param plugin The plugin object. + * @param edit Whether the user is editing. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent?(injector: Injector, plugin: any, edit?: boolean): any | Promise; @@ -92,57 +91,57 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * Get files used by this plugin. * The files returned by this function will be prefetched when the user prefetches the assign. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {any[]|Promise} The files (or promise resolved with the files). + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return The files (or promise resolved with the files). */ getPluginFiles?(assign: any, submission: any, plugin: any, siteId?: string): any[] | Promise; /** * Get a readable name to use for the plugin. * - * @param {any} plugin The plugin object. - * @return {string} The plugin name. + * @param plugin The plugin object. + * @return The plugin name. */ getPluginName?(plugin: any): string; /** * Get the size of data (in bytes) this plugin will send to copy a previous submission. * - * @param {any} assign The assignment. - * @param {any} plugin The plugin object. - * @return {number|Promise} The size (or promise resolved with size). + * @param assign The assignment. + * @param plugin The plugin object. + * @return The size (or promise resolved with size). */ getSizeForCopy?(assign: any, plugin: any): number | Promise; /** * Get the size of data (in bytes) this plugin will send to add or edit a submission. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. - * @return {number|Promise} The size (or promise resolved with size). + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. + * @return The size (or promise resolved with size). */ getSizeForEdit?(assign: any, submission: any, plugin: any, inputData: any): number | Promise; /** * Check if the submission data has changed for this plugin. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. - * @return {boolean|Promise} Boolean (or promise resolved with boolean): whether the data has changed. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. + * @return Boolean (or promise resolved with boolean): whether the data has changed. */ hasDataChanged?(assign: any, submission: any, plugin: any, inputData: any): boolean | Promise; /** * Whether or not the handler is enabled for edit on a site level. * - * @return {boolean|Promise} Whether or not the handler is enabled for edit on a site level. + * @return Whether or not the handler is enabled for edit on a site level. */ isEnabledForEdit?(): boolean | Promise; @@ -150,26 +149,26 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * Prefetch any required data for the plugin. * This should NOT prefetch files. Files to be prefetched should be returned by the getPluginFiles function. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ prefetch?(assign: any, submission: any, plugin: any, siteId?: string): Promise; /** * Prepare and add to pluginData the data to send to the server based on the input data. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. - * @param {any} pluginData Object where to store the data to send. - * @param {boolean} [offline] Whether the user is editing in offline. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. + * @param pluginData Object where to store the data to send. + * @param offline Whether the user is editing in offline. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ prepareSubmissionData?(assign: any, submission: any, plugin: any, inputData: any, pluginData: any, offline?: boolean, userId?: number, siteId?: string): void | Promise; @@ -178,13 +177,13 @@ export interface AddonModAssignSubmissionHandler extends CoreDelegateHandler { * Prepare and add to pluginData the data to send to the server based on the offline data stored. * This will be used when performing a synchronization. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} offlineData Offline data stored. - * @param {any} pluginData Object where to store the data to send. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param offlineData Offline data stored. + * @param pluginData Object where to store the data to send. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ prepareSyncData?(assign: any, submission: any, plugin: any, offlineData: any, pluginData: any, siteId?: string) : void | Promise; @@ -206,10 +205,10 @@ export class AddonModAssignSubmissionDelegate extends CoreDelegate { /** * Whether the plugin can be edited in offline for existing submissions. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @return {boolean|Promise} Promise resolved with boolean: whether it can be edited in offline. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @return Promise resolved with boolean: whether it can be edited in offline. */ canPluginEditOffline(assign: any, submission: any, plugin: any): Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'canEditOffline', [assign, submission, plugin])); @@ -218,10 +217,10 @@ export class AddonModAssignSubmissionDelegate extends CoreDelegate { /** * Clear some temporary data for a certain plugin because a submission was cancelled. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. */ clearTmpData(assign: any, submission: any, plugin: any, inputData: any): void { return this.executeFunctionOnEnabled(plugin.type, 'clearTmpData', [assign, submission, plugin, inputData]); @@ -230,12 +229,12 @@ export class AddonModAssignSubmissionDelegate extends CoreDelegate { /** * Copy the data from last submitted attempt to the current submission for a certain plugin. * - * @param {any} assign The assignment. - * @param {any} plugin The plugin object. - * @param {any} pluginData Object where to store the data to send. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data has been copied. + * @param assign The assignment. + * @param plugin The plugin object. + * @param pluginData Object where to store the data to send. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data has been copied. */ copyPluginSubmissionData(assign: any, plugin: any, pluginData: any, userId?: number, siteId?: string): void | Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'copySubmissionData', @@ -245,12 +244,12 @@ export class AddonModAssignSubmissionDelegate extends CoreDelegate { /** * Delete offline data stored for a certain submission and plugin. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} offlineData Offline data stored. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param offlineData Offline data stored. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ deletePluginOfflineData(assign: any, submission: any, plugin: any, offlineData: any, siteId?: string): Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'deleteOfflineData', @@ -260,10 +259,10 @@ export class AddonModAssignSubmissionDelegate extends CoreDelegate { /** * Get the component to use for a certain submission plugin. * - * @param {Injector} injector Injector. - * @param {any} plugin The plugin object. - * @param {boolean} [edit] Whether the user is editing. - * @return {Promise} Promise resolved with the component to use, undefined if not found. + * @param injector Injector. + * @param plugin The plugin object. + * @param edit Whether the user is editing. + * @return Promise resolved with the component to use, undefined if not found. */ getComponentForPlugin(injector: Injector, plugin: any, edit?: boolean): Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'getComponent', [injector, plugin, edit])); @@ -273,11 +272,11 @@ export class AddonModAssignSubmissionDelegate extends CoreDelegate { * Get files used by this plugin. * The files returned by this function will be prefetched when the user prefetches the assign. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the files. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the files. */ getPluginFiles(assign: any, submission: any, plugin: any, siteId?: string): Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'getPluginFiles', [assign, submission, plugin, siteId])); @@ -286,8 +285,8 @@ export class AddonModAssignSubmissionDelegate extends CoreDelegate { /** * Get a readable name to use for a certain submission plugin. * - * @param {any} plugin Plugin to get the name for. - * @return {string} Human readable name. + * @param plugin Plugin to get the name for. + * @return Human readable name. */ getPluginName(plugin: any): string { return this.executeFunctionOnEnabled(plugin.type, 'getPluginName', [plugin]); @@ -296,9 +295,9 @@ export class AddonModAssignSubmissionDelegate extends CoreDelegate { /** * Get the size of data (in bytes) this plugin will send to copy a previous submission. * - * @param {any} assign The assignment. - * @param {any} plugin The plugin object. - * @return {Promise} Promise resolved with size. + * @param assign The assignment. + * @param plugin The plugin object. + * @return Promise resolved with size. */ getPluginSizeForCopy(assign: any, plugin: any): Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'getSizeForCopy', [assign, plugin])); @@ -307,11 +306,11 @@ export class AddonModAssignSubmissionDelegate extends CoreDelegate { /** * Get the size of data (in bytes) this plugin will send to add or edit a submission. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. - * @return {Promise} Promise resolved with size. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. + * @return Promise resolved with size. */ getPluginSizeForEdit(assign: any, submission: any, plugin: any, inputData: any): Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'getSizeForEdit', @@ -321,11 +320,11 @@ export class AddonModAssignSubmissionDelegate extends CoreDelegate { /** * Check if the submission data has changed for a certain plugin. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. - * @return {Promise} Promise resolved with true if data has changed, resolved with false otherwise. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. + * @return Promise resolved with true if data has changed, resolved with false otherwise. */ hasPluginDataChanged(assign: any, submission: any, plugin: any, inputData: any): Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'hasDataChanged', @@ -335,8 +334,8 @@ export class AddonModAssignSubmissionDelegate extends CoreDelegate { /** * Check if a submission plugin is supported. * - * @param {string} pluginType Type of the plugin. - * @return {boolean} Whether it's supported. + * @param pluginType Type of the plugin. + * @return Whether it's supported. */ isPluginSupported(pluginType: string): boolean { return this.hasHandler(pluginType, true); @@ -345,8 +344,8 @@ export class AddonModAssignSubmissionDelegate extends CoreDelegate { /** * Check if a submission plugin is supported for edit. * - * @param {string} pluginType Type of the plugin. - * @return {Promise} Whether it's supported for edit. + * @param pluginType Type of the plugin. + * @return Whether it's supported for edit. */ isPluginSupportedForEdit(pluginType: string): Promise { return Promise.resolve(this.executeFunctionOnEnabled(pluginType, 'isEnabledForEdit')); @@ -355,11 +354,11 @@ export class AddonModAssignSubmissionDelegate extends CoreDelegate { /** * Prefetch any required data for a submission plugin. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ prefetch(assign: any, submission: any, plugin: any, siteId?: string): Promise { return Promise.resolve(this.executeFunctionOnEnabled(plugin.type, 'prefetch', [assign, submission, plugin, siteId])); @@ -368,15 +367,15 @@ export class AddonModAssignSubmissionDelegate extends CoreDelegate { /** * Prepare and add to pluginData the data to submit for a certain submission plugin. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. - * @param {any} pluginData Object where to store the data to send. - * @param {boolean} [offline] Whether the user is editing in offline. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when data has been gathered. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. + * @param pluginData Object where to store the data to send. + * @param offline Whether the user is editing in offline. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when data has been gathered. */ preparePluginSubmissionData(assign: any, submission: any, plugin: any, inputData: any, pluginData: any, offline?: boolean, userId?: number, siteId?: string): Promise { @@ -388,13 +387,13 @@ export class AddonModAssignSubmissionDelegate extends CoreDelegate { /** * Prepare and add to pluginData the data to send to server to synchronize an offline submission. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} offlineData Offline data stored. - * @param {any} pluginData Object where to store the data to send. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when data has been gathered. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param offlineData Offline data stored. + * @param pluginData Object where to store the data to send. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when data has been gathered. */ preparePluginSyncData(assign: any, submission: any, plugin: any, offlineData: any, pluginData: any, siteId?: string) : Promise { diff --git a/src/addon/mod/assign/providers/sync-cron-handler.ts b/src/addon/mod/assign/providers/sync-cron-handler.ts index fbfb6600c..e610567ac 100644 --- a/src/addon/mod/assign/providers/sync-cron-handler.ts +++ b/src/addon/mod/assign/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class AddonModAssignSyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.assignSync.syncAllAssignments(siteId, force); @@ -40,7 +40,7 @@ export class AddonModAssignSyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return this.assignSync.syncInterval; diff --git a/src/addon/mod/assign/submission/comments/component/comments.ts b/src/addon/mod/assign/submission/comments/component/comments.ts index bd6bb57c2..a9d6c4784 100644 --- a/src/addon/mod/assign/submission/comments/component/comments.ts +++ b/src/addon/mod/assign/submission/comments/component/comments.ts @@ -38,7 +38,7 @@ export class AddonModAssignSubmissionCommentsComponent extends AddonModAssignSub /** * Invalidate the data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ invalidate(): Promise { return this.commentsProvider.invalidateCommentsData('module', this.assign.cmid, 'assignsubmission_comments', diff --git a/src/addon/mod/assign/submission/comments/providers/handler.ts b/src/addon/mod/assign/submission/comments/providers/handler.ts index fa4f7af2b..54f450df5 100644 --- a/src/addon/mod/assign/submission/comments/providers/handler.ts +++ b/src/addon/mod/assign/submission/comments/providers/handler.ts @@ -33,10 +33,10 @@ export class AddonModAssignSubmissionCommentsHandler implements AddonModAssignSu * plugin uses Moodle filters. The reason is that the app only prefetches filtered data, and the user should edit * unfiltered data. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @return {boolean|Promise} Boolean or promise resolved with boolean: whether it can be edited in offline. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @return Boolean or promise resolved with boolean: whether it can be edited in offline. */ canEditOffline(assign: any, submission: any, plugin: any): boolean | Promise { // This plugin is read only, but return true to prevent blocking the edition. @@ -47,10 +47,10 @@ export class AddonModAssignSubmissionCommentsHandler implements AddonModAssignSu * Return the Component to use to display the plugin data, either in read or in edit mode. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} plugin The plugin object. - * @param {boolean} [edit] Whether the user is editing. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param plugin The plugin object. + * @param edit Whether the user is editing. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any, edit?: boolean): any | Promise { return edit ? undefined : AddonModAssignSubmissionCommentsComponent; @@ -59,7 +59,7 @@ export class AddonModAssignSubmissionCommentsHandler implements AddonModAssignSu /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -68,7 +68,7 @@ export class AddonModAssignSubmissionCommentsHandler implements AddonModAssignSu /** * Whether or not the handler is enabled for edit on a site level. * - * @return {boolean|Promise} Whether or not the handler is enabled for edit on a site level. + * @return Whether or not the handler is enabled for edit on a site level. */ isEnabledForEdit(): boolean | Promise { return true; @@ -78,11 +78,11 @@ export class AddonModAssignSubmissionCommentsHandler implements AddonModAssignSu * Prefetch any required data for the plugin. * This should NOT prefetch files. Files to be prefetched should be returned by the getPluginFiles function. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ prefetch(assign: any, submission: any, plugin: any, siteId?: string): Promise { return this.commentsProvider.getComments('module', assign.cmid, 'assignsubmission_comments', submission.id, diff --git a/src/addon/mod/assign/submission/file/providers/handler.ts b/src/addon/mod/assign/submission/file/providers/handler.ts index 1e013db7a..57a4a70bf 100644 --- a/src/addon/mod/assign/submission/file/providers/handler.ts +++ b/src/addon/mod/assign/submission/file/providers/handler.ts @@ -48,10 +48,10 @@ export class AddonModAssignSubmissionFileHandler implements AddonModAssignSubmis * plugin uses Moodle filters. The reason is that the app only prefetches filtered data, and the user should edit * unfiltered data. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @return {boolean|Promise} Boolean or promise resolved with boolean: whether it can be edited in offline. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @return Boolean or promise resolved with boolean: whether it can be edited in offline. */ canEditOffline(assign: any, submission: any, plugin: any): boolean | Promise { // This plugin doesn't use Moodle filters, it can be edited in offline. @@ -61,10 +61,10 @@ export class AddonModAssignSubmissionFileHandler implements AddonModAssignSubmis /** * Should clear temporary data for a cancelled submission. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. */ clearTmpData(assign: any, submission: any, plugin: any, inputData: any): void { const files = this.fileSessionProvider.getFiles(AddonModAssignProvider.COMPONENT, assign.id); @@ -80,12 +80,12 @@ export class AddonModAssignSubmissionFileHandler implements AddonModAssignSubmis * This function will be called when the user wants to create a new submission based on the previous one. * It should add to pluginData the data to send to server based in the data in plugin (previous attempt). * - * @param {any} assign The assignment. - * @param {any} plugin The plugin object. - * @param {any} pluginData Object where to store the data to send. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assign The assignment. + * @param plugin The plugin object. + * @param pluginData Object where to store the data to send. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ copySubmissionData(assign: any, plugin: any, pluginData: any, userId?: number, siteId?: string): void | Promise { // We need to re-upload all the existing files. @@ -100,10 +100,10 @@ export class AddonModAssignSubmissionFileHandler implements AddonModAssignSubmis * Return the Component to use to display the plugin data, either in read or in edit mode. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} plugin The plugin object. - * @param {boolean} [edit] Whether the user is editing. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param plugin The plugin object. + * @param edit Whether the user is editing. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any, edit?: boolean): any | Promise { return AddonModAssignSubmissionFileComponent; @@ -112,12 +112,12 @@ export class AddonModAssignSubmissionFileHandler implements AddonModAssignSubmis /** * Delete any stored data for the plugin and submission. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} offlineData Offline data stored. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param offlineData Offline data stored. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ deleteOfflineData(assign: any, submission: any, plugin: any, offlineData: any, siteId?: string): void | Promise { return this.assignHelper.deleteStoredSubmissionFiles(assign.id, AddonModAssignSubmissionFileHandler.FOLDER_NAME, @@ -130,11 +130,11 @@ export class AddonModAssignSubmissionFileHandler implements AddonModAssignSubmis * Get files used by this plugin. * The files returned by this function will be prefetched when the user prefetches the assign. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {any[]|Promise} The files (or promise resolved with the files). + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return The files (or promise resolved with the files). */ getPluginFiles(assign: any, submission: any, plugin: any, siteId?: string): any[] | Promise { return this.assignProvider.getSubmissionPluginAttachments(plugin); @@ -143,9 +143,9 @@ export class AddonModAssignSubmissionFileHandler implements AddonModAssignSubmis /** * Get the size of data (in bytes) this plugin will send to copy a previous submission. * - * @param {any} assign The assignment. - * @param {any} plugin The plugin object. - * @return {number|Promise} The size (or promise resolved with size). + * @param assign The assignment. + * @param plugin The plugin object. + * @return The size (or promise resolved with size). */ getSizeForCopy(assign: any, plugin: any): number | Promise { const files = this.assignProvider.getSubmissionPluginAttachments(plugin), @@ -171,11 +171,11 @@ export class AddonModAssignSubmissionFileHandler implements AddonModAssignSubmis /** * Get the size of data (in bytes) this plugin will send to add or edit a submission. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. - * @return {number|Promise} The size (or promise resolved with size). + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. + * @return The size (or promise resolved with size). */ getSizeForEdit(assign: any, submission: any, plugin: any, inputData: any): number | Promise { const siteId = this.sitesProvider.getCurrentSiteId(); @@ -226,11 +226,11 @@ export class AddonModAssignSubmissionFileHandler implements AddonModAssignSubmis /** * Check if the submission data has changed for this plugin. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. - * @return {boolean|Promise} Boolean (or promise resolved with boolean): whether the data has changed. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. + * @return Boolean (or promise resolved with boolean): whether the data has changed. */ hasDataChanged(assign: any, submission: any, plugin: any, inputData: any): boolean | Promise { // Check if there's any offline data. @@ -271,7 +271,7 @@ export class AddonModAssignSubmissionFileHandler implements AddonModAssignSubmis /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -280,7 +280,7 @@ export class AddonModAssignSubmissionFileHandler implements AddonModAssignSubmis /** * Whether or not the handler is enabled for edit on a site level. * - * @return {boolean|Promise} Whether or not the handler is enabled for edit on a site level. + * @return Whether or not the handler is enabled for edit on a site level. */ isEnabledForEdit(): boolean | Promise { return true; @@ -289,15 +289,15 @@ export class AddonModAssignSubmissionFileHandler implements AddonModAssignSubmis /** * Prepare and add to pluginData the data to send to the server based on the input data. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. - * @param {any} pluginData Object where to store the data to send. - * @param {boolean} [offline] Whether the user is editing in offline. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. + * @param pluginData Object where to store the data to send. + * @param offline Whether the user is editing in offline. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ prepareSubmissionData(assign: any, submission: any, plugin: any, inputData: any, pluginData: any, offline?: boolean, userId?: number, siteId?: string): void | Promise { @@ -322,13 +322,13 @@ export class AddonModAssignSubmissionFileHandler implements AddonModAssignSubmis * Prepare and add to pluginData the data to send to the server based on the offline data stored. * This will be used when performing a synchronization. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} offlineData Offline data stored. - * @param {any} pluginData Object where to store the data to send. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param offlineData Offline data stored. + * @param pluginData Object where to store the data to send. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ prepareSyncData(assign: any, submission: any, plugin: any, offlineData: any, pluginData: any, siteId?: string) : void | Promise { diff --git a/src/addon/mod/assign/submission/onlinetext/component/onlinetext.ts b/src/addon/mod/assign/submission/onlinetext/component/onlinetext.ts index 11ab6f2d0..25b0cd5e6 100644 --- a/src/addon/mod/assign/submission/onlinetext/component/onlinetext.ts +++ b/src/addon/mod/assign/submission/onlinetext/component/onlinetext.ts @@ -96,7 +96,7 @@ export class AddonModAssignSubmissionOnlineTextComponent extends AddonModAssignS /** * Text changed. * - * @param {string} text The new text. + * @param text The new text. */ onChange(text: string): void { // Count words if needed. diff --git a/src/addon/mod/assign/submission/onlinetext/providers/handler.ts b/src/addon/mod/assign/submission/onlinetext/providers/handler.ts index 80745907b..dd4b847a4 100644 --- a/src/addon/mod/assign/submission/onlinetext/providers/handler.ts +++ b/src/addon/mod/assign/submission/onlinetext/providers/handler.ts @@ -41,10 +41,10 @@ export class AddonModAssignSubmissionOnlineTextHandler implements AddonModAssign * plugin uses Moodle filters. The reason is that the app only prefetches filtered data, and the user should edit * unfiltered data. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @return {boolean|Promise} Boolean or promise resolved with boolean: whether it can be edited in offline. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @return Boolean or promise resolved with boolean: whether it can be edited in offline. */ canEditOffline(assign: any, submission: any, plugin: any): boolean | Promise { // This plugin uses Moodle filters, it cannot be edited in offline. @@ -55,12 +55,12 @@ export class AddonModAssignSubmissionOnlineTextHandler implements AddonModAssign * This function will be called when the user wants to create a new submission based on the previous one. * It should add to pluginData the data to send to server based in the data in plugin (previous attempt). * - * @param {any} assign The assignment. - * @param {any} plugin The plugin object. - * @param {any} pluginData Object where to store the data to send. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assign The assignment. + * @param plugin The plugin object. + * @param pluginData Object where to store the data to send. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ copySubmissionData(assign: any, plugin: any, pluginData: any, userId?: number, siteId?: string): void | Promise { const text = this.assignProvider.getSubmissionPluginText(plugin, true), @@ -88,10 +88,10 @@ export class AddonModAssignSubmissionOnlineTextHandler implements AddonModAssign * Return the Component to use to display the plugin data, either in read or in edit mode. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} plugin The plugin object. - * @param {boolean} [edit] Whether the user is editing. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param plugin The plugin object. + * @param edit Whether the user is editing. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any, edit?: boolean): any | Promise { return AddonModAssignSubmissionOnlineTextComponent; @@ -101,11 +101,11 @@ export class AddonModAssignSubmissionOnlineTextHandler implements AddonModAssign * Get files used by this plugin. * The files returned by this function will be prefetched when the user prefetches the assign. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {any[]|Promise} The files (or promise resolved with the files). + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param siteId Site ID. If not defined, current site. + * @return The files (or promise resolved with the files). */ getPluginFiles(assign: any, submission: any, plugin: any, siteId?: string): any[] | Promise { return this.assignProvider.getSubmissionPluginAttachments(plugin); @@ -114,9 +114,9 @@ export class AddonModAssignSubmissionOnlineTextHandler implements AddonModAssign /** * Get the size of data (in bytes) this plugin will send to copy a previous submission. * - * @param {any} assign The assignment. - * @param {any} plugin The plugin object. - * @return {number|Promise} The size (or promise resolved with size). + * @param assign The assignment. + * @param plugin The plugin object. + * @return The size (or promise resolved with size). */ getSizeForCopy(assign: any, plugin: any): number | Promise { const text = this.assignProvider.getSubmissionPluginText(plugin, true), @@ -147,11 +147,11 @@ export class AddonModAssignSubmissionOnlineTextHandler implements AddonModAssign /** * Get the size of data (in bytes) this plugin will send to add or edit a submission. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. - * @return {number|Promise} The size (or promise resolved with size). + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. + * @return The size (or promise resolved with size). */ getSizeForEdit(assign: any, submission: any, plugin: any, inputData: any): number | Promise { const text = this.assignProvider.getSubmissionPluginText(plugin, true); @@ -162,9 +162,9 @@ export class AddonModAssignSubmissionOnlineTextHandler implements AddonModAssign /** * Get the text to submit. * - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. - * @return {string} Text to submit. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. + * @return Text to submit. */ protected getTextToSubmit(plugin: any, inputData: any): string { const text = inputData.onlinetext_editor_text, @@ -176,11 +176,11 @@ export class AddonModAssignSubmissionOnlineTextHandler implements AddonModAssign /** * Check if the submission data has changed for this plugin. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. - * @return {boolean|Promise} Boolean (or promise resolved with boolean): whether the data has changed. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. + * @return Boolean (or promise resolved with boolean): whether the data has changed. */ hasDataChanged(assign: any, submission: any, plugin: any, inputData: any): boolean | Promise { // Get the original text from plugin or offline. @@ -202,7 +202,7 @@ export class AddonModAssignSubmissionOnlineTextHandler implements AddonModAssign /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -211,7 +211,7 @@ export class AddonModAssignSubmissionOnlineTextHandler implements AddonModAssign /** * Whether or not the handler is enabled for edit on a site level. * - * @return {boolean|Promise} Whether or not the handler is enabled for edit on a site level. + * @return Whether or not the handler is enabled for edit on a site level. */ isEnabledForEdit(): boolean | Promise { // There's a bug in Moodle 3.1.0 that doesn't allow submitting HTML, so we'll disable this plugin in that case. @@ -224,15 +224,15 @@ export class AddonModAssignSubmissionOnlineTextHandler implements AddonModAssign /** * Prepare and add to pluginData the data to send to the server based on the input data. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} inputData Data entered by the user for the submission. - * @param {any} pluginData Object where to store the data to send. - * @param {boolean} [offline] Whether the user is editing in offline. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param inputData Data entered by the user for the submission. + * @param pluginData Object where to store the data to send. + * @param offline Whether the user is editing in offline. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ prepareSubmissionData(assign: any, submission: any, plugin: any, inputData: any, pluginData: any, offline?: boolean, userId?: number, siteId?: string): void | Promise { @@ -266,13 +266,13 @@ export class AddonModAssignSubmissionOnlineTextHandler implements AddonModAssign * Prepare and add to pluginData the data to send to the server based on the offline data stored. * This will be used when performing a synchronization. * - * @param {any} assign The assignment. - * @param {any} submission The submission. - * @param {any} plugin The plugin object. - * @param {any} offlineData Offline data stored. - * @param {any} pluginData Object where to store the data to send. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} If the function is async, it should return a Promise resolved when done. + * @param assign The assignment. + * @param submission The submission. + * @param plugin The plugin object. + * @param offlineData Offline data stored. + * @param pluginData Object where to store the data to send. + * @param siteId Site ID. If not defined, current site. + * @return If the function is async, it should return a Promise resolved when done. */ prepareSyncData(assign: any, submission: any, plugin: any, offlineData: any, pluginData: any, siteId?: string) : void | Promise { diff --git a/src/addon/mod/book/components/index/index.ts b/src/addon/mod/book/components/index/index.ts index 569060aa3..794d4970c 100644 --- a/src/addon/mod/book/components/index/index.ts +++ b/src/addon/mod/book/components/index/index.ts @@ -61,7 +61,7 @@ export class AddonModBookIndexComponent extends CoreCourseModuleMainResourceComp /** * Show the TOC. * - * @param {MouseEvent} event Event. + * @param event Event. */ showToc(event: MouseEvent): void { // Create the toc modal. @@ -88,8 +88,8 @@ export class AddonModBookIndexComponent extends CoreCourseModuleMainResourceComp /** * Change the current chapter. * - * @param {string} chapterId Chapter to load. - * @return {Promise} Promise resolved when done. + * @param chapterId Chapter to load. + * @return Promise resolved when done. */ changeChapter(chapterId: string): void { if (chapterId && chapterId != this.currentChapter) { @@ -102,7 +102,7 @@ export class AddonModBookIndexComponent extends CoreCourseModuleMainResourceComp /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { return this.bookProvider.invalidateContent(this.module.id, this.courseId); @@ -111,8 +111,8 @@ export class AddonModBookIndexComponent extends CoreCourseModuleMainResourceComp /** * Download book contents and load the current chapter. * - * @param {boolean} [refresh] Whether we're refreshing data. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @return Promise resolved when done. */ protected fetchContent(refresh?: boolean): Promise { const promises = []; @@ -175,8 +175,8 @@ export class AddonModBookIndexComponent extends CoreCourseModuleMainResourceComp /** * Load a book chapter. * - * @param {string} chapterId Chapter to load. - * @return {Promise} Promise resolved when done. + * @param chapterId Chapter to load. + * @return Promise resolved when done. */ protected loadChapter(chapterId: string): Promise { this.currentChapter = chapterId; diff --git a/src/addon/mod/book/pages/index/index.ts b/src/addon/mod/book/pages/index/index.ts index 7bb9e1f0f..fc95e6b4a 100644 --- a/src/addon/mod/book/pages/index/index.ts +++ b/src/addon/mod/book/pages/index/index.ts @@ -42,7 +42,7 @@ export class AddonModBookIndexPage { /** * Update some data based on the book instance. * - * @param {any} book Book instance. + * @param book Book instance. */ updateData(book: any): void { this.title = book.name || this.title; diff --git a/src/addon/mod/book/pages/toc/toc.ts b/src/addon/mod/book/pages/toc/toc.ts index 8048eacb8..0478faf2c 100644 --- a/src/addon/mod/book/pages/toc/toc.ts +++ b/src/addon/mod/book/pages/toc/toc.ts @@ -36,7 +36,7 @@ export class AddonModBookTocPage { /** * Function called when a course is clicked. * - * @param {string} id ID of the clicked chapter. + * @param id ID of the clicked chapter. */ loadChapter(id: string): void { this.viewCtrl.dismiss(id); diff --git a/src/addon/mod/book/providers/book.ts b/src/addon/mod/book/providers/book.ts index 74fd32706..1e97a6749 100644 --- a/src/addon/mod/book/providers/book.ts +++ b/src/addon/mod/book/providers/book.ts @@ -32,19 +32,16 @@ import { CoreTagItem } from '@core/tag/providers/tag'; export interface AddonModBookTocChapter { /** * ID to identify the chapter. - * @type {string} */ id: string; /** * Chapter's title. - * @type {string} */ title: string; /** * The chapter's level. - * @type {number} */ level: number; } @@ -81,10 +78,10 @@ export class AddonModBookProvider { /** * Get a book by course module ID. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the book is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the book is retrieved. */ getBook(courseId: number, cmId: number, siteId?: string): Promise { return this.getBookByField(courseId, 'coursemodule', cmId, siteId); @@ -93,11 +90,11 @@ export class AddonModBookProvider { /** * Get a book with key=value. If more than one is found, only the first will be returned. * - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the book is retrieved. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the book is retrieved. */ protected getBookByField(courseId: number, key: string, value: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -128,8 +125,8 @@ export class AddonModBookProvider { /** * Get cache key for get book data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getBookDataCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'book:' + courseId; @@ -138,10 +135,10 @@ export class AddonModBookProvider { /** * Gets a chapter contents. * - * @param {AddonModBookContentsMap} contentsMap Contents map returned by getContentsMap. - * @param {string} chapterId Chapter to retrieve. - * @param {number} moduleId The module ID. - * @return {Promise} Promise resolved with the contents. + * @param contentsMap Contents map returned by getContentsMap. + * @param chapterId Chapter to retrieve. + * @param moduleId The module ID. + * @return Promise resolved with the contents. */ getChapterContent(contentsMap: AddonModBookContentsMap, chapterId: string, moduleId: number): Promise { const indexUrl = contentsMap[chapterId] ? contentsMap[chapterId].indexUrl : undefined, @@ -182,8 +179,8 @@ export class AddonModBookProvider { * Convert an array of book contents into an object where contents are organized in chapters. * Each chapter has an indexUrl and the list of contents in that chapter. * - * @param {any[]} contents The module contents. - * @return {AddonModBookContentsMap} Contents map. + * @param contents The module contents. + * @return Contents map. */ getContentsMap(contents: any[]): AddonModBookContentsMap { const map: AddonModBookContentsMap = {}; @@ -236,8 +233,8 @@ export class AddonModBookProvider { /** * Get the first chapter of a book. * - * @param {AddonModBookTocChapter[]} chapters The chapters list. - * @return {string} The chapter id. + * @param chapters The chapters list. + * @return The chapter id. */ getFirstChapter(chapters: AddonModBookTocChapter[]): string { if (!chapters || !chapters.length) { @@ -250,9 +247,9 @@ export class AddonModBookProvider { /** * Get the next chapter to the given one. * - * @param {AddonModBookTocChapter[]} chapters The chapters list. - * @param {string} chapterId The current chapter. - * @return {string} The next chapter id. + * @param chapters The chapters list. + * @param chapterId The current chapter. + * @return The next chapter id. */ getNextChapter(chapters: AddonModBookTocChapter[], chapterId: string): string { let next = '0'; @@ -272,9 +269,9 @@ export class AddonModBookProvider { /** * Get the previous chapter to the given one. * - * @param {AddonModBookTocChapter[]} chapters The chapters list. - * @param {string} chapterId The current chapter. - * @return {string} The next chapter id. + * @param chapters The chapters list. + * @param chapterId The current chapter. + * @return The next chapter id. */ getPreviousChapter(chapters: AddonModBookTocChapter[], chapterId: string): string { let previous = '0'; @@ -292,8 +289,8 @@ export class AddonModBookProvider { /** * Get the book toc as an array. * - * @param {any[]} contents The module contents. - * @return {any[]} The toc. + * @param contents The module contents. + * @return The toc. */ getToc(contents: any[]): any[] { if (!contents || !contents.length) { @@ -306,8 +303,8 @@ export class AddonModBookProvider { /** * Get the book toc as an array of chapters (not nested). * - * @param {any[]} contents The module contents. - * @return {AddonModBookTocChapter[]} The toc as a list. + * @param contents The module contents. + * @return The toc as a list. */ getTocList(contents: any[]): AddonModBookTocChapter[] { const chapters = [], @@ -333,9 +330,9 @@ export class AddonModBookProvider { /** * Invalidates book data. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateBookData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -346,10 +343,10 @@ export class AddonModBookProvider { /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID of the module. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID of the module. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -366,8 +363,8 @@ export class AddonModBookProvider { /** * Check if a file is downloadable. The file param must have a 'type' attribute like in core_course_get_contents response. * - * @param {any} file File to check. - * @return {boolean} Whether it's downloadable. + * @param file File to check. + * @return Whether it's downloadable. */ isFileDownloadable(file: any): boolean { return file.type === 'file'; @@ -376,8 +373,8 @@ export class AddonModBookProvider { /** * Return whether or not the plugin is enabled. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ isPluginEnabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -388,11 +385,11 @@ export class AddonModBookProvider { /** * Report a book as being viewed. * - * @param {number} id Module ID. - * @param {string} chapterId Chapter ID. - * @param {string} [name] Name of the book. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Module ID. + * @param chapterId Chapter ID. + * @param name Name of the book. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(id: number, chapterId: string, name?: string, siteId?: string): Promise { const params = { diff --git a/src/addon/mod/book/providers/link-handler.ts b/src/addon/mod/book/providers/link-handler.ts index 631885cbe..bba613b19 100644 --- a/src/addon/mod/book/providers/link-handler.ts +++ b/src/addon/mod/book/providers/link-handler.ts @@ -31,11 +31,11 @@ export class AddonModBookLinkHandler extends CoreContentLinksModuleIndexHandler /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { diff --git a/src/addon/mod/book/providers/list-link-handler.ts b/src/addon/mod/book/providers/list-link-handler.ts index 5351a9ae4..4b3f403d0 100644 --- a/src/addon/mod/book/providers/list-link-handler.ts +++ b/src/addon/mod/book/providers/list-link-handler.ts @@ -34,11 +34,11 @@ export class AddonModBookListLinkHandler extends CoreContentLinksModuleListHandl * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return this.bookProvider.isPluginEnabled(); diff --git a/src/addon/mod/book/providers/module-handler.ts b/src/addon/mod/book/providers/module-handler.ts index 6f92d6f32..565b5a36c 100644 --- a/src/addon/mod/book/providers/module-handler.ts +++ b/src/addon/mod/book/providers/module-handler.ts @@ -45,7 +45,7 @@ export class AddonModBookModuleHandler implements CoreCourseModuleHandler { /** * Check if the handler is enabled on a site level. * - * @return {boolean|Promise} 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 { return this.bookProvider.isPluginEnabled(); @@ -54,10 +54,10 @@ export class AddonModBookModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { return { @@ -80,10 +80,10 @@ export class AddonModBookModuleHandler implements CoreCourseModuleHandler { * The component returned must implement CoreCourseModuleMainComponent. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param course The course object. + * @param module The module object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getMainComponent(injector: Injector, course: any, module: any): any | Promise { return AddonModBookIndexComponent; diff --git a/src/addon/mod/book/providers/prefetch-handler.ts b/src/addon/mod/book/providers/prefetch-handler.ts index 0289370cd..d1055bbec 100644 --- a/src/addon/mod/book/providers/prefetch-handler.ts +++ b/src/addon/mod/book/providers/prefetch-handler.ts @@ -43,13 +43,13 @@ export class AddonModBookPrefetchHandler extends CoreCourseResourcePrefetchHandl /** * Download or prefetch the content. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {boolean} [prefetch] True to prefetch, false to download right away. - * @param {string} [dirPath] Path of the directory where to store all the content files. This is to keep the files - * relative paths and make the package work in an iframe. Undefined to download the files - * in the filepool root folder. - * @return {Promise} Promise resolved when all content is downloaded. Data returned is not reliable. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param prefetch True to prefetch, false to download right away. + * @param dirPath Path of the directory where to store all the content files. This is to keep the files + * relative paths and make the package work in an iframe. Undefined to download the files + * in the filepool root folder. + * @return Promise resolved when all content is downloaded. Data returned is not reliable. */ downloadOrPrefetch(module: any, courseId: number, prefetch?: boolean, dirPath?: string): Promise { const promises = []; @@ -65,9 +65,9 @@ export class AddonModBookPrefetchHandler extends CoreCourseResourcePrefetchHandl /** * Returns module intro files. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved with list of intro files. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @return Promise resolved with list of intro files. */ getIntroFiles(module: any, courseId: number): Promise { return this.bookProvider.getBook(courseId, module.id).catch(() => { @@ -80,9 +80,9 @@ export class AddonModBookPrefetchHandler extends CoreCourseResourcePrefetchHandl /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.bookProvider.invalidateContent(moduleId, courseId); @@ -91,7 +91,7 @@ export class AddonModBookPrefetchHandler extends CoreCourseResourcePrefetchHandl /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ isEnabled(): boolean | Promise { return this.bookProvider.isPluginEnabled(); diff --git a/src/addon/mod/book/providers/tag-area-handler.ts b/src/addon/mod/book/providers/tag-area-handler.ts index 47c456cb6..afa55b00b 100644 --- a/src/addon/mod/book/providers/tag-area-handler.ts +++ b/src/addon/mod/book/providers/tag-area-handler.ts @@ -33,7 +33,7 @@ export class AddonModBookTagAreaHandler implements CoreTagAreaHandler { /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return this.bookProvider.isPluginEnabled(); @@ -42,8 +42,8 @@ export class AddonModBookTagAreaHandler implements CoreTagAreaHandler { /** * Parses the rendered content of a tag index and returns the items. * - * @param {string} content Rendered content. - * @return {any[]|Promise} Area items (or promise resolved with the items). + * @param content Rendered content. + * @return Area items (or promise resolved with the items). */ parseContent(content: string): any[] | Promise { const items = this.tagHelper.parseFeedContent(content); @@ -66,8 +66,8 @@ export class AddonModBookTagAreaHandler implements CoreTagAreaHandler { /** * Get the component to use to display items. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return CoreTagFeedComponent; diff --git a/src/addon/mod/chat/components/index/index.ts b/src/addon/mod/chat/components/index/index.ts index 585c6f4e8..71e646d53 100644 --- a/src/addon/mod/chat/components/index/index.ts +++ b/src/addon/mod/chat/components/index/index.ts @@ -58,10 +58,10 @@ export class AddonModChatIndexComponent extends CoreCourseModuleMainActivityComp /** * Download chat. * - * @param {boolean} [refresh=false] If it's refreshing content. - * @param {boolean} [sync=false] If it should try to sync. - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved when done. + * @param refresh If it's refreshing content. + * @param sync If it should try to sync. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved when done. */ protected fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { return this.chatProvider.getChat(this.courseId, this.module.id).then((chat) => { diff --git a/src/addon/mod/chat/pages/chat/chat.ts b/src/addon/mod/chat/pages/chat/chat.ts index 41bd0e1ca..e4951d6e3 100644 --- a/src/addon/mod/chat/pages/chat/chat.ts +++ b/src/addon/mod/chat/pages/chat/chat.ts @@ -131,7 +131,7 @@ export class AddonModChatChatPage { /** * Convenience function to login the user. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected loginUser(): Promise { return this.chatProvider.loginUser(this.chatId).then((sessionId) => { @@ -142,7 +142,7 @@ export class AddonModChatChatPage { /** * Convenience function to fetch chat messages. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchMessages(): Promise { return this.chatProvider.getLatestMessages(this.sessionId, this.lastTime).then((messagesInfo) => { @@ -188,7 +188,7 @@ export class AddonModChatChatPage { /** * Convenience function to be called every certain time to fetch chat messages. * - * @return {Promise} Promised resolved when done. + * @return Promised resolved when done. */ protected fetchMessagesInterval(): Promise { this.logger.debug('Polling for messages'); @@ -221,9 +221,9 @@ export class AddonModChatChatPage { /** * Check if the date should be displayed between messages (when the day changes at midnight for example). * - * @param {any} message New message object. - * @param {any} prevMessage Previous message object. - * @return {boolean} True if messages are from diferent days, false othetwise. + * @param message New message object. + * @param prevMessage Previous message object. + * @return True if messages are from diferent days, false othetwise. */ showDate(message: any, prevMessage: any): boolean { if (!prevMessage) { @@ -237,8 +237,8 @@ export class AddonModChatChatPage { /** * Send a message to the chat. * - * @param {string} text Text of the nessage. - * @param {number} [beep=0] ID of the user to beep. + * @param text Text of the nessage. + * @param beep ID of the user to beep. */ sendMessage(text: string, beep: number = 0): void { if (!this.isOnline) { diff --git a/src/addon/mod/chat/pages/index/index.ts b/src/addon/mod/chat/pages/index/index.ts index 391b654fc..7eb57a4b9 100644 --- a/src/addon/mod/chat/pages/index/index.ts +++ b/src/addon/mod/chat/pages/index/index.ts @@ -40,7 +40,7 @@ export class AddonModChatIndexPage { /** * Update some data based on the chat instance. * - * @param {any} chat Chat instance. + * @param chat Chat instance. */ updateData(chat: any): void { this.title = chat.name || this.title; diff --git a/src/addon/mod/chat/pages/session-messages/session-messages.ts b/src/addon/mod/chat/pages/session-messages/session-messages.ts index 91fe8874b..b96ed597a 100644 --- a/src/addon/mod/chat/pages/session-messages/session-messages.ts +++ b/src/addon/mod/chat/pages/session-messages/session-messages.ts @@ -49,7 +49,7 @@ export class AddonModChatSessionMessagesPage { /** * Fetch session messages. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchMessages(): Promise { return this.chatProvider.getSessionMessages(this.chatId, this.sessionStart, this.sessionEnd, this.groupId) @@ -67,7 +67,7 @@ export class AddonModChatSessionMessagesPage { /** * Refresh session messages. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshMessages(refresher: any): void { this.chatProvider.invalidateSessionMessages(this.chatId, this.sessionStart, this.groupId).finally(() => { @@ -80,9 +80,9 @@ export class AddonModChatSessionMessagesPage { /** * Check if the date should be displayed between messages (when the day changes at midnight for example). * - * @param {any} message New message object. - * @param {any} prevMessage Previous message object. - * @return {boolean} True if messages are from diferent days, false othetwise. + * @param message New message object. + * @param prevMessage Previous message object. + * @return True if messages are from diferent days, false othetwise. */ showDate(message: any, prevMessage: any): boolean { if (!prevMessage) { diff --git a/src/addon/mod/chat/pages/sessions/sessions.ts b/src/addon/mod/chat/pages/sessions/sessions.ts index 373a38dce..6043f3f3b 100644 --- a/src/addon/mod/chat/pages/sessions/sessions.ts +++ b/src/addon/mod/chat/pages/sessions/sessions.ts @@ -62,8 +62,8 @@ export class AddonModChatSessionsPage { /** * Fetch chat sessions. * - * @param {number} [showLoading] Display a loading modal. - * @return {Promise} Promise resolved when done. + * @param showLoading Display a loading modal. + * @return Promise resolved when done. */ fetchSessions(showLoading?: boolean): Promise { const modal = showLoading ? this.domUtils.showModalLoading() : null; @@ -112,7 +112,7 @@ export class AddonModChatSessionsPage { /** * Refresh chat sessions. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshSessions(refresher: any): void { const promises = [ @@ -130,7 +130,7 @@ export class AddonModChatSessionsPage { /** * Navigate to a session. * - * @param {any} session Chat session. + * @param session Chat session. */ openSession(session: any): void { this.selectedSessionStart = session.sessionstart; @@ -148,8 +148,8 @@ export class AddonModChatSessionsPage { /** * Show more session users. * - * @param {any} session Chat session. - * @param {Event} $event The event. + * @param session Chat session. + * @param $event The event. */ showMoreUsers(session: any, $event: Event): void { session.sessionusers = session.allsessionusers; diff --git a/src/addon/mod/chat/pages/users/users.ts b/src/addon/mod/chat/pages/users/users.ts index 90e59df6d..4cd59049d 100644 --- a/src/addon/mod/chat/pages/users/users.ts +++ b/src/addon/mod/chat/pages/users/users.ts @@ -75,7 +75,7 @@ export class AddonModChatUsersPage { /** * Add "To user:". * - * @param {any} user User object. + * @param user User object. */ talkTo(user: any): void { this.viewCtrl.dismiss({talkTo: user.fullname}); @@ -84,7 +84,7 @@ export class AddonModChatUsersPage { /** * Beep a user. * - * @param {any} user User object. + * @param user User object. */ beepTo(user: any): void { this.viewCtrl.dismiss({beepTo: user.id}); diff --git a/src/addon/mod/chat/providers/chat.ts b/src/addon/mod/chat/providers/chat.ts index 4e6b6df9b..9b9a02e39 100644 --- a/src/addon/mod/chat/providers/chat.ts +++ b/src/addon/mod/chat/providers/chat.ts @@ -36,10 +36,10 @@ export class AddonModChatProvider { /** * Get a chat. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the chat is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the chat is retrieved. */ getChat(courseId: number, cmId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -67,8 +67,8 @@ export class AddonModChatProvider { /** * Log the user into a chat room. * - * @param {number} chatId Chat instance ID. - * @return {Promise} Promise resolved when the WS is executed. + * @param chatId Chat instance ID. + * @return Promise resolved when the WS is executed. */ loginUser(chatId: number): Promise { const params = { @@ -87,10 +87,10 @@ export class AddonModChatProvider { /** * Report a chat as being viewed. * - * @param {number} id Chat instance ID. - * @param {string} [name] Name of the chat. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Chat instance ID. + * @param name Name of the chat. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params = { @@ -103,10 +103,10 @@ export class AddonModChatProvider { /** * Send a message to a chat. * - * @param {number} sessionId Chat sessiond ID. - * @param {string} message Message text. - * @param {number} beepUserId Beep user ID. - * @return {Promise} Promise resolved when the WS is executed. + * @param sessionId Chat sessiond ID. + * @param message Message text. + * @param beepUserId Beep user ID. + * @return Promise resolved when the WS is executed. */ sendMessage(sessionId: number, message: string, beepUserId: number): Promise { const params = { @@ -127,9 +127,9 @@ export class AddonModChatProvider { /** * Get the latest messages from a chat session. * - * @param {number} sessionId Chat sessiond ID. - * @param {number} lastTime Last time when messages were retrieved. - * @return {Promise} Promise resolved when the WS is executed. + * @param sessionId Chat sessiond ID. + * @param lastTime Last time when messages were retrieved. + * @return Promise resolved when the WS is executed. */ getLatestMessages(sessionId: number, lastTime: number): Promise { const params = { @@ -145,9 +145,9 @@ export class AddonModChatProvider { /** * Get user data for messages since they only have userid. * - * @param {any[]} messages Messages to get the user data for. - * @param {number} courseId ID of the course the messages belong to. - * @return {Promise} Promise always resolved with the formatted messages. + * @param messages Messages to get the user data for. + * @param courseId ID of the course the messages belong to. + * @return Promise always resolved with the formatted messages. */ getMessagesUserData(messages: any[], courseId: number): Promise { const promises = messages.map((message) => { @@ -168,8 +168,8 @@ export class AddonModChatProvider { /** * Get the actives users of a current chat. * - * @param {number} sessionId Chat sessiond ID. - * @return {Promise} Promise resolved when the WS is executed. + * @param sessionId Chat sessiond ID. + * @return Promise resolved when the WS is executed. */ getChatUsers(sessionId: number): Promise { const params = { @@ -185,8 +185,8 @@ export class AddonModChatProvider { /** * Return whether WS for passed sessions are available. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with a boolean. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with a boolean. */ areSessionsAvailable(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -197,12 +197,12 @@ export class AddonModChatProvider { /** * Get chat sessions. * - * @param {number} chatId Chat ID. - * @param {number} [groupId=0] Group ID, 0 means that the function will determine the user group. - * @param {boolean} [showAll=false] Whether to include incomplete sessions or not. - * @param {boolean} [ignoreCache=false] 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. - * @return {Promise} Promise resolved with the list of sessions. + * @param chatId Chat ID. + * @param groupId Group ID, 0 means that the function will determine the user group. + * @param showAll Whether to include incomplete sessions or not. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of sessions. * @since 3.5 */ getSessions(chatId: number, groupId: number = 0, showAll: boolean = false, ignoreCache: boolean = false, siteId?: string): @@ -235,13 +235,13 @@ export class AddonModChatProvider { /** * Get chat session messages. * - * @param {number} chatId Chat ID. - * @param {number} sessionStart Session start time. - * @param {number} sessionEnd Session end time. - * @param {number} [groupId=0] Group ID, 0 means that the function will determine the user group. - * @param {boolean} [ignoreCache=false] 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. - * @return {Promise} Promise resolved with the list of messages. + * @param chatId Chat ID. + * @param sessionStart Session start time. + * @param sessionEnd Session end time. + * @param groupId Group ID, 0 means that the function will determine the user group. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of messages. * @since 3.5 */ getSessionMessages(chatId: number, sessionStart: number, sessionEnd: number, groupId: number = 0, ignoreCache: boolean = false, @@ -275,8 +275,8 @@ export class AddonModChatProvider { /** * Invalidate chats. * - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @return Promise resolved when the data is invalidated. */ invalidateChats(courseId: number): Promise { const site = this.sitesProvider.getCurrentSite(); @@ -287,10 +287,10 @@ export class AddonModChatProvider { /** * Invalidate chat sessions. * - * @param {number} chatId Chat ID. - * @param {number} [groupId=0] Group ID, 0 means that the function will determine the user group. - * @param {boolean} [showAll=false] Whether to include incomplete sessions or not. - * @return {Promise} Promise resolved when the data is invalidated. + * @param chatId Chat ID. + * @param groupId Group ID, 0 means that the function will determine the user group. + * @param showAll Whether to include incomplete sessions or not. + * @return Promise resolved when the data is invalidated. */ invalidateSessions(chatId: number, groupId: number = 0, showAll: boolean = false): Promise { const site = this.sitesProvider.getCurrentSite(); @@ -301,8 +301,8 @@ export class AddonModChatProvider { /** * Invalidate all chat sessions. * - * @param {number} chatId Chat ID. - * @return {Promise} Promise resolved when the data is invalidated. + * @param chatId Chat ID. + * @return Promise resolved when the data is invalidated. */ invalidateAllSessions(chatId: number): Promise { const site = this.sitesProvider.getCurrentSite(); @@ -313,10 +313,10 @@ export class AddonModChatProvider { /** * Invalidate chat session messages. * - * @param {number} chatId Chat ID. - * @param {number} sessionStart Session start time. - * @param {number} [groupId=0] Group ID, 0 means that the function will determine the user group. - * @return {Promise} Promise resolved when the data is invalidated. + * @param chatId Chat ID. + * @param sessionStart Session start time. + * @param groupId Group ID, 0 means that the function will determine the user group. + * @return Promise resolved when the data is invalidated. */ invalidateSessionMessages(chatId: number, sessionStart: number, groupId: number = 0): Promise { const site = this.sitesProvider.getCurrentSite(); @@ -327,8 +327,8 @@ export class AddonModChatProvider { /** * Invalidate all chat session messages. * - * @param {number} chatId Chat ID. - * @return {Promise} Promise resolved when the data is invalidated. + * @param chatId Chat ID. + * @return Promise resolved when the data is invalidated. */ invalidateAllSessionMessages(chatId: number): Promise { const site = this.sitesProvider.getCurrentSite(); @@ -339,8 +339,8 @@ export class AddonModChatProvider { /** * Get cache key for chats WS call. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getChatsCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'chats:' + courseId; @@ -349,10 +349,10 @@ export class AddonModChatProvider { /** * Get cache key for sessions WS call. * - * @param {number} chatId Chat ID. - * @param {number} groupId Goup ID, 0 means that the function will determine the user group. - * @param {boolean} showAll Whether to include incomplete sessions or not. - * @return {string} Cache key. + * @param chatId Chat ID. + * @param groupId Goup ID, 0 means that the function will determine the user group. + * @param showAll Whether to include incomplete sessions or not. + * @return Cache key. */ protected getSessionsCacheKey(chatId: number, groupId: number, showAll: boolean): string { return this.getSessionsCacheKeyPrefix(chatId) + groupId + ':' + (showAll ? 1 : 0); @@ -361,8 +361,8 @@ export class AddonModChatProvider { /** * Get cache key prefix for sessions WS call. * - * @param {number} chatId Chat ID. - * @return {string} Cache key prefix. + * @param chatId Chat ID. + * @return Cache key prefix. */ protected getSessionsCacheKeyPrefix(chatId: number): string { return this.ROOT_CACHE_KEY + 'sessions:' + chatId + ':'; @@ -371,10 +371,10 @@ export class AddonModChatProvider { /** * Get cache key for session messages WS call. * - * @param {number} chatId Chat ID. - * @param {number} sessionStart Session start time. - * @param {number} groupId Group ID, 0 means that the function will determine the user group. - * @return {string} Cache key. + * @param chatId Chat ID. + * @param sessionStart Session start time. + * @param groupId Group ID, 0 means that the function will determine the user group. + * @return Cache key. */ protected getSessionMessagesCacheKey(chatId: number, sessionStart: number, groupId: number): string { return this.getSessionMessagesCacheKeyPrefix(chatId) + sessionStart + ':' + groupId; @@ -383,8 +383,8 @@ export class AddonModChatProvider { /** * Get cache key prefix for session messages WS call. * - * @param {number} chatId Chat ID. - * @return {string} Cache key prefix. + * @param chatId Chat ID. + * @return Cache key prefix. */ protected getSessionMessagesCacheKeyPrefix(chatId: number): string { return this.ROOT_CACHE_KEY + 'sessionsMessages:' + chatId + ':'; diff --git a/src/addon/mod/chat/providers/module-handler.ts b/src/addon/mod/chat/providers/module-handler.ts index f85c2be5e..1a459766d 100644 --- a/src/addon/mod/chat/providers/module-handler.ts +++ b/src/addon/mod/chat/providers/module-handler.ts @@ -44,7 +44,7 @@ export class AddonModChatModuleHandler implements CoreCourseModuleHandler { /** * 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 { return true; @@ -53,10 +53,10 @@ export class AddonModChatModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { const data: CoreCourseModuleHandlerData = { @@ -83,9 +83,9 @@ export class AddonModChatModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModChatIndexComponent; diff --git a/src/addon/mod/chat/providers/prefetch-handler.ts b/src/addon/mod/chat/providers/prefetch-handler.ts index c9f54a62a..ca146b06d 100644 --- a/src/addon/mod/chat/providers/prefetch-handler.ts +++ b/src/addon/mod/chat/providers/prefetch-handler.ts @@ -51,7 +51,7 @@ export class AddonModChatPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ isEnabled(): boolean | Promise { return this.chatProvider.areSessionsAvailable(); @@ -60,9 +60,9 @@ export class AddonModChatPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId The course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId The course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.chatProvider.getChat(courseId, moduleId).then((chat) => { @@ -79,9 +79,9 @@ export class AddonModChatPrefetchHandler extends CoreCourseActivityPrefetchHandl * Invalidate WS calls needed to determine module status (usually, to check if module is downloadable). * It doesn't need to invalidate check updates. It should NOT invalidate files nor all the prefetched data. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule(module: any, courseId: number): Promise { const promises = [ @@ -95,11 +95,11 @@ export class AddonModChatPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string): Promise { return this.prefetchPackage(module, courseId, single, this.prefetchChat.bind(this)); @@ -108,11 +108,11 @@ export class AddonModChatPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Prefetch a chat. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} single True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when done. + * @param module The module object returned by WS. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. + * @return Promise resolved when done. */ protected prefetchChat(module: any, courseId: number, single: boolean, siteId: string): Promise { // Prefetch chat and group info. @@ -158,12 +158,12 @@ export class AddonModChatPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Prefetch chat session messages and user profiles. * - * @param {number} chatId Chat ID. - * @param {any} session Session object. - * @param {number} groupId Group ID. - * @param {number} courseId Course ID the module belongs to. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when done. + * @param chatId Chat ID. + * @param session Session object. + * @param groupId Group ID. + * @param courseId Course ID the module belongs to. + * @param siteId Site ID. + * @return Promise resolved when done. */ protected prefetchSession(chatId: number, session: any, groupId: number, courseId: number, siteId: string): Promise { return this.chatProvider.getSessionMessages(chatId, session.sessionstart, session.sessionend, groupId, true, siteId) diff --git a/src/addon/mod/choice/components/index/index.ts b/src/addon/mod/choice/components/index/index.ts index b543e4013..c5bcdc852 100644 --- a/src/addon/mod/choice/components/index/index.ts +++ b/src/addon/mod/choice/components/index/index.ts @@ -78,7 +78,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -96,8 +96,8 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo /** * Compares sync event data with current data to check if refresh content is needed. * - * @param {any} syncEventData Data receiven on sync observer. - * @return {boolean} True if refresh is needed, false otherwise. + * @param syncEventData Data receiven on sync observer. + * @return True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: any): boolean { if (this.choice && syncEventData.choiceId == this.choice.id && syncEventData.userId == this.userId) { @@ -112,10 +112,10 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo /** * Download choice contents. * - * @param {boolean} [refresh=false] If it's refreshing content. - * @param {boolean} [sync=false] If it should try to sync. - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved when done. + * @param refresh If it's refreshing content. + * @param sync If it should try to sync. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved when done. */ protected fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { this.now = new Date().getTime(); @@ -163,8 +163,8 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo /** * Convenience function to get choice options. * - * @param {boolean} hasOffline True if there are responses stored offline. - * @return {Promise} Promise resolved when done. + * @param hasOffline True if there are responses stored offline. + * @return Promise resolved when done. */ protected fetchOptions(hasOffline: boolean): Promise { return this.choiceProvider.getOptions(this.choice.id).then((options) => { @@ -277,7 +277,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo /** * Convenience function to get choice results. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected fetchResults(): Promise { if (this.choiceNotOpenYet) { @@ -307,7 +307,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo /** * Check if a choice is open. * - * @return {boolean} True if choice is open, false otherwise. + * @return True if choice is open, false otherwise. */ protected isChoiceOpen(): boolean { return (this.choice.timeopen === 0 || this.choice.timeopen <= this.now) && @@ -317,7 +317,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo /** * Return true if the user has selected at least one option. * - * @return {boolean} True if the user has responded. + * @return True if the user has responded. */ canSave(): boolean { if (this.choice.allowmultiple) { @@ -391,8 +391,8 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo /** * Function to call when some data has changed. It will refresh/prefetch data. * - * @param {boolean} online Whether the data was sent to server or stored in offline. - * @return {Promise} Promise resolved when done. + * @param online Whether the data was sent to server or stored in offline. + * @return Promise resolved when done. */ protected dataUpdated(online: boolean): Promise { if (online && this.isPrefetched()) { @@ -413,7 +413,7 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo /** * Performs the sync of the activity. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected sync(): Promise { return this.choiceSync.syncChoice(this.choice.id, this.userId); @@ -422,8 +422,8 @@ export class AddonModChoiceIndexComponent extends CoreCourseModuleMainActivityCo /** * Checks if sync has succeed from result sync data. * - * @param {any} result Data returned on the sync function. - * @return {boolean} Whether it succeed or not. + * @param result Data returned on the sync function. + * @return Whether it succeed or not. */ protected hasSyncSucceed(result: any): boolean { return result.updated; diff --git a/src/addon/mod/choice/pages/index/index.ts b/src/addon/mod/choice/pages/index/index.ts index 1fb470cd4..432dba56c 100644 --- a/src/addon/mod/choice/pages/index/index.ts +++ b/src/addon/mod/choice/pages/index/index.ts @@ -40,7 +40,7 @@ export class AddonModChoiceIndexPage { /** * Update some data based on the choice instance. * - * @param {any} choice Choice instance. + * @param choice Choice instance. */ updateData(choice: any): void { this.title = choice.name || this.title; diff --git a/src/addon/mod/choice/providers/choice.ts b/src/addon/mod/choice/providers/choice.ts index 770afa6c0..b16119516 100644 --- a/src/addon/mod/choice/providers/choice.ts +++ b/src/addon/mod/choice/providers/choice.ts @@ -48,9 +48,9 @@ export class AddonModChoiceProvider { * - they're published after the choice is closed and it's closed, OR * - they're published after answering and the user has answered. * - * @param {any} choice Choice to check. - * @param {boolean} hasAnswered True if user has answered the choice, false otherwise. - * @return {boolean} True if the students can see the results. + * @param choice Choice to check. + * @param hasAnswered True if user has answered the choice, false otherwise. + * @return True if the students can see the results. */ canStudentSeeResults(choice: any, hasAnswered: boolean): boolean { const now = new Date().getTime(); @@ -64,12 +64,12 @@ export class AddonModChoiceProvider { /** * Delete responses from a choice. * - * @param {number} choiceId Choice ID. - * @param {string} name Choice name. - * @param {number} courseId Course ID the choice belongs to. - * @param {number[]} [responses] IDs of the answers. If not defined, delete all the answers of the current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if response was sent to server, false if stored in device. + * @param choiceId Choice ID. + * @param name Choice name. + * @param courseId Course ID the choice belongs to. + * @param responses IDs of the answers. If not defined, delete all the answers of the current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if response was sent to server, false if stored in device. */ deleteResponses(choiceId: number, name: string, courseId: number, responses?: number[], siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -106,10 +106,10 @@ export class AddonModChoiceProvider { /** * Delete responses from a choice. It will fail if offline or cannot connect. * - * @param {number} choiceId Choice ID. - * @param {number[]} [responses] IDs of the answers. If not defined, delete all the answers of the current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when responses are successfully deleted. + * @param choiceId Choice ID. + * @param responses IDs of the answers. If not defined, delete all the answers of the current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when responses are successfully deleted. */ deleteResponsesOnline(choiceId: number, responses?: number[], siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -140,8 +140,8 @@ export class AddonModChoiceProvider { /** * Get cache key for choice data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getChoiceDataCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'choice:' + courseId; @@ -150,8 +150,8 @@ export class AddonModChoiceProvider { /** * Get cache key for choice options WS calls. * - * @param {number} choiceId Choice ID. - * @return {string} Cache key. + * @param choiceId Choice ID. + * @return Cache key. */ protected getChoiceOptionsCacheKey(choiceId: number): string { return this.ROOT_CACHE_KEY + 'options:' + choiceId; @@ -160,8 +160,8 @@ export class AddonModChoiceProvider { /** * Get cache key for choice results WS calls. * - * @param {number} choiceId Choice ID. - * @return {string} Cache key. + * @param choiceId Choice ID. + * @return Cache key. */ protected getChoiceResultsCacheKey(choiceId: number): string { return this.ROOT_CACHE_KEY + 'results:' + choiceId; @@ -170,13 +170,13 @@ export class AddonModChoiceProvider { /** * Get a choice with key=value. If more than one is found, only the first will be returned. * - * @param {string} siteId Site ID. - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {boolean} [forceCache] True to always get the value from cache, false otherwise. Default false. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise resolved when the choice is retrieved. + * @param siteId Site ID. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved when the choice is retrieved. */ protected getChoiceByDataKey(siteId: string, courseId: number, key: string, value: any, forceCache?: boolean, ignoreCache?: boolean): Promise { @@ -214,12 +214,12 @@ export class AddonModChoiceProvider { /** * Get a choice by course module ID. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [forceCache] True to always get the value from cache, false otherwise. Default false. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise resolved when the choice is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param siteId Site ID. If not defined, current site. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved when the choice is retrieved. */ getChoice(courseId: number, cmId: number, siteId?: string, forceCache?: boolean, ignoreCache?: boolean): Promise { return this.getChoiceByDataKey(siteId, courseId, 'coursemodule', cmId, forceCache, ignoreCache); @@ -228,12 +228,12 @@ export class AddonModChoiceProvider { /** * Get a choice by ID. * - * @param {number} courseId Course ID. - * @param {number} choiceId Choice ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [forceCache] True to always get the value from cache, false otherwise. Default false. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise resolved when the choice is retrieved. + * @param courseId Course ID. + * @param choiceId Choice ID. + * @param siteId Site ID. If not defined, current site. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved when the choice is retrieved. */ getChoiceById(courseId: number, choiceId: number, siteId?: string, forceCache?: boolean, ignoreCache?: boolean): Promise { return this.getChoiceByDataKey(siteId, courseId, 'id', choiceId, forceCache, ignoreCache); @@ -242,10 +242,10 @@ export class AddonModChoiceProvider { /** * Get choice options. * - * @param {number} choiceId Choice ID. - * @param {boolean} [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. - * @return {Promise} Promise resolved with choice options. + * @param choiceId Choice ID. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with choice options. */ getOptions(choiceId: number, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -275,10 +275,10 @@ export class AddonModChoiceProvider { /** * Get choice results. * - * @param {number} choiceId Choice ID. - * @param {boolean} [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. - * @return {Promise} Promise resolved with choice results. + * @param choiceId Choice ID. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with choice results. */ getResults(choiceId: number, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -307,9 +307,9 @@ export class AddonModChoiceProvider { /** * Invalidate choice data. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateChoiceData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(null).then((site) => { @@ -320,10 +320,10 @@ export class AddonModChoiceProvider { /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when data is invalidated. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -346,9 +346,9 @@ export class AddonModChoiceProvider { /** * Invalidate choice options. * - * @param {number} choiceId Choice ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param choiceId Choice ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateOptions(choiceId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -359,9 +359,9 @@ export class AddonModChoiceProvider { /** * Invalidate choice results. * - * @param {number} choiceId Choice ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param choiceId Choice ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateResults(choiceId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -372,10 +372,10 @@ export class AddonModChoiceProvider { /** * Report the choice as being viewed. * - * @param {string} id Choice ID. - * @param {string} [name] Name of the choice. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Choice ID. + * @param name Name of the choice. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params = { @@ -389,12 +389,12 @@ export class AddonModChoiceProvider { /** * Send a response to a choice to Moodle. * - * @param {number} choiceId Choice ID. - * @param {string} name Choice name. - * @param {number} courseId Course ID the choice belongs to. - * @param {number[]} responses IDs of selected options. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if response was sent to server, false if stored in device. + * @param choiceId Choice ID. + * @param name Choice name. + * @param courseId Course ID the choice belongs to. + * @param responses IDs of selected options. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if response was sent to server, false if stored in device. */ submitResponse(choiceId: number, name: string, courseId: number, responses: number[], siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -430,10 +430,10 @@ export class AddonModChoiceProvider { /** * Send a response to a choice to Moodle. It will fail if offline or cannot connect. * - * @param {number} choiceId Choice ID. - * @param {number[]} responses IDs of selected options. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when responses are successfully submitted. + * @param choiceId Choice ID. + * @param responses IDs of selected options. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when responses are successfully submitted. */ submitResponseOnline(choiceId: number, responses: number[], siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/mod/choice/providers/module-handler.ts b/src/addon/mod/choice/providers/module-handler.ts index cc2448da9..789e59508 100644 --- a/src/addon/mod/choice/providers/module-handler.ts +++ b/src/addon/mod/choice/providers/module-handler.ts @@ -44,7 +44,7 @@ export class AddonModChoiceModuleHandler implements CoreCourseModuleHandler { /** * 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 { return true; @@ -53,10 +53,10 @@ export class AddonModChoiceModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { return { @@ -78,9 +78,9 @@ export class AddonModChoiceModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModChoiceIndexComponent; diff --git a/src/addon/mod/choice/providers/offline.ts b/src/addon/mod/choice/providers/offline.ts index b4193f380..0b8e4294e 100644 --- a/src/addon/mod/choice/providers/offline.ts +++ b/src/addon/mod/choice/providers/offline.ts @@ -72,10 +72,10 @@ export class AddonModChoiceOfflineProvider { /** * Delete a response. * - * @param {number} choiceId Choice ID to remove. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the responses belong to. If not defined, current user in site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param choiceId Choice ID to remove. + * @param siteId Site ID. If not defined, current site. + * @param userId User the responses belong to. If not defined, current user in site. + * @return Promise resolved if stored, rejected if failure. */ deleteResponse(choiceId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -88,8 +88,8 @@ export class AddonModChoiceOfflineProvider { /** * Get all offline responses. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promi[se resolved with responses. + * @param siteId Site ID. If not defined, current site. + * @return Promi[se resolved with responses. */ getResponses(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -106,10 +106,10 @@ export class AddonModChoiceOfflineProvider { /** * Check if there are offline responses to send. * - * @param {number} choiceId Choice ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the responses belong to. If not defined, current user in site. - * @return {Promise} Promise resolved with boolean: true if has offline answers, false otherwise. + * @param choiceId Choice ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User the responses belong to. If not defined, current user in site. + * @return Promise resolved with boolean: true if has offline answers, false otherwise. */ hasResponse(choiceId: number, siteId?: string, userId?: number): Promise { return this.getResponse(choiceId, siteId, userId).then((response) => { @@ -123,10 +123,10 @@ export class AddonModChoiceOfflineProvider { /** * Get response to be synced. * - * @param {number} choiceId Choice ID to get. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the responses belong to. If not defined, current user in site. - * @return {Promise} Promise resolved with the object to be synced. + * @param choiceId Choice ID to get. + * @param siteId Site ID. If not defined, current site. + * @param userId User the responses belong to. If not defined, current user in site. + * @return Promise resolved with the object to be synced. */ getResponse(choiceId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -144,14 +144,14 @@ export class AddonModChoiceOfflineProvider { /** * Offline version for sending a response to a choice to Moodle. * - * @param {number} choiceId Choice ID. - * @param {string} name Choice name. - * @param {number} courseId Course ID the choice belongs to. - * @param {number[]} responses IDs of selected options. - * @param {boolean} deleting If true, the user is deleting responses, if false, submitting. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the responses belong to. If not defined, current user in site. - * @return {Promise} Promise resolved when results are successfully submitted. + * @param choiceId Choice ID. + * @param name Choice name. + * @param courseId Course ID the choice belongs to. + * @param responses IDs of selected options. + * @param deleting If true, the user is deleting responses, if false, submitting. + * @param siteId Site ID. If not defined, current site. + * @param userId User the responses belong to. If not defined, current user in site. + * @return Promise resolved when results are successfully submitted. */ saveResponse(choiceId: number, name: string, courseId: number, responses: number[], deleting: boolean, siteId?: string, userId?: number): Promise { diff --git a/src/addon/mod/choice/providers/prefetch-handler.ts b/src/addon/mod/choice/providers/prefetch-handler.ts index eb8a72d4b..053304bfe 100644 --- a/src/addon/mod/choice/providers/prefetch-handler.ts +++ b/src/addon/mod/choice/providers/prefetch-handler.ts @@ -48,11 +48,11 @@ export class AddonModChoicePrefetchHandler extends CoreCourseActivityPrefetchHan /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string): Promise { return this.prefetchPackage(module, courseId, single, this.prefetchChoice.bind(this)); @@ -61,11 +61,11 @@ export class AddonModChoicePrefetchHandler extends CoreCourseActivityPrefetchHan /** * Prefetch a choice. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} single True if we're downloading a single module, false if we're downloading a whole section. - * @param {String} siteId Site ID. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. + * @return Promise resolved when done. */ protected prefetchChoice(module: any, courseId: number, single: boolean, siteId: string): Promise { return this.choiceProvider.getChoice(courseId, module.id, siteId, false, true).then((choice) => { @@ -103,9 +103,9 @@ export class AddonModChoicePrefetchHandler extends CoreCourseActivityPrefetchHan /** * Returns choice intro files. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved with list of intro files. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @return Promise resolved with list of intro files. */ getIntroFiles(module: any, courseId: number): Promise { return this.choiceProvider.getChoice(courseId, module.id).catch(() => { @@ -118,9 +118,9 @@ export class AddonModChoicePrefetchHandler extends CoreCourseActivityPrefetchHan /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.choiceProvider.invalidateContent(moduleId, courseId); @@ -129,9 +129,9 @@ export class AddonModChoicePrefetchHandler extends CoreCourseActivityPrefetchHan /** * Invalidate WS calls needed to determine module status. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule(module: any, courseId: number): Promise { return this.choiceProvider.invalidateChoiceData(courseId); @@ -140,10 +140,10 @@ export class AddonModChoicePrefetchHandler extends CoreCourseActivityPrefetchHan /** * Sync a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ sync(module: any, courseId: number, siteId?: any): Promise { if (!this.syncProvider) { diff --git a/src/addon/mod/choice/providers/sync-cron-handler.ts b/src/addon/mod/choice/providers/sync-cron-handler.ts index 92d88b52b..92c2317a7 100644 --- a/src/addon/mod/choice/providers/sync-cron-handler.ts +++ b/src/addon/mod/choice/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class AddonModChoiceSyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.choiceSync.syncAllChoices(siteId, force); @@ -40,7 +40,7 @@ export class AddonModChoiceSyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return this.choiceSync.syncInterval; diff --git a/src/addon/mod/choice/providers/sync.ts b/src/addon/mod/choice/providers/sync.ts index 965a1b06d..7d381308e 100644 --- a/src/addon/mod/choice/providers/sync.ts +++ b/src/addon/mod/choice/providers/sync.ts @@ -56,9 +56,9 @@ export class AddonModChoiceSyncProvider extends CoreCourseActivitySyncBaseProvid /** * Get the ID of a choice sync. * - * @param {number} choiceId Choice ID. - * @param {number} userId User the responses belong to. - * @return {string} Sync ID. + * @param choiceId Choice ID. + * @param userId User the responses belong to. + * @return Sync ID. */ protected getSyncId(choiceId: number, userId: number): string { return choiceId + '#' + userId; @@ -67,9 +67,9 @@ export class AddonModChoiceSyncProvider extends CoreCourseActivitySyncBaseProvid /** * Try to synchronize all the choices in a certain site or in all sites. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} force Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncAllChoices(siteId?: string, force?: boolean): Promise { return this.syncOnSites('choices', this.syncAllChoicesFunc.bind(this), [force], siteId); @@ -78,9 +78,9 @@ export class AddonModChoiceSyncProvider extends CoreCourseActivitySyncBaseProvid /** * Sync all pending choices on a site. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} force Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ protected syncAllChoicesFunc(siteId?: string, force?: boolean): Promise { return this.choiceOffline.getResponses(siteId).then((responses) => { @@ -108,10 +108,10 @@ export class AddonModChoiceSyncProvider extends CoreCourseActivitySyncBaseProvid /** * Sync an choice only if a certain time has passed since the last time. * - * @param {number} choiceId Choice ID to be synced. - * @param {number} userId User the answers belong to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the choice is synced or it doesn't need to be synced. + * @param choiceId Choice ID to be synced. + * @param userId User the answers belong to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the choice is synced or it doesn't need to be synced. */ syncChoiceIfNeeded(choiceId: number, userId: number, siteId?: string): Promise { const syncId = this.getSyncId(choiceId, userId); @@ -126,10 +126,10 @@ export class AddonModChoiceSyncProvider extends CoreCourseActivitySyncBaseProvid /** * Synchronize a choice. * - * @param {number} choiceId Choice ID to be synced. - * @param {number} [userId] User the answers belong to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param choiceId Choice ID to be synced. + * @param userId User the answers belong to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncChoice(choiceId: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/mod/data/classes/field-plugin-component.ts b/src/addon/mod/data/classes/field-plugin-component.ts index 9265a9ff6..62c12f13e 100644 --- a/src/addon/mod/data/classes/field-plugin-component.ts +++ b/src/addon/mod/data/classes/field-plugin-component.ts @@ -34,8 +34,8 @@ export class AddonModDataFieldPluginComponent implements OnInit, OnChanges { /** * Add the form control for the search mode. * - * @param {string} fieldName Control field name. - * @param {any} value Initial set value. + * @param fieldName Control field name. + * @param value Initial set value. */ protected addControl(fieldName: string, value?: any): void { if (!this.form) { @@ -68,7 +68,7 @@ export class AddonModDataFieldPluginComponent implements OnInit, OnChanges { /** * Return if is shown or list mode. * - * @return {boolean} True if mode is show or list. + * @return True if mode is show or list. */ isShowOrListMode(): boolean { return this.mode == 'list' || this.mode == 'show'; diff --git a/src/addon/mod/data/components/action/action.ts b/src/addon/mod/data/components/action/action.ts index b96dc078d..b7bca0b40 100644 --- a/src/addon/mod/data/components/action/action.ts +++ b/src/addon/mod/data/components/action/action.ts @@ -117,7 +117,7 @@ export class AddonModDataActionComponent implements OnInit { /** * Undo delete action. * - * @return {Promise} Solved when done. + * @return Solved when done. */ undoDelete(): Promise { const dataId = this.database.id, diff --git a/src/addon/mod/data/components/index/index.ts b/src/addon/mod/data/components/index/index.ts index bc3463842..ab8998c2d 100644 --- a/src/addon/mod/data/components/index/index.ts +++ b/src/addon/mod/data/components/index/index.ts @@ -141,7 +141,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -166,8 +166,8 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp /** * Compares sync event data with current data to check if refresh content is needed. * - * @param {any} syncEventData Data receiven on sync observer. - * @return {boolean} True if refresh is needed, false otherwise. + * @param syncEventData Data receiven on sync observer. + * @return True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: any): boolean { if (this.data && syncEventData.dataId == this.data.id && typeof syncEventData.entryId == 'undefined') { @@ -184,10 +184,10 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp /** * Download data contents. * - * @param {boolean} [refresh=false] If it's refreshing content. - * @param {boolean} [sync=false] If it should try to sync. - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved when done. + * @param refresh If it's refreshing content. + * @param sync If it should try to sync. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved when done. */ protected fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { let canAdd = false, @@ -259,7 +259,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp /** * Fetch current database entries. * - * @return {Promise} Resolved then done. + * @return Resolved then done. */ protected fetchEntriesData(): Promise { @@ -356,8 +356,8 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp /** * Performs the search and closes the modal. * - * @param {number} page Page number. - * @return {Promise} Resolved when done. + * @param page Page number. + * @return Resolved when done. */ searchEntries(page: number): Promise { this.loaded = false; @@ -386,8 +386,8 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp /** * Set group to see the database. * - * @param {number} groupId Group ID. - * @return {Promise} Resolved when new group is selected or rejected if not. + * @param groupId Group ID. + * @return Resolved when new group is selected or rejected if not. */ setGroup(groupId: number): Promise { this.selectedGroup = groupId; @@ -416,7 +416,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp /** * Goto the selected entry. * - * @param {number} entryId Entry ID. + * @param entryId Entry ID. */ gotoEntry(entryId: number): void { const params = { @@ -439,7 +439,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp /** * Performs the sync of the activity. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected sync(): Promise { return this.prefetchHandler.sync(this.module, this.courseId); @@ -448,8 +448,8 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp /** * Checks if sync has succeed from result sync data. * - * @param {any} result Data returned on the sync function. - * @return {boolean} If suceed or not. + * @param result Data returned on the sync function. + * @return If suceed or not. */ protected hasSyncSucceed(result: any): boolean { return result.updated; diff --git a/src/addon/mod/data/fields/checkbox/component/checkbox.ts b/src/addon/mod/data/fields/checkbox/component/checkbox.ts index 2db02302a..88a7d38c2 100644 --- a/src/addon/mod/data/fields/checkbox/component/checkbox.ts +++ b/src/addon/mod/data/fields/checkbox/component/checkbox.ts @@ -64,7 +64,7 @@ export class AddonModDataFieldCheckboxComponent extends AddonModDataFieldPluginC /** * Update value being shown. * - * @param {any} value New value to be set. + * @param value New value to be set. */ protected updateValue(value: any): void { this.value = value || {}; diff --git a/src/addon/mod/data/fields/checkbox/providers/handler.ts b/src/addon/mod/data/fields/checkbox/providers/handler.ts index 3c3009394..e0b5aceb5 100644 --- a/src/addon/mod/data/fields/checkbox/providers/handler.ts +++ b/src/addon/mod/data/fields/checkbox/providers/handler.ts @@ -30,9 +30,9 @@ export class AddonModDataFieldCheckboxHandler implements AddonModDataFieldHandle * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} field The field object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param field The field object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any): any | Promise { return AddonModDataFieldCheckboxComponent; @@ -41,9 +41,9 @@ export class AddonModDataFieldCheckboxHandler implements AddonModDataFieldHandle /** * Get field search data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the search form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the search form. + * @return With name and value of the data to be sent. */ getFieldSearchData(field: any, inputData: any): any { const fieldName = 'f_' + field.id, @@ -73,9 +73,9 @@ export class AddonModDataFieldCheckboxHandler implements AddonModDataFieldHandle /** * Get field edit data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return With name and value of the data to be sent. */ getFieldEditData(field: any, inputData: any, originalFieldData: any): any { const fieldName = 'f_' + field.id; @@ -89,10 +89,10 @@ export class AddonModDataFieldCheckboxHandler implements AddonModDataFieldHandle /** * Get field data in changed. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @param {any} originalFieldData Original field entered data. - * @return {Promise | boolean} If the field has changes. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @param originalFieldData Original field entered data. + * @return If the field has changes. */ hasFieldDataChanged(field: any, inputData: any, originalFieldData: any): Promise | boolean { const fieldName = 'f_' + field.id; @@ -105,9 +105,9 @@ export class AddonModDataFieldCheckboxHandler implements AddonModDataFieldHandle /** * Check and get field requeriments. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {string | false} String with the notification or false. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return String with the notification or false. */ getFieldsNotifications(field: any, inputData: any): string | false { if (field.required && (!inputData || !inputData.length || !inputData[0].value)) { @@ -120,10 +120,10 @@ export class AddonModDataFieldCheckboxHandler implements AddonModDataFieldHandle /** * Override field content data with offline submission. * - * @param {any} originalContent Original data to be overriden. - * @param {any} offlineContent Array with all the offline data to override. - * @param {any} [offlineFiles] Array with all the offline files in the field. - * @return {any} Data overriden + * @param originalContent Original data to be overriden. + * @param offlineContent Array with all the offline data to override. + * @param offlineFiles Array with all the offline files in the field. + * @return Data overriden */ overrideData(originalContent: any, offlineContent: any, offlineFiles?: any): any { originalContent.content = (offlineContent[''] && offlineContent[''].join('##')) || ''; @@ -134,7 +134,7 @@ export class AddonModDataFieldCheckboxHandler implements AddonModDataFieldHandle /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/mod/data/fields/date/providers/handler.ts b/src/addon/mod/data/fields/date/providers/handler.ts index bf9d65079..8c4988971 100644 --- a/src/addon/mod/data/fields/date/providers/handler.ts +++ b/src/addon/mod/data/fields/date/providers/handler.ts @@ -31,9 +31,9 @@ export class AddonModDataFieldDateHandler implements AddonModDataFieldHandler { * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} field The field object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param field The field object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any): any | Promise { return AddonModDataFieldDateComponent; @@ -42,9 +42,9 @@ export class AddonModDataFieldDateHandler implements AddonModDataFieldHandler { /** * Get field search data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the search form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the search form. + * @return With name and value of the data to be sent. */ getFieldSearchData(field: any, inputData: any): any { const fieldName = 'f_' + field.id, @@ -82,9 +82,9 @@ export class AddonModDataFieldDateHandler implements AddonModDataFieldHandler { /** * Get field edit data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return With name and value of the data to be sent. */ getFieldEditData(field: any, inputData: any, originalFieldData: any): any { const fieldName = 'f_' + field.id; @@ -120,10 +120,10 @@ export class AddonModDataFieldDateHandler implements AddonModDataFieldHandler { /** * Get field data in changed. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @param {any} originalFieldData Original field entered data. - * @return {Promise | boolean} If the field has changes. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @param originalFieldData Original field entered data. + * @return If the field has changes. */ hasFieldDataChanged(field: any, inputData: any, originalFieldData: any): Promise | boolean { const fieldName = 'f_' + field.id, @@ -138,9 +138,9 @@ export class AddonModDataFieldDateHandler implements AddonModDataFieldHandler { /** * Check and get field requeriments. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {string | false} String with the notification or false. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return String with the notification or false. */ getFieldsNotifications(field: any, inputData: any): string | false { if (field.required && @@ -155,10 +155,10 @@ export class AddonModDataFieldDateHandler implements AddonModDataFieldHandler { /** * Override field content data with offline submission. * - * @param {any} originalContent Original data to be overriden. - * @param {any} offlineContent Array with all the offline data to override. - * @param {any} [offlineFiles] Array with all the offline files in the field. - * @return {any} Data overriden + * @param originalContent Original data to be overriden. + * @param offlineContent Array with all the offline data to override. + * @param offlineFiles Array with all the offline files in the field. + * @return Data overriden */ overrideData(originalContent: any, offlineContent: any, offlineFiles?: any): any { let date = Date.UTC(offlineContent['year'] || '', offlineContent['month'] ? offlineContent['month'] - 1 : null, @@ -173,7 +173,7 @@ export class AddonModDataFieldDateHandler implements AddonModDataFieldHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/mod/data/fields/file/component/file.ts b/src/addon/mod/data/fields/file/component/file.ts index 3522076fc..b5341afca 100644 --- a/src/addon/mod/data/fields/file/component/file.ts +++ b/src/addon/mod/data/fields/file/component/file.ts @@ -38,8 +38,8 @@ export class AddonModDataFieldFileComponent extends AddonModDataFieldPluginCompo /** * Get the files from the input value. * - * @param {any} value Input value. - * @return {any} List of files. + * @param value Input value. + * @return List of files. */ protected getFiles(value: any): any { let files = (value && value.files) || []; @@ -74,7 +74,7 @@ export class AddonModDataFieldFileComponent extends AddonModDataFieldPluginCompo /** * Update value being shown. * - * @param {any} value New value to be set. + * @param value New value to be set. */ protected updateValue(value: any): void { this.value = value; diff --git a/src/addon/mod/data/fields/file/providers/handler.ts b/src/addon/mod/data/fields/file/providers/handler.ts index d6e10b4b1..db6706a14 100644 --- a/src/addon/mod/data/fields/file/providers/handler.ts +++ b/src/addon/mod/data/fields/file/providers/handler.ts @@ -34,9 +34,9 @@ export class AddonModDataFieldFileHandler implements AddonModDataFieldHandler { * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} field The field object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param field The field object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any): any | Promise { return AddonModDataFieldFileComponent; @@ -45,9 +45,9 @@ export class AddonModDataFieldFileHandler implements AddonModDataFieldHandler { /** * Get field search data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the search form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the search form. + * @return With name and value of the data to be sent. */ getFieldSearchData(field: any, inputData: any): any { const fieldName = 'f_' + field.id; @@ -65,9 +65,9 @@ export class AddonModDataFieldFileHandler implements AddonModDataFieldHandler { /** * Get field edit data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return With name and value of the data to be sent. */ getFieldEditData(field: any, inputData: any, originalFieldData: any): any { const files = this.getFieldEditFiles(field); @@ -82,8 +82,8 @@ export class AddonModDataFieldFileHandler implements AddonModDataFieldHandler { /** * Get field edit files in the input data. * - * @param {any} field Defines the field.. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field.. + * @return With name and value of the data to be sent. */ getFieldEditFiles(field: any): any { return this.fileSessionprovider.getFiles(AddonModDataProvider.COMPONENT, field.dataid + '_' + field.id); @@ -92,10 +92,10 @@ export class AddonModDataFieldFileHandler implements AddonModDataFieldHandler { /** * Get field data in changed. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @param {any} originalFieldData Original field entered data. - * @return {Promise | boolean} If the field has changes. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @param originalFieldData Original field entered data. + * @return If the field has changes. */ hasFieldDataChanged(field: any, inputData: any, originalFieldData: any): Promise | boolean { const files = this.fileSessionprovider.getFiles(AddonModDataProvider.COMPONENT, field.dataid + '_' + field.id) || []; @@ -111,9 +111,9 @@ export class AddonModDataFieldFileHandler implements AddonModDataFieldHandler { /** * Check and get field requeriments. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {string | false} String with the notification or false. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return String with the notification or false. */ getFieldsNotifications(field: any, inputData: any): string | false { if (field.required && (!inputData || !inputData.length || !inputData[0].value)) { @@ -126,10 +126,10 @@ export class AddonModDataFieldFileHandler implements AddonModDataFieldHandler { /** * Override field content data with offline submission. * - * @param {any} originalContent Original data to be overriden. - * @param {any} offlineContent Array with all the offline data to override. - * @param {any} [offlineFiles] Array with all the offline files in the field. - * @return {any} Data overriden + * @param originalContent Original data to be overriden. + * @param offlineContent Array with all the offline data to override. + * @param offlineFiles Array with all the offline files in the field. + * @return Data overriden */ overrideData(originalContent: any, offlineContent: any, offlineFiles?: any): any { if (offlineContent && offlineContent.file && offlineContent.file.offline > 0 && offlineFiles && offlineFiles.length > 0) { @@ -146,7 +146,7 @@ export class AddonModDataFieldFileHandler implements AddonModDataFieldHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/mod/data/fields/latlong/component/latlong.ts b/src/addon/mod/data/fields/latlong/component/latlong.ts index bef58067f..03f912cc3 100644 --- a/src/addon/mod/data/fields/latlong/component/latlong.ts +++ b/src/addon/mod/data/fields/latlong/component/latlong.ts @@ -35,9 +35,9 @@ export class AddonModDataFieldLatlongComponent extends AddonModDataFieldPluginCo /** * Format latitude and longitude in a simple text. * - * @param {number} north Degrees north. - * @param {number} east Degrees East. - * @return {string} Readable Latitude and logitude. + * @param north Degrees north. + * @param east Degrees East. + * @return Readable Latitude and logitude. */ formatLatLong(north: number, east: number): string { if (north !== null || east !== null) { @@ -51,9 +51,9 @@ export class AddonModDataFieldLatlongComponent extends AddonModDataFieldPluginCo /** * Get link to maps from latitude and longitude. * - * @param {number} north Degrees north. - * @param {number} east Degrees East. - * @return {string} Link to maps depending on platform. + * @param north Degrees north. + * @param east Degrees East. + * @return Link to maps depending on platform. */ getLatLongLink(north: number, east: number): string { if (north !== null || east !== null) { @@ -87,7 +87,7 @@ export class AddonModDataFieldLatlongComponent extends AddonModDataFieldPluginCo /** * Update value being shown. * - * @param {any} value New value to be set. + * @param value New value to be set. */ protected updateValue(value: any): void { this.value = value; diff --git a/src/addon/mod/data/fields/latlong/providers/handler.ts b/src/addon/mod/data/fields/latlong/providers/handler.ts index 606db2878..941466e83 100644 --- a/src/addon/mod/data/fields/latlong/providers/handler.ts +++ b/src/addon/mod/data/fields/latlong/providers/handler.ts @@ -30,9 +30,9 @@ export class AddonModDataFieldLatlongHandler implements AddonModDataFieldHandler * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} field The field object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param field The field object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any): any | Promise { return AddonModDataFieldLatlongComponent; @@ -41,9 +41,9 @@ export class AddonModDataFieldLatlongHandler implements AddonModDataFieldHandler /** * Get field search data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the search form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the search form. + * @return With name and value of the data to be sent. */ getFieldSearchData(field: any, inputData: any): any { const fieldName = 'f_' + field.id; @@ -61,9 +61,9 @@ export class AddonModDataFieldLatlongHandler implements AddonModDataFieldHandler /** * Get field edit data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return With name and value of the data to be sent. */ getFieldEditData(field: any, inputData: any, originalFieldData: any): any { const fieldName = 'f_' + field.id; @@ -85,10 +85,10 @@ export class AddonModDataFieldLatlongHandler implements AddonModDataFieldHandler /** * Get field data in changed. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @param {any} originalFieldData Original field entered data. - * @return {Promise | boolean} If the field has changes. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @param originalFieldData Original field entered data. + * @return If the field has changes. */ hasFieldDataChanged(field: any, inputData: any, originalFieldData: any): Promise | boolean { const fieldName = 'f_' + field.id, @@ -103,9 +103,9 @@ export class AddonModDataFieldLatlongHandler implements AddonModDataFieldHandler /** * Check and get field requeriments. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {string | false} String with the notification or false. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return String with the notification or false. */ getFieldsNotifications(field: any, inputData: any): string | false { let valueCount = 0; @@ -130,10 +130,10 @@ export class AddonModDataFieldLatlongHandler implements AddonModDataFieldHandler /** * Override field content data with offline submission. * - * @param {any} originalContent Original data to be overriden. - * @param {any} offlineContent Array with all the offline data to override. - * @param {any} [offlineFiles] Array with all the offline files in the field. - * @return {any} Data overriden + * @param originalContent Original data to be overriden. + * @param offlineContent Array with all the offline data to override. + * @param offlineFiles Array with all the offline files in the field. + * @return Data overriden */ overrideData(originalContent: any, offlineContent: any, offlineFiles?: any): any { originalContent.content = offlineContent[0] || ''; @@ -145,7 +145,7 @@ export class AddonModDataFieldLatlongHandler implements AddonModDataFieldHandler /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/mod/data/fields/menu/providers/handler.ts b/src/addon/mod/data/fields/menu/providers/handler.ts index e8427cc66..6a928f5a5 100644 --- a/src/addon/mod/data/fields/menu/providers/handler.ts +++ b/src/addon/mod/data/fields/menu/providers/handler.ts @@ -30,9 +30,9 @@ export class AddonModDataFieldMenuHandler implements AddonModDataFieldHandler { * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} field The field object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param field The field object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any): any | Promise { return AddonModDataFieldMenuComponent; @@ -41,9 +41,9 @@ export class AddonModDataFieldMenuHandler implements AddonModDataFieldHandler { /** * Get field search data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the search form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the search form. + * @return With name and value of the data to be sent. */ getFieldSearchData(field: any, inputData: any): any { const fieldName = 'f_' + field.id; @@ -60,9 +60,9 @@ export class AddonModDataFieldMenuHandler implements AddonModDataFieldHandler { /** * Get field edit data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return With name and value of the data to be sent. */ getFieldEditData(field: any, inputData: any, originalFieldData: any): any { const fieldName = 'f_' + field.id; @@ -80,10 +80,10 @@ export class AddonModDataFieldMenuHandler implements AddonModDataFieldHandler { /** * Get field data in changed. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @param {any} originalFieldData Original field entered data. - * @return {Promise | boolean} If the field has changes. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @param originalFieldData Original field entered data. + * @return If the field has changes. */ hasFieldDataChanged(field: any, inputData: any, originalFieldData: any): Promise | boolean { const fieldName = 'f_' + field.id, @@ -96,9 +96,9 @@ export class AddonModDataFieldMenuHandler implements AddonModDataFieldHandler { /** * Check and get field requeriments. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {string | false} String with the notification or false. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return String with the notification or false. */ getFieldsNotifications(field: any, inputData: any): string | false { if (field.required && (!inputData || !inputData.length || !inputData[0].value)) { @@ -111,10 +111,10 @@ export class AddonModDataFieldMenuHandler implements AddonModDataFieldHandler { /** * Override field content data with offline submission. * - * @param {any} originalContent Original data to be overriden. - * @param {any} offlineContent Array with all the offline data to override. - * @param {any} [offlineFiles] Array with all the offline files in the field. - * @return {any} Data overriden + * @param originalContent Original data to be overriden. + * @param offlineContent Array with all the offline data to override. + * @param offlineFiles Array with all the offline files in the field. + * @return Data overriden */ overrideData(originalContent: any, offlineContent: any, offlineFiles?: any): any { originalContent.content = offlineContent[''] || ''; @@ -125,7 +125,7 @@ export class AddonModDataFieldMenuHandler implements AddonModDataFieldHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/mod/data/fields/multimenu/component/multimenu.ts b/src/addon/mod/data/fields/multimenu/component/multimenu.ts index b31800229..933687535 100644 --- a/src/addon/mod/data/fields/multimenu/component/multimenu.ts +++ b/src/addon/mod/data/fields/multimenu/component/multimenu.ts @@ -64,7 +64,7 @@ export class AddonModDataFieldMultimenuComponent extends AddonModDataFieldPlugin /** * Update value being shown. * - * @param {any} value New value to be set. + * @param value New value to be set. */ protected updateValue(value: any): void { this.value = value || {}; diff --git a/src/addon/mod/data/fields/multimenu/providers/handler.ts b/src/addon/mod/data/fields/multimenu/providers/handler.ts index 0522bc304..060583426 100644 --- a/src/addon/mod/data/fields/multimenu/providers/handler.ts +++ b/src/addon/mod/data/fields/multimenu/providers/handler.ts @@ -30,9 +30,9 @@ export class AddonModDataFieldMultimenuHandler implements AddonModDataFieldHandl * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} field The field object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param field The field object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any): any | Promise { return AddonModDataFieldMultimenuComponent; @@ -41,9 +41,9 @@ export class AddonModDataFieldMultimenuHandler implements AddonModDataFieldHandl /** * Get field search data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the search form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the search form. + * @return With name and value of the data to be sent. */ getFieldSearchData(field: any, inputData: any): any { const fieldName = 'f_' + field.id, @@ -73,9 +73,9 @@ export class AddonModDataFieldMultimenuHandler implements AddonModDataFieldHandl /** * Get field edit data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return With name and value of the data to be sent. */ getFieldEditData(field: any, inputData: any, originalFieldData: any): any { const fieldName = 'f_' + field.id; @@ -89,10 +89,10 @@ export class AddonModDataFieldMultimenuHandler implements AddonModDataFieldHandl /** * Get field data in changed. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @param {any} originalFieldData Original field entered data. - * @return {Promise | boolean} If the field has changes. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @param originalFieldData Original field entered data. + * @return If the field has changes. */ hasFieldDataChanged(field: any, inputData: any, originalFieldData: any): Promise | boolean { const fieldName = 'f_' + field.id; @@ -105,9 +105,9 @@ export class AddonModDataFieldMultimenuHandler implements AddonModDataFieldHandl /** * Check and get field requeriments. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {string | false} String with the notification or false. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return String with the notification or false. */ getFieldsNotifications(field: any, inputData: any): string | false { if (field.required && (!inputData || !inputData.length || !inputData[0].value)) { @@ -120,10 +120,10 @@ export class AddonModDataFieldMultimenuHandler implements AddonModDataFieldHandl /** * Override field content data with offline submission. * - * @param {any} originalContent Original data to be overriden. - * @param {any} offlineContent Array with all the offline data to override. - * @param {any} [offlineFiles] Array with all the offline files in the field. - * @return {any} Data overriden + * @param originalContent Original data to be overriden. + * @param offlineContent Array with all the offline data to override. + * @param offlineFiles Array with all the offline files in the field. + * @return Data overriden */ overrideData(originalContent: any, offlineContent: any, offlineFiles?: any): any { originalContent.content = (offlineContent[''] && offlineContent[''].join('##')) || ''; @@ -134,7 +134,7 @@ export class AddonModDataFieldMultimenuHandler implements AddonModDataFieldHandl /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/mod/data/fields/number/providers/handler.ts b/src/addon/mod/data/fields/number/providers/handler.ts index 62308e6b5..e40100258 100644 --- a/src/addon/mod/data/fields/number/providers/handler.ts +++ b/src/addon/mod/data/fields/number/providers/handler.ts @@ -32,9 +32,9 @@ export class AddonModDataFieldNumberHandler extends AddonModDataFieldTextHandler * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} field The field object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param field The field object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any): any | Promise { return AddonModDataFieldNumberComponent; @@ -43,10 +43,10 @@ export class AddonModDataFieldNumberHandler extends AddonModDataFieldTextHandler /** * Get field data in changed. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @param {any} originalFieldData Original field entered data. - * @return {Promise | boolean} If the field has changes. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @param originalFieldData Original field entered data. + * @return If the field has changes. */ hasFieldDataChanged(field: any, inputData: any, originalFieldData: any): Promise | boolean { const fieldName = 'f_' + field.id; @@ -59,9 +59,9 @@ export class AddonModDataFieldNumberHandler extends AddonModDataFieldTextHandler /** * Check and get field requeriments. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {string | false} String with the notification or false. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return String with the notification or false. */ getFieldsNotifications(field: any, inputData: any): string | false { if (field.required && (!inputData || !inputData.length || inputData[0].value == '')) { diff --git a/src/addon/mod/data/fields/picture/component/picture.ts b/src/addon/mod/data/fields/picture/component/picture.ts index 0c5836efa..ab639cf6d 100644 --- a/src/addon/mod/data/fields/picture/component/picture.ts +++ b/src/addon/mod/data/fields/picture/component/picture.ts @@ -47,8 +47,8 @@ export class AddonModDataFieldPictureComponent extends AddonModDataFieldPluginCo /** * Get the files from the input value. * - * @param {any} value Input value. - * @return {any} List of files. + * @param value Input value. + * @return List of files. */ protected getFiles(value: any): any { let files = (value && value.files) || []; @@ -64,9 +64,9 @@ export class AddonModDataFieldPictureComponent extends AddonModDataFieldPluginCo /** * Find file in a list. * - * @param {any[]} files File list where to search. - * @param {string} filenameSeek Filename to search. - * @return {any} File found or false. + * @param files File list where to search. + * @param filenameSeek Filename to search. + * @return File found or false. */ protected findFile(files: any[], filenameSeek: string): any { return files.find((file) => file.filename == filenameSeek) || false; @@ -97,7 +97,7 @@ export class AddonModDataFieldPictureComponent extends AddonModDataFieldPluginCo /** * Update value being shown. * - * @param {any} value New value to be set. + * @param value New value to be set. */ protected updateValue(value: any): void { this.value = value; diff --git a/src/addon/mod/data/fields/picture/providers/handler.ts b/src/addon/mod/data/fields/picture/providers/handler.ts index 89abf7009..bd343ecd0 100644 --- a/src/addon/mod/data/fields/picture/providers/handler.ts +++ b/src/addon/mod/data/fields/picture/providers/handler.ts @@ -34,9 +34,9 @@ export class AddonModDataFieldPictureHandler implements AddonModDataFieldHandler * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} field The field object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param field The field object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any): any | Promise { return AddonModDataFieldPictureComponent; @@ -45,9 +45,9 @@ export class AddonModDataFieldPictureHandler implements AddonModDataFieldHandler /** * Get field search data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the search form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the search form. + * @return With name and value of the data to be sent. */ getFieldSearchData(field: any, inputData: any): any { const fieldName = 'f_' + field.id; @@ -65,9 +65,9 @@ export class AddonModDataFieldPictureHandler implements AddonModDataFieldHandler /** * Get field edit data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return With name and value of the data to be sent. */ getFieldEditData(field: any, inputData: any, originalFieldData: any): any { const files = this.getFieldEditFiles(field); @@ -90,8 +90,8 @@ export class AddonModDataFieldPictureHandler implements AddonModDataFieldHandler /** * Get field edit files in the input data. * - * @param {any} field Defines the field.. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field.. + * @return With name and value of the data to be sent. */ getFieldEditFiles(field: any): any { return this.fileSessionprovider.getFiles(AddonModDataProvider.COMPONENT, field.dataid + '_' + field.id); @@ -100,10 +100,10 @@ export class AddonModDataFieldPictureHandler implements AddonModDataFieldHandler /** * Get field data in changed. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @param {any} originalFieldData Original field entered data. - * @return {Promise | boolean} If the field has changes. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @param originalFieldData Original field entered data. + * @return If the field has changes. */ hasFieldDataChanged(field: any, inputData: any, originalFieldData: any): Promise | boolean { const fieldName = 'f_' + field.id + '_alttext', @@ -129,9 +129,9 @@ export class AddonModDataFieldPictureHandler implements AddonModDataFieldHandler /** * Check and get field requeriments. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {string | false} String with the notification or false. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return String with the notification or false. */ getFieldsNotifications(field: any, inputData: any): string | false { if (field.required) { @@ -158,10 +158,10 @@ export class AddonModDataFieldPictureHandler implements AddonModDataFieldHandler /** * Override field content data with offline submission. * - * @param {any} originalContent Original data to be overriden. - * @param {any} offlineContent Array with all the offline data to override. - * @param {any} [offlineFiles] Array with all the offline files in the field. - * @return {any} Data overriden + * @param originalContent Original data to be overriden. + * @param offlineContent Array with all the offline data to override. + * @param offlineFiles Array with all the offline files in the field. + * @return Data overriden */ overrideData(originalContent: any, offlineContent: any, offlineFiles?: any): any { if (offlineContent && offlineContent.file && offlineContent.file.offline > 0 && offlineFiles && offlineFiles.length > 0) { @@ -180,7 +180,7 @@ export class AddonModDataFieldPictureHandler implements AddonModDataFieldHandler /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/mod/data/fields/radiobutton/providers/handler.ts b/src/addon/mod/data/fields/radiobutton/providers/handler.ts index a58b407bf..7025136e6 100644 --- a/src/addon/mod/data/fields/radiobutton/providers/handler.ts +++ b/src/addon/mod/data/fields/radiobutton/providers/handler.ts @@ -30,9 +30,9 @@ export class AddonModDataFieldRadiobuttonHandler implements AddonModDataFieldHan * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} field The field object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param field The field object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any): any | Promise { return AddonModDataFieldRadiobuttonComponent; @@ -41,9 +41,9 @@ export class AddonModDataFieldRadiobuttonHandler implements AddonModDataFieldHan /** * Get field search data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the search form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the search form. + * @return With name and value of the data to be sent. */ getFieldSearchData(field: any, inputData: any): any { const fieldName = 'f_' + field.id; @@ -60,9 +60,9 @@ export class AddonModDataFieldRadiobuttonHandler implements AddonModDataFieldHan /** * Get field edit data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return With name and value of the data to be sent. */ getFieldEditData(field: any, inputData: any, originalFieldData: any): any { const fieldName = 'f_' + field.id; @@ -76,10 +76,10 @@ export class AddonModDataFieldRadiobuttonHandler implements AddonModDataFieldHan /** * Get field data in changed. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @param {any} originalFieldData Original field entered data. - * @return {Promise | boolean} If the field has changes. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @param originalFieldData Original field entered data. + * @return If the field has changes. */ hasFieldDataChanged(field: any, inputData: any, originalFieldData: any): Promise | boolean { const fieldName = 'f_' + field.id, @@ -92,9 +92,9 @@ export class AddonModDataFieldRadiobuttonHandler implements AddonModDataFieldHan /** * Check and get field requeriments. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {string | false} String with the notification or false. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return String with the notification or false. */ getFieldsNotifications(field: any, inputData: any): string | false { if (field.required && (!inputData || !inputData.length || !inputData[0].value)) { @@ -107,10 +107,10 @@ export class AddonModDataFieldRadiobuttonHandler implements AddonModDataFieldHan /** * Override field content data with offline submission. * - * @param {any} originalContent Original data to be overriden. - * @param {any} offlineContent Array with all the offline data to override. - * @param {any} [offlineFiles] Array with all the offline files in the field. - * @return {any} Data overriden + * @param originalContent Original data to be overriden. + * @param offlineContent Array with all the offline data to override. + * @param offlineFiles Array with all the offline files in the field. + * @return Data overriden */ overrideData(originalContent: any, offlineContent: any, offlineFiles?: any): any { originalContent.content = offlineContent[''] || ''; @@ -121,7 +121,7 @@ export class AddonModDataFieldRadiobuttonHandler implements AddonModDataFieldHan /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/mod/data/fields/text/providers/handler.ts b/src/addon/mod/data/fields/text/providers/handler.ts index 1a4fa8c26..7ede2628e 100644 --- a/src/addon/mod/data/fields/text/providers/handler.ts +++ b/src/addon/mod/data/fields/text/providers/handler.ts @@ -30,9 +30,9 @@ export class AddonModDataFieldTextHandler implements AddonModDataFieldHandler { * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} field The field object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param field The field object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any): any | Promise { return AddonModDataFieldTextComponent; @@ -41,9 +41,9 @@ export class AddonModDataFieldTextHandler implements AddonModDataFieldHandler { /** * Get field search data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the search form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the search form. + * @return With name and value of the data to be sent. */ getFieldSearchData(field: any, inputData: any): any { const fieldName = 'f_' + field.id; @@ -61,9 +61,9 @@ export class AddonModDataFieldTextHandler implements AddonModDataFieldHandler { /** * Get field edit data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return With name and value of the data to be sent. */ getFieldEditData(field: any, inputData: any, originalFieldData: any): any { const fieldName = 'f_' + field.id; @@ -77,10 +77,10 @@ export class AddonModDataFieldTextHandler implements AddonModDataFieldHandler { /** * Get field data in changed. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @param {any} originalFieldData Original field entered data. - * @return {Promise | boolean} If the field has changes. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @param originalFieldData Original field entered data. + * @return If the field has changes. */ hasFieldDataChanged(field: any, inputData: any, originalFieldData: any): Promise | boolean { const fieldName = 'f_' + field.id, @@ -93,9 +93,9 @@ export class AddonModDataFieldTextHandler implements AddonModDataFieldHandler { /** * Check and get field requeriments. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {string | false} String with the notification or false. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return String with the notification or false. */ getFieldsNotifications(field: any, inputData: any): string | false { if (field.required && (!inputData || !inputData.length || !inputData[0].value)) { @@ -108,10 +108,10 @@ export class AddonModDataFieldTextHandler implements AddonModDataFieldHandler { /** * Override field content data with offline submission. * - * @param {any} originalContent Original data to be overriden. - * @param {any} offlineContent Array with all the offline data to override. - * @param {any} [offlineFiles] Array with all the offline files in the field. - * @return {any} Data overriden + * @param originalContent Original data to be overriden. + * @param offlineContent Array with all the offline data to override. + * @param offlineFiles Array with all the offline files in the field. + * @return Data overriden */ overrideData(originalContent: any, offlineContent: any, offlineFiles?: any): any { originalContent.content = offlineContent[''] || ''; @@ -122,7 +122,7 @@ export class AddonModDataFieldTextHandler implements AddonModDataFieldHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/mod/data/fields/textarea/component/textarea.ts b/src/addon/mod/data/fields/textarea/component/textarea.ts index a988de521..176601718 100644 --- a/src/addon/mod/data/fields/textarea/component/textarea.ts +++ b/src/addon/mod/data/fields/textarea/component/textarea.ts @@ -36,8 +36,8 @@ export class AddonModDataFieldTextareaComponent extends AddonModDataFieldPluginC /** * Format value to be shown. Replacing plugin file Urls. * - * @param {any} value Value to replace. - * @return {string} Replaced string to be rendered. + * @param value Value to replace. + * @return Replaced string to be rendered. */ format(value: any): string { const files = (value && value.files) || []; diff --git a/src/addon/mod/data/fields/textarea/providers/handler.ts b/src/addon/mod/data/fields/textarea/providers/handler.ts index 28ad00b9a..4e41f69a3 100644 --- a/src/addon/mod/data/fields/textarea/providers/handler.ts +++ b/src/addon/mod/data/fields/textarea/providers/handler.ts @@ -33,9 +33,9 @@ export class AddonModDataFieldTextareaHandler extends AddonModDataFieldTextHandl * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} field The field object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param field The field object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any): any | Promise { return AddonModDataFieldTextareaComponent; @@ -44,9 +44,9 @@ export class AddonModDataFieldTextareaHandler extends AddonModDataFieldTextHandl /** * Get field edit data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return With name and value of the data to be sent. */ getFieldEditData(field: any, inputData: any, originalFieldData: any): any { const fieldName = 'f_' + field.id; @@ -81,10 +81,10 @@ export class AddonModDataFieldTextareaHandler extends AddonModDataFieldTextHandl /** * Get field edit files in the input data. * - * @param {any} field Defines the field.. - * @param {any} inputData Data entered in the edit form. - * @param {any} originalFieldData Original field entered data. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field.. + * @param inputData Data entered in the edit form. + * @param originalFieldData Original field entered data. + * @return With name and value of the data to be sent. */ getFieldEditFiles(field: any, inputData: any, originalFieldData: any): any { return (originalFieldData && originalFieldData.files) || []; @@ -93,9 +93,9 @@ export class AddonModDataFieldTextareaHandler extends AddonModDataFieldTextHandl /** * Check and get field requeriments. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {string | false} String with the notification or false. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return String with the notification or false. */ getFieldsNotifications(field: any, inputData: any): string | false { if (field.required) { @@ -116,10 +116,10 @@ export class AddonModDataFieldTextareaHandler extends AddonModDataFieldTextHandl /** * Override field content data with offline submission. * - * @param {any} originalContent Original data to be overriden. - * @param {any} offlineContent Array with all the offline data to override. - * @param {any} [offlineFiles] Array with all the offline files in the field. - * @return {any} Data overriden + * @param originalContent Original data to be overriden. + * @param offlineContent Array with all the offline data to override. + * @param offlineFiles Array with all the offline files in the field. + * @return Data overriden */ overrideData(originalContent: any, offlineContent: any, offlineFiles?: any): any { originalContent.content = offlineContent[''] || ''; diff --git a/src/addon/mod/data/fields/url/providers/handler.ts b/src/addon/mod/data/fields/url/providers/handler.ts index 1854df829..f3774f547 100644 --- a/src/addon/mod/data/fields/url/providers/handler.ts +++ b/src/addon/mod/data/fields/url/providers/handler.ts @@ -32,9 +32,9 @@ export class AddonModDataFieldUrlHandler extends AddonModDataFieldTextHandler { * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} field The field object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param field The field object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any): any | Promise { return AddonModDataFieldUrlComponent; @@ -43,9 +43,9 @@ export class AddonModDataFieldUrlHandler extends AddonModDataFieldTextHandler { /** * Get field edit data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return With name and value of the data to be sent. */ getFieldEditData(field: any, inputData: any, originalFieldData: any): any { const fieldName = 'f_' + field.id; @@ -62,9 +62,9 @@ export class AddonModDataFieldUrlHandler extends AddonModDataFieldTextHandler { /** * Check and get field requeriments. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {string | false} String with the notification or false. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return String with the notification or false. */ getFieldsNotifications(field: any, inputData: any): string | false { if (field.required && (!inputData || !inputData.length || !inputData[0].value)) { diff --git a/src/addon/mod/data/pages/edit/edit.ts b/src/addon/mod/data/pages/edit/edit.ts index babfa1279..2d82e9f43 100644 --- a/src/addon/mod/data/pages/edit/edit.ts +++ b/src/addon/mod/data/pages/edit/edit.ts @@ -93,7 +93,7 @@ export class AddonModDataEditPage { /** * Check if we can leave the page or not and ask to confirm the lost of data. * - * @return {boolean | Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { if (this.forceLeave || !this.entry) { @@ -122,7 +122,7 @@ export class AddonModDataEditPage { /** * Fetch the entry data. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected fetchEntryData(): Promise { return this.dataProvider.getDatabase(this.courseId, this.module.id).then((data) => { @@ -159,8 +159,8 @@ export class AddonModDataEditPage { /** * Saves data. * - * @param {Event} e Event. - * @return {Promise} Resolved when done. + * @param e Event. + * @return Resolved when done. */ save(e: Event): Promise { e.preventDefault(); @@ -256,8 +256,8 @@ export class AddonModDataEditPage { /** * Set group to see the database. * - * @param {number} groupId Group identifier to set. - * @return {Promise} Resolved when done. + * @param groupId Group identifier to set. + * @return Resolved when done. */ setGroup(groupId: number): Promise { this.selectedGroup = groupId; @@ -269,7 +269,7 @@ export class AddonModDataEditPage { /** * Displays Edit Search Fields. * - * @return {string} Generated HTML. + * @return Generated HTML. */ protected displayEditFields(): string { this.jsData = { @@ -315,7 +315,7 @@ export class AddonModDataEditPage { /** * Return to the entry list (previous page) discarding temp data. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected returnToEntryList(): Promise { const inputData = this.editForm.value; diff --git a/src/addon/mod/data/pages/entry/entry.ts b/src/addon/mod/data/pages/entry/entry.ts index 95f96d8fc..eec7f7367 100644 --- a/src/addon/mod/data/pages/entry/entry.ts +++ b/src/addon/mod/data/pages/entry/entry.ts @@ -129,9 +129,9 @@ export class AddonModDataEntryPage implements OnDestroy { /** * Fetch the entry data. * - * @param {boolean} [refresh] Whether to refresh the current data or not. - * @param {boolean} [isPtr] Whether is a pull to refresh action. - * @return {Promise} Resolved when done. + * @param refresh Whether to refresh the current data or not. + * @param isPtr Whether is a pull to refresh action. + * @return Resolved when done. */ protected fetchEntryData(refresh?: boolean, isPtr?: boolean): Promise { this.isPullingToRefresh = isPtr; @@ -190,8 +190,8 @@ export class AddonModDataEntryPage implements OnDestroy { /** * Go to selected entry without changing state. * - * @param {number} offset Entry offset. - * @return {Promise} Resolved when done. + * @param offset Entry offset. + * @return Resolved when done. */ gotoEntry(offset: number): Promise { this.offset = offset; @@ -205,8 +205,8 @@ export class AddonModDataEntryPage implements OnDestroy { /** * Refresh all the data. * - * @param {boolean} [isPtr] Whether is a pull to refresh action. - * @return {Promise} Promise resolved when done. + * @param isPtr Whether is a pull to refresh action. + * @return Promise resolved when done. */ protected refreshAllData(isPtr?: boolean): Promise { const promises = []; @@ -233,8 +233,8 @@ export class AddonModDataEntryPage implements OnDestroy { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @return Promise resolved when done. */ refreshDatabase(refresher?: any): Promise { if (this.entryLoaded) { @@ -247,8 +247,8 @@ export class AddonModDataEntryPage implements OnDestroy { /** * Set group to see the database. * - * @param {number} groupId Group identifier to set. - * @return {Promise} Resolved when done. + * @param groupId Group identifier to set. + * @return Resolved when done. */ setGroup(groupId: number): Promise { this.selectedGroup = groupId; @@ -263,7 +263,7 @@ export class AddonModDataEntryPage implements OnDestroy { /** * Convenience function to fetch the entry and set next/previous entries. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected setEntryFromOffset(): Promise { const emptyOffset = typeof this.offset != 'number'; diff --git a/src/addon/mod/data/pages/index/index.ts b/src/addon/mod/data/pages/index/index.ts index f415352a4..4ddf93488 100644 --- a/src/addon/mod/data/pages/index/index.ts +++ b/src/addon/mod/data/pages/index/index.ts @@ -42,7 +42,7 @@ export class AddonModDataIndexPage { /** * Update some data based on the data instance. * - * @param {any} data Data instance. + * @param data Data instance. */ updateData(data: any): void { this.title = data.name || this.title; diff --git a/src/addon/mod/data/pages/search/search.ts b/src/addon/mod/data/pages/search/search.ts index e61153d3c..bad3b39c5 100644 --- a/src/addon/mod/data/pages/search/search.ts +++ b/src/addon/mod/data/pages/search/search.ts @@ -82,7 +82,7 @@ export class AddonModDataSearchPage { /** * Displays Advanced Search Fields. * - * @return {string} Generated HTML. + * @return Generated HTML. */ protected renderAdvancedSearchFields(): string { this.jsData = { @@ -130,8 +130,8 @@ export class AddonModDataSearchPage { /** * Retrieve the entered data in search in a form. * - * @param {any} searchedData Array with the entered form values. - * @return {any[]} Array with the answers. + * @param searchedData Array with the entered form values. + * @return Array with the answers. */ getSearchDataFromForm(searchedData: any): any[] { const advancedSearch = []; @@ -172,7 +172,7 @@ export class AddonModDataSearchPage { /** * Close modal. * - * @param {any} [data] Data to return to the page. + * @param data Data to return to the page. */ closeModal(data?: any): void { this.viewCtrl.dismiss(data); @@ -181,7 +181,7 @@ export class AddonModDataSearchPage { /** * Toggles between advanced to normal search. * - * @param {boolean} advanced True for advanced, false for basic. + * @param advanced True for advanced, false for basic. */ changeAdvanced(advanced: boolean): void { this.search.searchingAdvanced = advanced; @@ -190,7 +190,7 @@ export class AddonModDataSearchPage { /** * Done editing. * - * @param {Event} e Event. + * @param e Event. */ searchEntries(e: Event): void { e.preventDefault(); diff --git a/src/addon/mod/data/providers/approve-link-handler.ts b/src/addon/mod/data/providers/approve-link-handler.ts index 5084b8fb3..bf4545516 100644 --- a/src/addon/mod/data/providers/approve-link-handler.ts +++ b/src/addon/mod/data/providers/approve-link-handler.ts @@ -35,11 +35,11 @@ export class AddonModDataApproveLinkHandler extends CoreContentLinksHandlerBase /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -58,11 +58,11 @@ export class AddonModDataApproveLinkHandler extends CoreContentLinksHandlerBase * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { if (typeof params.d == 'undefined' || (typeof params.approve == 'undefined' && typeof params.disapprove == 'undefined')) { diff --git a/src/addon/mod/data/providers/data.ts b/src/addon/mod/data/providers/data.ts index 63e53e364..98de9d3ae 100644 --- a/src/addon/mod/data/providers/data.ts +++ b/src/addon/mod/data/providers/data.ts @@ -106,15 +106,15 @@ export class AddonModDataProvider { /** * Adds a new entry to a database. * - * @param {number} dataId Data instance ID. - * @param {number} entryId EntryId or provisional entry ID when offline. - * @param {number} courseId Course ID. - * @param {any} contents The fields data to be created. - * @param {number} [groupId] Group id, 0 means that the function will determine the user group. - * @param {any[]} fields The fields that define the contents. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [forceOffline] Force editing entry in offline. - * @return {Promise} Promise resolved when the action is done. + * @param dataId Data instance ID. + * @param entryId EntryId or provisional entry ID when offline. + * @param courseId Course ID. + * @param contents The fields data to be created. + * @param groupId Group id, 0 means that the function will determine the user group. + * @param fields The fields that define the contents. + * @param siteId Site ID. If not defined, current site. + * @param forceOffline Force editing entry in offline. + * @return Promise resolved when the action is done. */ addEntry(dataId: number, entryId: number, courseId: number, contents: AddonModDataSubfieldData[], groupId: number = 0, fields: any, siteId?: string, forceOffline: boolean = false): Promise { @@ -156,11 +156,11 @@ export class AddonModDataProvider { /** * Adds a new entry to a database. It does not cache calls. It will fail if offline or cannot connect. * - * @param {number} dataId Database ID. - * @param {any[]} data The fields data to be created. - * @param {number} [groupId] Group id, 0 means that the function will determine the user group. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the action is done. + * @param dataId Database ID. + * @param data The fields data to be created. + * @param groupId Group id, 0 means that the function will determine the user group. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the action is done. */ addEntryOnline(dataId: number, data: AddonModDataSubfieldData[], groupId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -180,12 +180,12 @@ export class AddonModDataProvider { /** * Approves or unapproves an entry. * - * @param {number} dataId Database ID. - * @param {number} entryId Entry ID. - * @param {boolean} approve Whether to approve (true) or unapprove the entry. - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the action is done. + * @param dataId Database ID. + * @param entryId Entry ID. + * @param approve Whether to approve (true) or unapprove the entry. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the action is done. */ approveEntry(dataId: number, entryId: number, approve: boolean, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -225,10 +225,10 @@ export class AddonModDataProvider { /** * Approves or unapproves an entry. It does not cache calls. It will fail if offline or cannot connect. * - * @param {number} entryId Entry ID. - * @param {boolean} approve Whether to approve (true) or unapprove the entry. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the action is done. + * @param entryId Entry ID. + * @param approve Whether to approve (true) or unapprove the entry. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the action is done. */ approveEntryOnline(entryId: number, approve: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -244,9 +244,9 @@ export class AddonModDataProvider { /** * Convenience function to check fields requeriments here named "notifications". * - * @param {any} fields The fields that define the contents. - * @param {any} contents The contents data of the fields. - * @return {any} Array of notifications if any or false. + * @param fields The fields that define the contents. + * @param contents The contents data of the fields. + * @return Array of notifications if any or false. */ protected checkFields(fields: any, contents: AddonModDataSubfieldData[]): any[] | false { const notifications = [], @@ -277,11 +277,11 @@ export class AddonModDataProvider { /** * Deletes an entry. * - * @param {number} dataId Database ID. - * @param {number} entryId Entry ID. - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the action is done. + * @param dataId Database ID. + * @param entryId Entry ID. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the action is done. */ deleteEntry(dataId: number, entryId: number, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -333,9 +333,9 @@ export class AddonModDataProvider { /** * Deletes an entry. It does not cache calls. It will fail if offline or cannot connect. * - * @param {number} entryId Entry ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the action is done. + * @param entryId Entry ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the action is done. */ deleteEntryOnline(entryId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -350,14 +350,14 @@ export class AddonModDataProvider { /** * Updates an existing entry. * - * @param {number} dataId Database ID. - * @param {number} entryId Entry ID. - * @param {number} courseId Course ID. - * @param {any[]} contents The contents data to be updated. - * @param {any} fields The fields that define the contents. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} forceOffline Force editing entry in offline. - * @return {Promise} Promise resolved when the action is done. + * @param dataId Database ID. + * @param entryId Entry ID. + * @param courseId Course ID. + * @param contents The contents data to be updated. + * @param fields The fields that define the contents. + * @param siteId Site ID. If not defined, current site. + * @param forceOffline Force editing entry in offline. + * @return Promise resolved when the action is done. */ editEntry(dataId: number, entryId: number, courseId: number, contents: AddonModDataSubfieldData[], fields: any, siteId?: string, forceOffline: boolean = false): Promise { @@ -433,10 +433,10 @@ export class AddonModDataProvider { /** * Updates an existing entry. It does not cache calls. It will fail if offline or cannot connect. * - * @param {number} entryId Entry ID. - * @param {any[]} data The fields data to be updated. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the action is done. + * @param entryId Entry ID. + * @param data The fields data to be updated. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the action is done. */ editEntryOnline(entryId: number, data: AddonModDataSubfieldData[], siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -452,16 +452,16 @@ export class AddonModDataProvider { /** * Performs the whole fetch of the entries in the database. * - * @param {number} dataId Data ID. - * @param {number} [groupId] Group ID. - * @param {string} [sort] Sort the records by this field id. See AddonModDataProvider#getEntries for more info. - * @param {string} [order] The direction of the sorting. See AddonModDataProvider#getEntries for more info. - * @param {number} [perPage] Records per page to fetch. It has to match with the prefetch. - * Default on AddonModDataProvider.PER_PAGE. - * @param {boolean} [forceCache] True to always get the value from cache, false otherwise. Default false. - * @param {boolean} [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. - * @return {Promise} Promise resolved when done. + * @param dataId Data ID. + * @param groupId Group ID. + * @param sort Sort the records by this field id. See AddonModDataProvider#getEntries for more info. + * @param order The direction of the sorting. See AddonModDataProvider#getEntries for more info. + * @param perPage Records per page to fetch. It has to match with the prefetch. + * Default on AddonModDataProvider.PER_PAGE. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ fetchAllEntries(dataId: number, groupId: number = 0, sort: string = '0', order: string = 'DESC', perPage: number = AddonModDataProvider.PER_PAGE, forceCache: boolean = false, ignoreCache: boolean = false, @@ -474,17 +474,17 @@ export class AddonModDataProvider { /** * Recursive call on fetch all entries. * - * @param {number} dataId Data ID. - * @param {number} groupId Group ID. - * @param {string} sort Sort the records by this field id. See AddonModDataProvider#getEntries for more info. - * @param {string} order The direction of the sorting. See AddonModDataProvider#getEntries for more info. - * @param {number} perPage Records per page to fetch. It has to match with the prefetch. - * @param {boolean} forceCache True to always get the value from cache, false otherwise. Default false. - * @param {boolean} ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @param {any} entries Entries already fetch (just to concatenate them). - * @param {number} page Page of records to return. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when done. + * @param dataId Data ID. + * @param groupId Group ID. + * @param sort Sort the records by this field id. See AddonModDataProvider#getEntries for more info. + * @param order The direction of the sorting. See AddonModDataProvider#getEntries for more info. + * @param perPage Records per page to fetch. It has to match with the prefetch. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param entries Entries already fetch (just to concatenate them). + * @param page Page of records to return. + * @param siteId Site ID. + * @return Promise resolved when done. */ protected fetchEntriesRecursive(dataId: number, groupId: number, sort: string, order: string, perPage: number, forceCache: boolean, ignoreCache: boolean, entries: any, page: number, siteId: string): Promise { @@ -505,8 +505,8 @@ export class AddonModDataProvider { /** * Get cache key for data data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getDatabaseDataCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'data:' + courseId; @@ -515,8 +515,8 @@ export class AddonModDataProvider { /** * Get prefix cache key for all database activity data WS calls. * - * @param {number} dataId Data ID. - * @return {string} Cache key. + * @param dataId Data ID. + * @return Cache key. */ protected getDatabaseDataPrefixCacheKey(dataId: number): string { return this.ROOT_CACHE_KEY + dataId; @@ -525,12 +525,12 @@ export class AddonModDataProvider { /** * Get a database data. If more than one is found, only the first will be returned. * - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [forceCache=false] True to always get the value from cache, false otherwise. Default false. - * @return {Promise} Promise resolved when the data is retrieved. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param siteId Site ID. If not defined, current site. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @return Promise resolved when the data is retrieved. */ protected getDatabaseByKey(courseId: number, key: string, value: any, siteId?: string, forceCache: boolean = false): Promise { @@ -562,11 +562,11 @@ export class AddonModDataProvider { /** * Get a data by course module ID. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [forceCache=false] True to always get the value from cache, false otherwise. Default false. - * @return {Promise} Promise resolved when the data is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param siteId Site ID. If not defined, current site. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @return Promise resolved when the data is retrieved. */ getDatabase(courseId: number, cmId: number, siteId?: string, forceCache: boolean = false): Promise { return this.getDatabaseByKey(courseId, 'coursemodule', cmId, siteId, forceCache); @@ -575,11 +575,11 @@ export class AddonModDataProvider { /** * Get a data by ID. * - * @param {number} courseId Course ID. - * @param {number} id Data ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [forceCache=false] True to always get the value from cache, false otherwise. Default false. - * @return {Promise} Promise resolved when the data is retrieved. + * @param courseId Course ID. + * @param id Data ID. + * @param siteId Site ID. If not defined, current site. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @return Promise resolved when the data is retrieved. */ getDatabaseById(courseId: number, id: number, siteId?: string, forceCache: boolean = false): Promise { return this.getDatabaseByKey(courseId, 'id', id, siteId, forceCache); @@ -588,8 +588,8 @@ export class AddonModDataProvider { /** * Get prefix cache key for all database access information data WS calls. * - * @param {number} dataId Data ID. - * @return {string} Cache key. + * @param dataId Data ID. + * @return Cache key. */ protected getDatabaseAccessInformationDataPrefixCacheKey(dataId: number): string { return this.getDatabaseDataPrefixCacheKey(dataId) + ':access:'; @@ -598,9 +598,9 @@ export class AddonModDataProvider { /** * Get cache key for database access information data WS calls. * - * @param {number} dataId Data ID. - * @param {number} [groupId=0] Group ID. - * @return {string} Cache key. + * @param dataId Data ID. + * @param groupId Group ID. + * @return Cache key. */ protected getDatabaseAccessInformationDataCacheKey(dataId: number, groupId: number = 0): string { return this.getDatabaseAccessInformationDataPrefixCacheKey(dataId) + groupId; @@ -609,12 +609,12 @@ export class AddonModDataProvider { /** * Get access information for a given database. * - * @param {number} dataId Data ID. - * @param {number} [groupId] Group ID. - * @param {boolean} [offline=false] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache=false] True if it should ignore cached data (it'll always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the database is retrieved. + * @param dataId Data ID. + * @param groupId Group ID. + * @param offline True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it'll always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the database is retrieved. */ getDatabaseAccessInformation(dataId: number, groupId?: number, offline: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { @@ -644,23 +644,23 @@ export class AddonModDataProvider { /** * Get entries for a specific database and group. * - * @param {number} dataId Data ID. - * @param {number} [groupId=0] Group ID. - * @param {string} [sort=0] Sort the records by this field id, reserved ids are: - * 0: timeadded - * -1: firstname - * -2: lastname - * -3: approved - * -4: timemodified. - * Empty for using the default database setting. - * @param {string} [order=DESC] The direction of the sorting: 'ASC' or 'DESC'. - * Empty for using the default database setting. - * @param {number} [page=0] Page of records to return. - * @param {number} [perPage=PER_PAGE] Records per page to return. Default on PER_PAGE. - * @param {boolean} [forceCache=false] True to always get the value from cache, false otherwise. Default false. - * @param {boolean} [ignoreCache=false] True if it should ignore cached data (it'll always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the database is retrieved. + * @param dataId Data ID. + * @param groupId Group ID. + * @param sort Sort the records by this field id, reserved ids are: + * 0: timeadded + * -1: firstname + * -2: lastname + * -3: approved + * -4: timemodified. + * Empty for using the default database setting. + * @param order The direction of the sorting: 'ASC' or 'DESC'. + * Empty for using the default database setting. + * @param page Page of records to return. + * @param perPage Records per page to return. Default on PER_PAGE. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @param ignoreCache True if it should ignore cached data (it'll always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the database is retrieved. */ getEntries(dataId: number, groupId: number = 0, sort: string = '0', order: string = 'DESC', page: number = 0, perPage: number = AddonModDataProvider.PER_PAGE, forceCache: boolean = false, ignoreCache: boolean = false, @@ -701,9 +701,9 @@ export class AddonModDataProvider { /** * Get cache key for database entries data WS calls. * - * @param {number} dataId Data ID. - * @param {number} [groupId=0] Group ID. - * @return {string} Cache key. + * @param dataId Data ID. + * @param groupId Group ID. + * @return Cache key. */ protected getEntriesCacheKey(dataId: number, groupId: number = 0): string { return this.getEntriesPrefixCacheKey(dataId) + groupId; @@ -712,8 +712,8 @@ export class AddonModDataProvider { /** * Get prefix cache key for database all entries data WS calls. * - * @param {number} dataId Data ID. - * @return {string} Cache key. + * @param dataId Data ID. + * @return Cache key. */ protected getEntriesPrefixCacheKey(dataId: number): string { return this.getDatabaseDataPrefixCacheKey(dataId) + ':entries:'; @@ -722,11 +722,11 @@ export class AddonModDataProvider { /** * Get an entry of the database activity. * - * @param {number} dataId Data ID for caching purposes. - * @param {number} entryId Entry ID. - * @param {boolean} [ignoreCache=false] True if it should ignore cached data (it'll always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise<{entry: AddonModDataEntry, ratinginfo: CoreRatingInfo}>} Promise resolved when the entry is retrieved. + * @param dataId Data ID for caching purposes. + * @param entryId Entry ID. + * @param ignoreCache True if it should ignore cached data (it'll always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the entry is retrieved. */ getEntry(dataId: number, entryId: number, ignoreCache: boolean = false, siteId?: string): Promise<{entry: AddonModDataEntry, ratinginfo: CoreRatingInfo}> { @@ -756,9 +756,9 @@ export class AddonModDataProvider { /** * Get cache key for database entry data WS calls. * - * @param {number} dataId Data ID for caching purposes. - * @param {number} entryId Entry ID. - * @return {string} Cache key. + * @param dataId Data ID for caching purposes. + * @param entryId Entry ID. + * @return Cache key. */ protected getEntryCacheKey(dataId: number, entryId: number): string { return this.getDatabaseDataPrefixCacheKey(dataId) + ':entry:' + entryId; @@ -767,11 +767,11 @@ export class AddonModDataProvider { /** * Get the list of configured fields for the given database. * - * @param {number} dataId Data ID. - * @param {boolean} [forceCache=false] True to always get the value from cache, false otherwise. Default false. - * @param {boolean} [ignoreCache=false] 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. - * @return {Promise} Promise resolved when the fields are retrieved. + * @param dataId Data ID. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the fields are retrieved. */ getFields(dataId: number, forceCache: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -803,8 +803,8 @@ export class AddonModDataProvider { /** * Get cache key for database fields data WS calls. * - * @param {number} dataId Data ID. - * @return {string} Cache key. + * @param dataId Data ID. + * @return Cache key. */ protected getFieldsCacheKey(dataId: number): string { return this.getDatabaseDataPrefixCacheKey(dataId) + ':fields'; @@ -814,10 +814,10 @@ export class AddonModDataProvider { * Invalidate the prefetched content. * To invalidate files, use AddonModDataProvider#invalidateFiles. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID of the module. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID of the module. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -842,9 +842,9 @@ export class AddonModDataProvider { /** * Invalidates database access information data. * - * @param {number} dataId Data ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param dataId Data ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateDatabaseAccessInformationData(dataId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -855,9 +855,9 @@ export class AddonModDataProvider { /** * Invalidates database entries data. * - * @param {number} dataId Data ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param dataId Data ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateEntriesData(dataId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -868,9 +868,9 @@ export class AddonModDataProvider { /** * Invalidate the prefetched files. * - * @param {number} moduleId The module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the files are invalidated. + * @param moduleId The module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the files are invalidated. */ invalidateFiles(moduleId: number, siteId?: string): Promise { return this.filepoolProvider.invalidateFilesByComponent(siteId, AddonModDataProvider.COMPONENT, moduleId); @@ -879,9 +879,9 @@ export class AddonModDataProvider { /** * Invalidates database data. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateDatabaseData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -892,9 +892,9 @@ export class AddonModDataProvider { /** * Invalidates database data except files and module info. * - * @param {number} databaseId Data ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param databaseId Data ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateDatabaseWSData(databaseId: number, siteId: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -905,10 +905,10 @@ export class AddonModDataProvider { /** * Invalidates database entry data. * - * @param {number} dataId Data ID for caching purposes. - * @param {number} entryId Entry ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param dataId Data ID for caching purposes. + * @param entryId Entry ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateEntryData(dataId: number, entryId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -919,8 +919,8 @@ export class AddonModDataProvider { /** * Return whether or not the plugin is enabled in a certain site. Plugin is enabled if the database WS are available. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. * @since 3.3 */ isPluginEnabled(siteId?: string): Promise { @@ -932,10 +932,10 @@ export class AddonModDataProvider { /** * Report the database as being viewed. * - * @param {number} id Module ID. - * @param {string} [name] Name of the data. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Module ID. + * @param name Name of the data. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params = { @@ -949,16 +949,16 @@ export class AddonModDataProvider { /** * Performs search over a database. * - * @param {number} dataId The data instance id. - * @param {number} [groupId=0] Group id, 0 means that the function will determine the user group. - * @param {string} [search] Search text. It will be used if advSearch is not defined. - * @param {any[]} [advSearch] Advanced search data. - * @param {string} [sort] Sort by this field. - * @param {string} [order] The direction of the sorting. - * @param {number} [page=0] Page of records to return. - * @param {number} [perPage=PER_PAGE] Records per page to return. Default on AddonModDataProvider.PER_PAGE. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the action is done. + * @param dataId The data instance id. + * @param groupId Group id, 0 means that the function will determine the user group. + * @param search Search text. It will be used if advSearch is not defined. + * @param advSearch Advanced search data. + * @param sort Sort by this field. + * @param order The direction of the sorting. + * @param page Page of records to return. + * @param perPage Records per page to return. Default on AddonModDataProvider.PER_PAGE. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the action is done. */ searchEntries(dataId: number, groupId: number = 0, search?: string, advSearch?: any, sort?: string, order?: string, page: number = 0, perPage: number = AddonModDataProvider.PER_PAGE, siteId?: string): Promise { diff --git a/src/addon/mod/data/providers/default-field-handler.ts b/src/addon/mod/data/providers/default-field-handler.ts index 2160d8a9e..d28bba2c8 100644 --- a/src/addon/mod/data/providers/default-field-handler.ts +++ b/src/addon/mod/data/providers/default-field-handler.ts @@ -25,9 +25,9 @@ export class AddonModDataDefaultFieldHandler implements AddonModDataFieldHandler /** * Get field search data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the search form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the search form. + * @return With name and value of the data to be sent. */ getFieldSearchData(field: any, inputData: any): any { return false; @@ -36,9 +36,9 @@ export class AddonModDataDefaultFieldHandler implements AddonModDataFieldHandler /** * Get field edit data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return With name and value of the data to be sent. */ getFieldEditData(field: any, inputData: any, originalFieldData: any): any { return false; @@ -47,10 +47,10 @@ export class AddonModDataDefaultFieldHandler implements AddonModDataFieldHandler /** * Get field data in changed. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @param {any} originalFieldData Original field entered data. - * @return {Promise | boolean} If the field has changes. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @param originalFieldData Original field entered data. + * @return If the field has changes. */ hasFieldDataChanged(field: any, inputData: any, originalFieldData: any): Promise | boolean { return false; @@ -59,8 +59,8 @@ export class AddonModDataDefaultFieldHandler implements AddonModDataFieldHandler /** * Get field edit files in the input data. * - * @param {any} field Defines the field.. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field.. + * @return With name and value of the data to be sent. */ getFieldEditFiles(field: any, inputData: any, originalFieldData: any): any { return []; @@ -69,9 +69,9 @@ export class AddonModDataDefaultFieldHandler implements AddonModDataFieldHandler /** * Check and get field requeriments. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {string | false} String with the notification or false. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return String with the notification or false. */ getFieldsNotifications(field: any, inputData: any): string | false { return false; @@ -80,10 +80,10 @@ export class AddonModDataDefaultFieldHandler implements AddonModDataFieldHandler /** * Override field content data with offline submission. * - * @param {any} originalContent Original data to be overriden. - * @param {any} offlineContent Array with all the offline data to override. - * @param {any} [offlineFiles] Array with all the offline files in the field. - * @return {any} Data overriden + * @param originalContent Original data to be overriden. + * @param offlineContent Array with all the offline data to override. + * @param offlineFiles Array with all the offline files in the field. + * @return Data overriden */ overrideData(originalContent: any, offlineContent: any, offlineFiles?: any): any { return originalContent; @@ -92,7 +92,7 @@ export class AddonModDataDefaultFieldHandler implements AddonModDataFieldHandler /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/mod/data/providers/delete-link-handler.ts b/src/addon/mod/data/providers/delete-link-handler.ts index 8da37ba6b..64a585026 100644 --- a/src/addon/mod/data/providers/delete-link-handler.ts +++ b/src/addon/mod/data/providers/delete-link-handler.ts @@ -35,11 +35,11 @@ export class AddonModDataDeleteLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -57,11 +57,11 @@ export class AddonModDataDeleteLinkHandler extends CoreContentLinksHandlerBase { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { if (typeof params.d == 'undefined' || typeof params.delete == 'undefined') { diff --git a/src/addon/mod/data/providers/edit-link-handler.ts b/src/addon/mod/data/providers/edit-link-handler.ts index b6857f3ab..8d724b864 100644 --- a/src/addon/mod/data/providers/edit-link-handler.ts +++ b/src/addon/mod/data/providers/edit-link-handler.ts @@ -38,11 +38,11 @@ export class AddonModDataEditLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -75,11 +75,11 @@ export class AddonModDataEditLinkHandler extends CoreContentLinksHandlerBase { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { if (typeof params.d == 'undefined') { diff --git a/src/addon/mod/data/providers/fields-delegate.ts b/src/addon/mod/data/providers/fields-delegate.ts index 544d9f349..0c935d7e9 100644 --- a/src/addon/mod/data/providers/fields-delegate.ts +++ b/src/addon/mod/data/providers/fields-delegate.ts @@ -27,7 +27,6 @@ export interface AddonModDataFieldHandler extends CoreDelegateHandler { /** * Name of the type of data field the handler supports. E.g. 'checkbox'. - * @type {string} */ type: string; @@ -35,64 +34,64 @@ export interface AddonModDataFieldHandler extends CoreDelegateHandler { * Return the Component to use to display the plugin data. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} field The field object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param field The field object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent?(injector: Injector, plugin: any): any | Promise; /** * Get field search data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the search form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the search form. + * @return With name and value of the data to be sent. */ getFieldSearchData?(field: any, inputData: any): any; /** * Get field edit data in the input data. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return With name and value of the data to be sent. */ getFieldEditData?(field: any, inputData: any, originalFieldData: any): any; /** * Get field data in changed. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @param {any} originalFieldData Original field entered data. - * @return {Promise | boolean} If the field has changes. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @param originalFieldData Original field entered data. + * @return If the field has changes. */ hasFieldDataChanged?(field: any, inputData: any, originalFieldData: any): Promise | boolean; /** * Get field edit files in the input data. * - * @param {any} field Defines the field.. - * @return {any} With name and value of the data to be sent. + * @param field Defines the field.. + * @return With name and value of the data to be sent. */ getFieldEditFiles?(field: any, inputData: any, originalFieldData: any): any; /** * Check and get field requeriments. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {string | false} String with the notification or false. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return String with the notification or false. */ getFieldsNotifications?(field: any, inputData: any): string | false; /** * Override field content data with offline submission. * - * @param {any} originalContent Original data to be overriden. - * @param {any} offlineContent Array with all the offline data to override. - * @param {any} [offlineFiles] Array with all the offline files in the field. - * @return {any} Data overriden + * @param originalContent Original data to be overriden. + * @param offlineContent Array with all the offline data to override. + * @param offlineFiles Array with all the offline files in the field. + * @return Data overriden */ overrideData?(originalContent: any, offlineContent: any, offlineFiles?: any): any; } @@ -113,9 +112,9 @@ export class AddonModDataFieldsDelegate extends CoreDelegate { /** * Get the component to use for a certain field field. * - * @param {Injector} injector Injector. - * @param {any} field The field object. - * @return {Promise} Promise resolved with the component to use, undefined if not found. + * @param injector Injector. + * @param field The field object. + * @return Promise resolved with the component to use, undefined if not found. */ getComponentForField(injector: Injector, field: any): Promise { return Promise.resolve(this.executeFunctionOnEnabled(field.type, 'getComponent', [injector, field])); @@ -124,9 +123,9 @@ export class AddonModDataFieldsDelegate extends CoreDelegate { /** * Get database data in the input data to search. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the search form. - * @return {any} Name and data field. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the search form. + * @return Name and data field. */ getFieldSearchData(field: any, inputData: any): any { return this.executeFunctionOnEnabled(field.type, 'getFieldSearchData', [field, inputData]); @@ -135,10 +134,10 @@ export class AddonModDataFieldsDelegate extends CoreDelegate { /** * Get database data in the input data to add or update entry. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the search form. - * @param {any} originalFieldData Original field entered data. - * @return {any} Name and data field. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the search form. + * @param originalFieldData Original field entered data. + * @return Name and data field. */ getFieldEditData(field: any, inputData: any, originalFieldData: any): any { return this.executeFunctionOnEnabled(field.type, 'getFieldEditData', [field, inputData, originalFieldData]); @@ -147,10 +146,10 @@ export class AddonModDataFieldsDelegate extends CoreDelegate { /** * Get database data in the input files to add or update entry. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the search form. - * @param {any} originalFieldData Original field entered data. - * @return {any} Name and data field. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the search form. + * @param originalFieldData Original field entered data. + * @return Name and data field. */ getFieldEditFiles(field: any, inputData: any, originalFieldData: any): any { return this.executeFunctionOnEnabled(field.type, 'getFieldEditFiles', [field, inputData, originalFieldData]); @@ -159,9 +158,9 @@ export class AddonModDataFieldsDelegate extends CoreDelegate { /** * Check and get field requeriments. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the edit form. - * @return {string} String with the notification or false. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the edit form. + * @return String with the notification or false. */ getFieldsNotifications(field: any, inputData: any): string { return this.executeFunctionOnEnabled(field.type, 'getFieldsNotifications', [field, inputData]); @@ -170,8 +169,8 @@ export class AddonModDataFieldsDelegate extends CoreDelegate { /** * Check if field type manage files or not. * - * @param {any} field Defines the field to be checked. - * @return {boolean} If the field type manages files. + * @param field Defines the field to be checked. + * @return If the field type manages files. */ hasFiles(field: any): boolean { return this.hasFunction(field.type, 'getFieldEditFiles'); @@ -180,10 +179,10 @@ export class AddonModDataFieldsDelegate extends CoreDelegate { /** * Check if the data has changed for a certain field. * - * @param {any} field Defines the field to be rendered. - * @param {any} inputData Data entered in the search form. - * @param {any} originalFieldData Original field entered data. - * @return {Promise} Promise rejected if has changed, resolved if no changes. + * @param field Defines the field to be rendered. + * @param inputData Data entered in the search form. + * @param originalFieldData Original field entered data. + * @return Promise rejected if has changed, resolved if no changes. */ hasFieldDataChanged(field: any, inputData: any, originalFieldData: any): Promise { return Promise.resolve(this.executeFunctionOnEnabled(field.type, 'hasFieldDataChanged', @@ -195,8 +194,8 @@ export class AddonModDataFieldsDelegate extends CoreDelegate { /** * Check if a field plugin is supported. * - * @param {string} pluginType Type of the plugin. - * @return {boolean} True if supported, false otherwise. + * @param pluginType Type of the plugin. + * @return True if supported, false otherwise. */ isPluginSupported(pluginType: string): boolean { return this.hasHandler(pluginType, true); @@ -205,11 +204,11 @@ export class AddonModDataFieldsDelegate extends CoreDelegate { /** * Override field content data with offline submission. * - * @param {any} field Defines the field to be rendered. - * @param {any} originalContent Original data to be overriden. - * @param {any} offlineContent Array with all the offline data to override. - * @param {any} [offlineFiles] Array with all the offline files in the field. - * @return {any} Data overriden + * @param field Defines the field to be rendered. + * @param originalContent Original data to be overriden. + * @param offlineContent Array with all the offline data to override. + * @param offlineFiles Array with all the offline files in the field. + * @return Data overriden */ overrideData(field: any, originalContent: any, offlineContent: any, offlineFiles?: any): any { originalContent = originalContent || {}; diff --git a/src/addon/mod/data/providers/helper.ts b/src/addon/mod/data/providers/helper.ts index 2938c6c72..0bcb81bbe 100644 --- a/src/addon/mod/data/providers/helper.ts +++ b/src/addon/mod/data/providers/helper.ts @@ -43,10 +43,10 @@ export class AddonModDataHelperProvider { /** * Returns the record with the offline actions applied. * - * @param {AddonModDataEntry} record Entry to modify. - * @param {AddonModDataOfflineAction[]} offlineActions Offline data with the actions done. - * @param {any[]} fields Entry defined fields indexed by fieldid. - * @return {Promise} Promise resolved when done. + * @param record Entry to modify. + * @param offlineActions Offline data with the actions done. + * @param fields Entry defined fields indexed by fieldid. + * @return Promise resolved when done. */ applyOfflineActions(record: AddonModDataEntry, offlineActions: AddonModDataOfflineAction[], fields: any[]): Promise { @@ -113,11 +113,11 @@ export class AddonModDataHelperProvider { /** * Approve or disapprove a database entry. * - * @param {number} dataId Database ID. - * @param {number} entryId Entry ID. - * @param {boolaen} approve True to approve, false to disapprove. - * @param {number} [courseId] Course ID. It not defined, it will be fetched. - * @param {string} [siteId] Site ID. If not defined, current site. + * @param dataId Database ID. + * @param entryId Entry ID. + * @param approve True to approve, false to disapprove. + * @param courseId Course ID. It not defined, it will be fetched. + * @param siteId Site ID. If not defined, current site. */ approveOrDisapproveEntry(dataId: number, entryId: number, approve: boolean, courseId?: number, siteId?: string): void { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -153,13 +153,13 @@ export class AddonModDataHelperProvider { /** * Displays fields for being shown. * - * @param {string} template Template HMTL. - * @param {any[]} fields Fields that defines every content in the entry. - * @param {any} entry Entry. - * @param {number} offset Entry offset. - * @param {string} mode Mode list or show. - * @param {{[name: string]: boolean}} actions Actions that can be performed to the record. - * @return {string} Generated HTML. + * @param template Template HMTL. + * @param fields Fields that defines every content in the entry. + * @param entry Entry. + * @param offset Entry offset. + * @param mode Mode list or show. + * @param actions Actions that can be performed to the record. + * @return Generated HTML. */ displayShowFields(template: string, fields: any[], entry: any, offset: number, mode: string, actions: {[name: string]: boolean}): string { @@ -208,24 +208,24 @@ export class AddonModDataHelperProvider { /** * Get online and offline entries, or search entries. * - * @param {any} data Database object. - * @param {any[]} fields The fields that define the contents. - * @param {number} [groupId=0] Group ID. - * @param {string} [search] Search text. It will be used if advSearch is not defined. - * @param {any[]} [advSearch] Advanced search data. - * @param {string} [sort=0] Sort the records by this field id, reserved ids are: - * 0: timeadded - * -1: firstname - * -2: lastname - * -3: approved - * -4: timemodified. - * Empty for using the default database setting. - * @param {string} [order=DESC] The direction of the sorting: 'ASC' or 'DESC'. - * Empty for using the default database setting. - * @param {number} [page=0] Page of records to return. - * @param {number} [perPage=PER_PAGE] Records per page to return. Default on PER_PAGE. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the database is retrieved. + * @param data Database object. + * @param fields The fields that define the contents. + * @param groupId Group ID. + * @param search Search text. It will be used if advSearch is not defined. + * @param advSearch Advanced search data. + * @param sort Sort the records by this field id, reserved ids are: + * 0: timeadded + * -1: firstname + * -2: lastname + * -3: approved + * -4: timemodified. + * Empty for using the default database setting. + * @param order The direction of the sorting: 'ASC' or 'DESC'. + * Empty for using the default database setting. + * @param page Page of records to return. + * @param perPage Records per page to return. Default on PER_PAGE. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the database is retrieved. */ fetchEntries(data: any, fields: any[], groupId: number = 0, search?: string, advSearch?: any[], sort: string = '0', order: string = 'DESC', page: number = 0, perPage: number = AddonModDataProvider.PER_PAGE, siteId?: string): @@ -310,11 +310,11 @@ export class AddonModDataHelperProvider { /** * Fetch an online or offline entry. * - * @param {any} data Database. - * @param {any[]} fields List of database fields. - * @param {number} entryId Entry ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise<{entry: AddonModDataEntry, ratinginfo?: CoreRatingInfo}>} Promise resolved with the entry. + * @param data Database. + * @param fields List of database fields. + * @param entryId Entry ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the entry. */ fetchEntry(data: any, fields: any[], entryId: number, siteId?: string): Promise<{entry: AddonModDataEntry, ratinginfo?: CoreRatingInfo}> { @@ -355,10 +355,10 @@ export class AddonModDataHelperProvider { /** * Returns an object with all the actions that the user can do over the record. * - * @param {any} database Database activity. - * @param {any} accessInfo Access info to the activity. - * @param {any} record Entry or record where the actions will be performed. - * @return {{[name: string]: boolean}} Keyed with the action names and boolean to evalute if it can or cannot be done. + * @param database Database activity. + * @param accessInfo Access info to the activity. + * @param record Entry or record where the actions will be performed. + * @return Keyed with the action names and boolean to evalute if it can or cannot be done. */ getActions(database: any, accessInfo: any, record: any): {[name: string]: boolean} { return { @@ -387,10 +387,10 @@ export class AddonModDataHelperProvider { /** * Convenience function to get the course id of the database. * - * @param {number} dataId Database id. - * @param {number} [courseId] Course id, if known. - * @param {string} [siteId] Site id, if not set, current site will be used. - * @return {Promise} Resolved with course Id when done. + * @param dataId Database id. + * @param courseId Course id, if known. + * @param siteId Site id, if not set, current site will be used. + * @return Resolved with course Id when done. */ protected getActivityCourseIdIfNotSet(dataId: number, courseId?: number, siteId?: string): Promise { if (courseId) { @@ -407,9 +407,9 @@ export class AddonModDataHelperProvider { * * Based on Moodle function data_generate_default_template. * - * @param {string} type Type of template. - * @param {any[]} fields List of database fields. - * @return {string} Template HTML. + * @param type Type of template. + * @param fields List of database fields. + * @return Template HTML. */ getDefaultTemplate(type: string, fields: any[]): string { if (type == 'listtemplateheader' || type == 'listtemplatefooter') { @@ -483,14 +483,14 @@ export class AddonModDataHelperProvider { * Retrieve the entered data in the edit form. * We don't use ng-model because it doesn't detect changes done by JavaScript. * - * @param {any} inputData Array with the entered form values. - * @param {Array} fields Fields that defines every content in the entry. - * @param {number} [dataId] Database Id. If set, files will be uploaded and itemId set. - * @param {number} entryId Entry Id. - * @param {AddonModDataEntryFields} entryContents Original entry contents. - * @param {boolean} offline True to prepare the data for an offline uploading, false otherwise. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} That contains object with the answers. + * @param inputData Array with the entered form values. + * @param fields Fields that defines every content in the entry. + * @param dataId Database Id. If set, files will be uploaded and itemId set. + * @param entryId Entry Id. + * @param entryContents Original entry contents. + * @param offline True to prepare the data for an offline uploading, false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return That contains object with the answers. */ getEditDataFromForm(inputData: any, fields: any, dataId: number, entryId: number, entryContents: AddonModDataEntryFields, offline: boolean = false, siteId?: string): Promise { @@ -549,11 +549,11 @@ export class AddonModDataHelperProvider { /** * Retrieve the temp files to be updated. * - * @param {any} inputData Array with the entered form values. - * @param {any[]} fields Fields that defines every content in the entry. - * @param {number} [dataId] Database Id. If set, fils will be uploaded and itemId set. - * @param {AddonModDataEntryFields} entryContents Original entry contents indexed by field id. - * @return {Promise} That contains object with the files. + * @param inputData Array with the entered form values. + * @param fields Fields that defines every content in the entry. + * @param dataId Database Id. If set, fils will be uploaded and itemId set. + * @param entryContents Original entry contents indexed by field id. + * @return That contains object with the files. */ getEditTmpFiles(inputData: any, fields: any[], dataId: number, entryContents: AddonModDataEntryFields): Promise { if (!inputData) { @@ -573,11 +573,11 @@ export class AddonModDataHelperProvider { /** * Get a list of stored attachment files for a new entry. See $mmaModDataHelper#storeFiles. * - * @param {number} dataId Database ID. - * @param {number} entryId Entry ID or, if creating, timemodified. - * @param {number} fieldId Field ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the files. + * @param dataId Database ID. + * @param entryId Entry ID or, if creating, timemodified. + * @param fieldId Field ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the files. */ getStoredFiles(dataId: number, entryId: number, fieldId: number, siteId?: string): Promise { return this.dataOffline.getEntryFieldFolder(dataId, entryId, fieldId, siteId).then((folderPath) => { @@ -591,10 +591,10 @@ export class AddonModDataHelperProvider { /** * Returns the template of a certain type. * - * @param {any} data Database object. - * @param {string} type Type of template. - * @param {any[]} fields List of database fields. - * @return {string} Template HTML. + * @param data Database object. + * @param type Type of template. + * @param fields List of database fields. + * @return Template HTML. */ getTemplate(data: any, type: string, fields: any[]): string { let template = data[type] || this.getDefaultTemplate(type, fields); @@ -613,11 +613,11 @@ export class AddonModDataHelperProvider { /** * Check if data has been changed by the user. * - * @param {any} inputData Object with the entered form values. - * @param {any[]} fields Fields that defines every content in the entry. - * @param {number} [dataId] Database Id. If set, fils will be uploaded and itemId set. - * @param {AddonModDataEntryFields} entryContents Original entry contents indexed by field id. - * @return {Promise} True if changed, false if not. + * @param inputData Object with the entered form values. + * @param fields Fields that defines every content in the entry. + * @param dataId Database Id. If set, fils will be uploaded and itemId set. + * @param entryContents Original entry contents indexed by field id. + * @return True if changed, false if not. */ hasEditDataChanged(inputData: any, fields: any[], dataId: number, entryContents: AddonModDataEntryFields): Promise { const promises = fields.map((field) => { @@ -637,10 +637,10 @@ export class AddonModDataHelperProvider { /** * Displays a confirmation modal for deleting an entry. * - * @param {number} dataId Database ID. - * @param {number} entryId Entry ID. - * @param {number} [courseId] Course ID. It not defined, it will be fetched. - * @param {string} [siteId] Site ID. If not defined, current site. + * @param dataId Database ID. + * @param entryId Entry ID. + * @param courseId Course ID. It not defined, it will be fetched. + * @param siteId Site ID. If not defined, current site. */ showDeleteEntryModal(dataId: number, entryId: number, courseId?: number, siteId?: string): void { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -677,12 +677,12 @@ export class AddonModDataHelperProvider { * Given a list of files (either online files or local files), store the local files in a local folder * to be submitted later. * - * @param {number} dataId Database ID. - * @param {number} entryId Entry ID or, if creating, timemodified. - * @param {number} fieldId Field ID. - * @param {any[]} files List of files. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success, rejected otherwise. + * @param dataId Database ID. + * @param entryId Entry ID or, if creating, timemodified. + * @param fieldId Field ID. + * @param files List of files. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success, rejected otherwise. */ storeFiles(dataId: number, entryId: number, fieldId: number, files: any[], siteId?: string): Promise { // Get the folder where to store the files. @@ -694,14 +694,14 @@ export class AddonModDataHelperProvider { /** * Upload or store some files, depending if the user is offline or not. * - * @param {number} dataId Database ID. - * @param {number} [itemId=0] Draft ID to use. Undefined or 0 to create a new draft ID. - * @param {number} entryId Entry ID or, if creating, timemodified. - * @param {number} fieldId Field ID. - * @param {any[]} files List of files. - * @param {boolean} offline True if files sould be stored for offline, false to upload them. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success. + * @param dataId Database ID. + * @param itemId Draft ID to use. Undefined or 0 to create a new draft ID. + * @param entryId Entry ID or, if creating, timemodified. + * @param fieldId Field ID. + * @param files List of files. + * @param offline True if files sould be stored for offline, false to upload them. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success. */ uploadOrStoreFiles(dataId: number, itemId: number = 0, entryId: number, fieldId: number, files: any[], offline: boolean, siteId?: string): Promise { diff --git a/src/addon/mod/data/providers/list-link-handler.ts b/src/addon/mod/data/providers/list-link-handler.ts index 6ca26006a..fa2ec5b8c 100644 --- a/src/addon/mod/data/providers/list-link-handler.ts +++ b/src/addon/mod/data/providers/list-link-handler.ts @@ -33,7 +33,7 @@ export class AddonModDataListLinkHandler extends CoreContentLinksModuleListHandl /** * Check if the handler is enabled on a site level. * - * @return {Promise} Whether or not the handler is enabled on a site level. + * @return Whether or not the handler is enabled on a site level. */ isEnabled(): Promise { return this.dataProvider.isPluginEnabled(); diff --git a/src/addon/mod/data/providers/module-handler.ts b/src/addon/mod/data/providers/module-handler.ts index 162a9923b..4e2297a32 100644 --- a/src/addon/mod/data/providers/module-handler.ts +++ b/src/addon/mod/data/providers/module-handler.ts @@ -47,7 +47,7 @@ export class AddonModDataModuleHandler implements CoreCourseModuleHandler { /** * Check if the handler is enabled on a site level. * - * @return {Promise} Whether or not the handler is enabled on a site level. + * @return Whether or not the handler is enabled on a site level. */ isEnabled(): Promise { return this.dataProvider.isPluginEnabled(); @@ -56,10 +56,10 @@ export class AddonModDataModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { return { @@ -81,9 +81,9 @@ export class AddonModDataModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModDataIndexComponent; diff --git a/src/addon/mod/data/providers/offline.ts b/src/addon/mod/data/providers/offline.ts index 2d6d6ca4a..5eb640c3b 100644 --- a/src/addon/mod/data/providers/offline.ts +++ b/src/addon/mod/data/providers/offline.ts @@ -111,10 +111,10 @@ export class AddonModDataOfflineProvider { /** * Delete all the actions of an entry. * - * @param {number} dataId Database ID. - * @param {number} entryId Database entry ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if deleted, rejected if failure. + * @param dataId Database ID. + * @param entryId Database entry ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if deleted, rejected if failure. */ deleteAllEntryActions(dataId: number, entryId: number, siteId?: string): Promise { return this.getEntryActions(dataId, entryId, siteId).then((actions) => { @@ -131,11 +131,11 @@ export class AddonModDataOfflineProvider { /** * Delete an stored entry. * - * @param {number} dataId Database ID. - * @param {number} entryId Database entry Id. - * @param {string} action Action to be done - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if deleted, rejected if failure. + * @param dataId Database ID. + * @param entryId Database entry Id. + * @param action Action to be done + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if deleted, rejected if failure. */ deleteEntry(dataId: number, entryId: number, action: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -149,11 +149,11 @@ export class AddonModDataOfflineProvider { /** * Delete entry offline files. * - * @param {number} dataId Database ID. - * @param {number} entryId Database entry ID. - * @param {string} action Action to be done. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if deleted, rejected if failure. + * @param dataId Database ID. + * @param entryId Database entry ID. + * @param action Action to be done. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if deleted, rejected if failure. */ protected deleteEntryFiles(dataId: number, entryId: number, action: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -191,8 +191,8 @@ export class AddonModDataOfflineProvider { /** * Get all the stored entry data from all the databases. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with entries. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with entries. */ getAllEntries(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -205,9 +205,9 @@ export class AddonModDataOfflineProvider { /** * Get all the stored entry actions from a certain database, sorted by modification time. * - * @param {number} dataId Database ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with entries. + * @param dataId Database ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with entries. */ getDatabaseEntries(dataId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -220,11 +220,11 @@ export class AddonModDataOfflineProvider { /** * Get an stored entry data. * - * @param {number} dataId Database ID. - * @param {number} entryId Database entry Id. - * @param {string} action Action to be done - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with entry. + * @param dataId Database ID. + * @param entryId Database entry Id. + * @param action Action to be done + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with entry. */ getEntry(dataId: number, entryId: number, action: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -238,10 +238,10 @@ export class AddonModDataOfflineProvider { /** * Get an all stored entry actions data. * - * @param {number} dataId Database ID. - * @param {number} entryId Database entry Id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with entry actions. + * @param dataId Database ID. + * @param entryId Database entry Id. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with entry actions. */ getEntryActions(dataId: number, entryId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -254,9 +254,9 @@ export class AddonModDataOfflineProvider { /** * Check if there are offline entries to send. * - * @param {number} dataId Database ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if has offline answers, false otherwise. + * @param dataId Database ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if has offline answers, false otherwise. */ hasOfflineData(dataId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -269,9 +269,9 @@ export class AddonModDataOfflineProvider { /** * Get the path to the folder where to store files for offline files in a database. * - * @param {number} dataId Database ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the path. + * @param dataId Database ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the path. */ protected getDatabaseFolder(dataId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -286,11 +286,11 @@ export class AddonModDataOfflineProvider { /** * Get the path to the folder where to store files for a new offline entry. * - * @param {number} dataId Database ID. - * @param {number} entryId The ID of the entry. - * @param {number} fieldId Field ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the path. + * @param dataId Database ID. + * @param entryId The ID of the entry. + * @param fieldId Field ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the path. */ getEntryFieldFolder(dataId: number, entryId: number, fieldId: number, siteId?: string): Promise { return this.getDatabaseFolder(dataId, siteId).then((folderPath) => { @@ -301,8 +301,8 @@ export class AddonModDataOfflineProvider { /** * Parse "fields" of an offline record. * - * @param {any} record Record object - * @return {AddonModDataOfflineAction} Record object with columns parsed. + * @param record Record object + * @return Record object with columns parsed. */ protected parseRecord(record: any): AddonModDataOfflineAction { record.fields = this.textUtils.parseJSON(record.fields); @@ -313,15 +313,15 @@ export class AddonModDataOfflineProvider { /** * Save an entry data to be sent later. * - * @param {number} dataId Database ID. - * @param {number} entryId Database entry Id. If action is add entryId should be 0 and -timemodified will be used. - * @param {string} action Action to be done to the entry: [add, edit, delete, approve, disapprove] - * @param {number} courseId Course ID of the database. - * @param {number} [groupId] Group ID. Only provided when adding. - * @param {any[]} [fields] Array of field data of the entry if needed. - * @param {number} [timemodified] The time the entry was modified. If not defined, current time. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param dataId Database ID. + * @param entryId Database entry Id. If action is add entryId should be 0 and -timemodified will be used. + * @param action Action to be done to the entry: [add, edit, delete, approve, disapprove] + * @param courseId Course ID of the database. + * @param groupId Group ID. Only provided when adding. + * @param fields Array of field data of the entry if needed. + * @param timemodified The time the entry was modified. If not defined, current time. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ saveEntry(dataId: number, entryId: number, action: string, courseId: number, groupId?: number, fields?: AddonModDataSubfieldData[], timemodified?: number, siteId?: string): Promise { diff --git a/src/addon/mod/data/providers/prefetch-handler.ts b/src/addon/mod/data/providers/prefetch-handler.ts index eeb51206f..91635ea8b 100644 --- a/src/addon/mod/data/providers/prefetch-handler.ts +++ b/src/addon/mod/data/providers/prefetch-handler.ts @@ -51,12 +51,12 @@ export class AddonModDataPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Retrieves all the entries for all the groups and then returns only unique entries. * - * @param {number} dataId Database Id. - * @param {any[]} groups Array of groups in the activity. - * @param {boolean} [forceCache] True to always get the value from cache, false otherwise. Default false. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. - * @return {Promise} All unique entries. + * @param dataId Database Id. + * @param groups Array of groups in the activity. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. + * @return All unique entries. */ protected getAllUniqueEntries(dataId: number, groups: any[], forceCache: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { @@ -81,13 +81,13 @@ export class AddonModDataPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Helper function to get all database info just once. * - * @param {any} module Module to get the files. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [omitFail] True to always return even if fails. Default false. - * @param {boolean} [forceCache] True to always get the value from cache, false otherwise. Default false. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved with the info fetched. + * @param module Module to get the files. + * @param courseId Course ID the module belongs to. + * @param omitFail True to always return even if fails. Default false. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. + * @return Promise resolved with the info fetched. */ protected getDatabaseInfoHelper(module: any, courseId: number, omitFail: boolean = false, forceCache: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { @@ -138,8 +138,8 @@ export class AddonModDataPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Returns the file contained in the entries. * - * @param {AddonModDataEntry[]} entries List of entries to get files from. - * @return {any[]} List of files. + * @param entries List of entries to get files from. + * @return List of files. */ protected getEntriesFiles(entries: AddonModDataEntry[]): any[] { let files = []; @@ -156,10 +156,10 @@ export class AddonModDataPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Get the list of downloadable files. * - * @param {any} module Module to get the files. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise} Promise resolved with the list of files. + * @param module Module to get the files. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved with the list of files. */ getFiles(module: any, courseId: number, single?: boolean): Promise { return this.getDatabaseInfoHelper(module, courseId, true).then((info) => { @@ -170,9 +170,9 @@ export class AddonModDataPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Returns data intro files. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved with list of intro files. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @return Promise resolved with list of intro files. */ getIntroFiles(module: any, courseId: number): Promise { return this.dataProvider.getDatabase(courseId, module.id).catch(() => { @@ -185,9 +185,9 @@ export class AddonModDataPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.dataProvider.invalidateContent(moduleId, courseId); @@ -196,9 +196,9 @@ export class AddonModDataPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Invalidate WS calls needed to determine module status. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule(module: any, courseId: number): Promise { const promises = []; @@ -212,9 +212,9 @@ export class AddonModDataPrefetchHandler extends CoreCourseActivityPrefetchHandl * Check if a database is downloadable. * A database isn't downloadable if it's not open yet. * - * @param {any} module Module to check. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved with true if downloadable, resolved with false otherwise. + * @param module Module to check. + * @param courseId Course ID the module belongs to. + * @return Promise resolved with true if downloadable, resolved with false otherwise. */ isDownloadable(module: any, courseId: number): boolean | Promise { return this.dataProvider.getDatabase(courseId, module.id, undefined, true).then((database) => { @@ -240,7 +240,7 @@ export class AddonModDataPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ isEnabled(): boolean | Promise { return this.dataProvider.isPluginEnabled(); @@ -249,11 +249,11 @@ export class AddonModDataPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string): Promise { return this.prefetchPackage(module, courseId, single, this.prefetchDatabase.bind(this)); @@ -262,11 +262,11 @@ export class AddonModDataPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Prefetch a database. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} single True if we're downloading a single module, false if we're downloading a whole section. - * @param {String} siteId Site ID. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. + * @return Promise resolved when done. */ protected prefetchDatabase(module: any, courseId: number, single: boolean, siteId: string): Promise { @@ -302,10 +302,10 @@ export class AddonModDataPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Sync a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ sync(module: any, courseId: number, siteId?: any): Promise { const promises = [ diff --git a/src/addon/mod/data/providers/show-link-handler.ts b/src/addon/mod/data/providers/show-link-handler.ts index 3685df23e..3418245b4 100644 --- a/src/addon/mod/data/providers/show-link-handler.ts +++ b/src/addon/mod/data/providers/show-link-handler.ts @@ -38,11 +38,11 @@ export class AddonModDataShowLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -83,11 +83,11 @@ export class AddonModDataShowLinkHandler extends CoreContentLinksHandlerBase { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { if (typeof params.d == 'undefined') { diff --git a/src/addon/mod/data/providers/sync-cron-handler.ts b/src/addon/mod/data/providers/sync-cron-handler.ts index c67e7a102..88fd2441d 100644 --- a/src/addon/mod/data/providers/sync-cron-handler.ts +++ b/src/addon/mod/data/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class AddonModDataSyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.dataSync.syncAllDatabases(siteId, force); @@ -40,7 +40,7 @@ export class AddonModDataSyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return this.dataSync.syncInterval; diff --git a/src/addon/mod/data/providers/sync.ts b/src/addon/mod/data/providers/sync.ts index 0553511c4..defc326f7 100644 --- a/src/addon/mod/data/providers/sync.ts +++ b/src/addon/mod/data/providers/sync.ts @@ -55,9 +55,9 @@ export class AddonModDataSyncProvider extends CoreSyncBaseProvider { /** * Check if a database has data to synchronize. * - * @param {number} dataId Database ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if has data to sync, false otherwise. + * @param dataId Database ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if has data to sync, false otherwise. */ hasDataToSync(dataId: number, siteId?: string): Promise { return this.dataOffline.hasOfflineData(dataId, siteId); @@ -66,9 +66,9 @@ export class AddonModDataSyncProvider extends CoreSyncBaseProvider { /** * Try to synchronize all the databases in a certain site or in all sites. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} force Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncAllDatabases(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all databases', this.syncAllDatabasesFunc.bind(this), [force], siteId); @@ -77,9 +77,9 @@ export class AddonModDataSyncProvider extends CoreSyncBaseProvider { /** * Sync all pending databases on a site. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} force Wether to force sync not depending on last execution. - * @param {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @param Promise resolved if sync is successful, rejected if sync fails. */ protected syncAllDatabasesFunc(siteId?: string, force?: boolean): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -122,9 +122,9 @@ export class AddonModDataSyncProvider extends CoreSyncBaseProvider { /** * Sync a database only if a certain time has passed since the last time. * - * @param {number} dataId Database ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is synced or if it doesn't need to be synced. + * @param dataId Database ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is synced or if it doesn't need to be synced. */ syncDatabaseIfNeeded(dataId: number, siteId?: string): Promise { return this.isSyncNeeded(dataId, siteId).then((needed) => { @@ -137,9 +137,9 @@ export class AddonModDataSyncProvider extends CoreSyncBaseProvider { /** * Synchronize a data. * - * @param {number} dataId Data ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param dataId Data ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncDatabase(dataId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -226,11 +226,11 @@ export class AddonModDataSyncProvider extends CoreSyncBaseProvider { /** * Synchronize an entry. * - * @param {any} data Database. - * @param {AddonModDataOfflineAction[]} entryActions Entry actions. - * @param {any} result Object with the result of the sync. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success, rejected otherwise. + * @param data Database. + * @param entryActions Entry actions. + * @param result Object with the result of the sync. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success, rejected otherwise. */ protected syncEntry(data: any, entryActions: AddonModDataOfflineAction[], result: any, siteId?: string): Promise { let discardError, @@ -388,10 +388,10 @@ export class AddonModDataSyncProvider extends CoreSyncBaseProvider { /** * Synchronize offline ratings. * - * @param {number} [cmId] Course module to be synced. If not defined, sync all databases. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param cmId Course module to be synced. If not defined, sync all databases. + * @param force Wether to force sync not depending on last execution. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncRatings(cmId?: number, force?: boolean, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); diff --git a/src/addon/mod/data/providers/tag-area-handler.ts b/src/addon/mod/data/providers/tag-area-handler.ts index f7fb15098..70e19045f 100644 --- a/src/addon/mod/data/providers/tag-area-handler.ts +++ b/src/addon/mod/data/providers/tag-area-handler.ts @@ -30,7 +30,7 @@ export class AddonModDataTagAreaHandler implements CoreTagAreaHandler { /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return this.dataProvider.isPluginEnabled(); @@ -39,8 +39,8 @@ export class AddonModDataTagAreaHandler implements CoreTagAreaHandler { /** * Parses the rendered content of a tag index and returns the items. * - * @param {string} content Rendered content. - * @return {any[]|Promise} Area items (or promise resolved with the items). + * @param content Rendered content. + * @return Area items (or promise resolved with the items). */ parseContent(content: string): any[] | Promise { return this.tagHelper.parseFeedContent(content); @@ -49,8 +49,8 @@ export class AddonModDataTagAreaHandler implements CoreTagAreaHandler { /** * Get the component to use to display items. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return CoreTagFeedComponent; diff --git a/src/addon/mod/feedback/components/index/index.ts b/src/addon/mod/feedback/components/index/index.ts index eefc27a7e..88e1537d3 100644 --- a/src/addon/mod/feedback/components/index/index.ts +++ b/src/addon/mod/feedback/components/index/index.ts @@ -124,7 +124,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -147,8 +147,8 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity /** * Compares sync event data with current data to check if refresh content is needed. * - * @param {any} syncEventData Data receiven on sync observer. - * @return {boolean} True if refresh is needed, false otherwise. + * @param syncEventData Data receiven on sync observer. + * @return True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: any): boolean { if (this.feedback && syncEventData.feedbackId == this.feedback.id) { @@ -164,10 +164,10 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity /** * Download feedback contents. * - * @param {boolean} [refresh=false] If it's refreshing content. - * @param {boolean} [sync=false] If it should try to sync. - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved when done. + * @param refresh If it's refreshing content. + * @param sync If it should try to sync. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved when done. */ protected fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { return this.feedbackProvider.getFeedback(this.courseId, this.module.id).then((feedback) => { @@ -209,8 +209,8 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity /** * Convenience function to get feedback overview data. * - * @param {any} accessData Retrieved access data. - * @return {Promise} Resolved when done. + * @param accessData Retrieved access data. + * @return Resolved when done. */ protected fetchFeedbackOverviewData(accessData: any): Promise { const promises = []; @@ -240,8 +240,8 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity /** * Convenience function to get feedback analysis data. * - * @param {any} accessData Retrieved access data. - * @return {Promise} Resolved when done. + * @param accessData Retrieved access data. + * @return Resolved when done. */ protected fetchFeedbackAnalysisData(accessData: any): Promise { let promise; @@ -262,8 +262,8 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity /** * Fetch Group info data. * - * @param {number} cmId Course module ID. - * @return {Promise} Resolved when done. + * @param cmId Course module ID. + * @return Resolved when done. */ protected fetchGroupInfo(cmId: number): Promise { return this.groupsProvider.getActivityGroupInfo(cmId).then((groupInfo) => { @@ -276,8 +276,8 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity /** * Parse the analysis info to show the info correctly formatted. * - * @param {any} item Item to parse. - * @return {any} Parsed item. + * @param item Item to parse. + * @return Parsed item. */ protected parseAnalysisInfo(item: any): any { switch (item.typ) { @@ -356,7 +356,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity /** * Function to go to the questions form. * - * @param {boolean} preview Preview or edit the form. + * @param preview Preview or edit the form. */ gotoAnswerQuestions(preview: boolean = false): void { const stateParams = { @@ -389,7 +389,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity /** * Function to link implemented features. * - * @param {string} feature Feature to navigate. + * @param feature Feature to navigate. */ openFeature(feature: string): void { this.feedbackHelper.openFeature(feature, this.navCtrl, this.module, this.courseId, this.group); @@ -398,7 +398,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity /** * Tab changed, fetch content again. * - * @param {string} tabName New tab name. + * @param tabName New tab name. */ tabChanged(tabName: string): void { this.tab = tabName; @@ -411,8 +411,8 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity /** * Set group to see the analysis. * - * @param {number} groupId Group ID. - * @return {Promise} Resolved when done. + * @param groupId Group ID. + * @return Resolved when done. */ setGroup(groupId: number): Promise { this.group = groupId; @@ -452,7 +452,7 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity /** * Performs the sync of the activity. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected sync(): Promise { return this.feedbackSync.syncFeedback(this.feedback.id); @@ -461,8 +461,8 @@ export class AddonModFeedbackIndexComponent extends CoreCourseModuleMainActivity /** * Checks if sync has succeed from result sync data. * - * @param {any} result Data returned on the sync function. - * @return {boolean} If suceed or not. + * @param result Data returned on the sync function. + * @return If suceed or not. */ protected hasSyncSucceed(result: any): boolean { return result.updated; diff --git a/src/addon/mod/feedback/pages/attempt/attempt.ts b/src/addon/mod/feedback/pages/attempt/attempt.ts index 3ec17f95e..07d1dad49 100644 --- a/src/addon/mod/feedback/pages/attempt/attempt.ts +++ b/src/addon/mod/feedback/pages/attempt/attempt.ts @@ -58,7 +58,7 @@ export class AddonModFeedbackAttemptPage { /** * Fetch all the data required for the view. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ fetchData(): Promise { // Get the feedback to be able to now if questions should be autonumbered. diff --git a/src/addon/mod/feedback/pages/form/form.ts b/src/addon/mod/feedback/pages/form/form.ts index f1da26ca8..edfd72c16 100644 --- a/src/addon/mod/feedback/pages/form/form.ts +++ b/src/addon/mod/feedback/pages/form/form.ts @@ -113,7 +113,7 @@ export class AddonModFeedbackFormPage implements OnDestroy { /** * Check if we can leave the page or not. * - * @return {boolean | Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { if (this.forceLeave) { @@ -137,7 +137,7 @@ export class AddonModFeedbackFormPage implements OnDestroy { /** * Fetch all the data required for the view. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchData(): Promise { this.offline = !this.appProvider.isOnline(); @@ -183,7 +183,7 @@ export class AddonModFeedbackFormPage implements OnDestroy { /** * Fetch access information. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchAccessData(): Promise { return this.feedbackProvider.getFeedbackAccessInformation(this.feedback.id, this.offline, true).catch((error) => { @@ -246,8 +246,8 @@ export class AddonModFeedbackFormPage implements OnDestroy { /** * Function to allow page navigation through the questions form. * - * @param {boolean} goPrevious If true it will go back to the previous page, if false, it will go forward. - * @return {Promise} Resolved when done. + * @param goPrevious If true it will go back to the previous page, if false, it will go forward. + * @return Resolved when done. */ gotoPage(goPrevious: boolean): Promise { this.domUtils.scrollToTop(this.content); diff --git a/src/addon/mod/feedback/pages/index/index.ts b/src/addon/mod/feedback/pages/index/index.ts index a6b937d91..2de96f1b1 100644 --- a/src/addon/mod/feedback/pages/index/index.ts +++ b/src/addon/mod/feedback/pages/index/index.ts @@ -44,7 +44,7 @@ export class AddonModFeedbackIndexPage { /** * Update some data based on the feedback instance. * - * @param {any} feedback Feedback instance. + * @param feedback Feedback instance. */ updateData(feedback: any): void { this.title = feedback.name || this.title; diff --git a/src/addon/mod/feedback/pages/nonrespondents/nonrespondents.ts b/src/addon/mod/feedback/pages/nonrespondents/nonrespondents.ts index 4f8c210b7..b42fd38f4 100644 --- a/src/addon/mod/feedback/pages/nonrespondents/nonrespondents.ts +++ b/src/addon/mod/feedback/pages/nonrespondents/nonrespondents.ts @@ -68,8 +68,8 @@ export class AddonModFeedbackNonRespondentsPage { /** * Fetch all the data required for the view. * - * @param {boolean} [refresh] Empty events array first. - * @return {Promise} Promise resolved when done. + * @param refresh Empty events array first. + * @return Promise resolved when done. */ fetchData(refresh: boolean = false): Promise { this.page = 0; @@ -96,8 +96,8 @@ export class AddonModFeedbackNonRespondentsPage { /** * Load Group responses. * - * @param {number} [groupId] If defined it will change group if not, it will load more users for the same group. - * @return {Promise} Resolved with the attempts loaded. + * @param groupId If defined it will change group if not, it will load more users for the same group. + * @return Resolved with the attempts loaded. */ protected loadGroupUsers(groupId?: number): Promise { if (typeof groupId == 'undefined') { @@ -130,7 +130,7 @@ export class AddonModFeedbackNonRespondentsPage { /** * Change selected group or load more users. * - * @param {number} [groupId] Group ID selected. If not defined, it will load more users. + * @param groupId Group ID selected. If not defined, it will load more users. */ loadAttempts(groupId?: number): void { this.loadGroupUsers(groupId).catch((message) => { @@ -141,7 +141,7 @@ export class AddonModFeedbackNonRespondentsPage { /** * Refresh the attempts. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshFeedback(refresher: any): void { if (this.feedbackLoaded) { diff --git a/src/addon/mod/feedback/pages/respondents/respondents.ts b/src/addon/mod/feedback/pages/respondents/respondents.ts index 4a4a669ea..74e5ea7b4 100644 --- a/src/addon/mod/feedback/pages/respondents/respondents.ts +++ b/src/addon/mod/feedback/pages/respondents/respondents.ts @@ -87,8 +87,8 @@ export class AddonModFeedbackRespondentsPage { /** * Fetch all the data required for the view. * - * @param {boolean} [refresh] Empty events array first. - * @return {Promise} Promise resolved when done. + * @param refresh Empty events array first. + * @return Promise resolved when done. */ fetchData(refresh: boolean = false): Promise { this.page = 0; @@ -117,8 +117,8 @@ export class AddonModFeedbackRespondentsPage { /** * Load Group attempts. * - * @param {number} [groupId] If defined it will change group if not, it will load more attempts for the same group. - * @return {Promise} Resolved with the attempts loaded. + * @param groupId If defined it will change group if not, it will load more attempts for the same group. + * @return Resolved with the attempts loaded. */ protected loadGroupAttempts(groupId?: number): Promise { if (typeof groupId == 'undefined') { @@ -158,7 +158,7 @@ export class AddonModFeedbackRespondentsPage { /** * Navigate to a particular attempt. * - * @param {any} attempt Attempt object to load. + * @param attempt Attempt object to load. */ gotoAttempt(attempt: any): void { this.attemptId = attempt.id; @@ -174,7 +174,7 @@ export class AddonModFeedbackRespondentsPage { /** * Change selected group or load more attempts. * - * @param {number} [groupId] Group ID selected. If not defined, it will load more attempts. + * @param groupId Group ID selected. If not defined, it will load more attempts. */ loadAttempts(groupId?: number): void { this.loadGroupAttempts(groupId).catch((message) => { @@ -185,7 +185,7 @@ export class AddonModFeedbackRespondentsPage { /** * Refresh the attempts. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshFeedback(refresher: any): void { if (this.feedbackLoaded) { diff --git a/src/addon/mod/feedback/providers/analysis-link-handler.ts b/src/addon/mod/feedback/providers/analysis-link-handler.ts index 8f8fa3c39..4f11146e2 100644 --- a/src/addon/mod/feedback/providers/analysis-link-handler.ts +++ b/src/addon/mod/feedback/providers/analysis-link-handler.ts @@ -38,11 +38,11 @@ export class AddonModFeedbackAnalysisLinkHandler extends CoreContentLinksHandler /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -70,11 +70,11 @@ export class AddonModFeedbackAnalysisLinkHandler extends CoreContentLinksHandler * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return this.feedbackProvider.isPluginEnabled(siteId).then((enabled) => { diff --git a/src/addon/mod/feedback/providers/complete-link-handler.ts b/src/addon/mod/feedback/providers/complete-link-handler.ts index af4b1153a..0a5d0af25 100644 --- a/src/addon/mod/feedback/providers/complete-link-handler.ts +++ b/src/addon/mod/feedback/providers/complete-link-handler.ts @@ -38,11 +38,11 @@ export class AddonModFeedbackCompleteLinkHandler extends CoreContentLinksHandler /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -73,11 +73,11 @@ export class AddonModFeedbackCompleteLinkHandler extends CoreContentLinksHandler * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { if (typeof params.id == 'undefined') { diff --git a/src/addon/mod/feedback/providers/feedback.ts b/src/addon/mod/feedback/providers/feedback.ts index a9aed0880..10670e5f8 100644 --- a/src/addon/mod/feedback/providers/feedback.ts +++ b/src/addon/mod/feedback/providers/feedback.ts @@ -47,9 +47,9 @@ export class AddonModFeedbackProvider { /** * Check dependency of a question item. * - * @param {any[]} items All question items to check dependency. - * @param {any} item Item to check. - * @return {boolean} Return true if dependency is acomplished and it can be shown. False, otherwise. + * @param items All question items to check dependency. + * @param item Item to check. + * @return Return true if dependency is acomplished and it can be shown. False, otherwise. */ protected checkDependencyItem(items: any[], item: any): boolean { const depend = items.find((itemFind) => { @@ -77,9 +77,9 @@ export class AddonModFeedbackProvider { /** * Check dependency item of type Multichoice. * - * @param {any} item Item to check. - * @param {string} dependValue Value to compare. - * @return {boolean} Return true if dependency is acomplished and it can be shown. False, otherwise. + * @param item Item to check. + * @param dependValue Value to compare. + * @return Return true if dependency is acomplished and it can be shown. False, otherwise. */ protected compareDependItemMultichoice(item: any, dependValue: string): boolean { let values, choices; @@ -128,12 +128,12 @@ export class AddonModFeedbackProvider { /** * Fill values of item questions. * - * @param {number} feedbackId Feedback ID. - * @param {any[]} items Item to fill the value. - * @param {boolean} offline True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @param {string} siteId Site ID. - * @return {Promise} Resolved with values when done. + * @param feedbackId Feedback ID. + * @param items Item to fill the value. + * @param offline True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. + * @return Resolved with values when done. */ protected fillValues(feedbackId: number, items: any[], offline: boolean, ignoreCache: boolean, siteId: string): Promise { return this.getCurrentValues(feedbackId, offline, ignoreCache, siteId).then((valuesArray) => { @@ -202,12 +202,12 @@ export class AddonModFeedbackProvider { /** * Returns all the feedback non respondents users. * - * @param {number} feedbackId Feedback ID. - * @param {number} groupId Group id, 0 means that the function will determine the user group. - * @param {boolean} [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 {any} [previous] Only for recurrent use. Object with the previous fetched info. - * @return {Promise} Promise resolved when the info is retrieved. + * @param feedbackId Feedback ID. + * @param groupId Group id, 0 means that the function will determine the user group. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @param previous Only for recurrent use. Object with the previous fetched info. + * @return Promise resolved when the info is retrieved. */ getAllNonRespondents(feedbackId: number, groupId: number, ignoreCache?: boolean, siteId?: string, previous?: any) : Promise { @@ -240,12 +240,12 @@ export class AddonModFeedbackProvider { /** * Returns all the feedback user responses. * - * @param {number} feedbackId Feedback ID. - * @param {number} groupId Group id, 0 means that the function will determine the user group. - * @param {boolean} [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 {any} [previous] Only for recurrent use. Object with the previous fetched info. - * @return {Promise} Promise resolved when the info is retrieved. + * @param feedbackId Feedback ID. + * @param groupId Group id, 0 means that the function will determine the user group. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @param previous Only for recurrent use. Object with the previous fetched info. + * @return Promise resolved when the info is retrieved. */ getAllResponsesAnalysis(feedbackId: number, groupId: number, ignoreCache?: boolean, siteId?: string, previous?: any) : Promise { @@ -285,11 +285,11 @@ export class AddonModFeedbackProvider { /** * Get analysis information for a given feedback. * - * @param {number} feedbackId Feedback ID. - * @param {number} [groupId] Group ID. - * @param {boolean} [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. - * @return {Promise} Promise resolved when the feedback is retrieved. + * @param feedbackId Feedback ID. + * @param groupId Group ID. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the feedback is retrieved. */ getAnalysis(feedbackId: number, groupId?: number, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -316,9 +316,9 @@ export class AddonModFeedbackProvider { /** * Get cache key for feedback analysis data WS calls. * - * @param {number} feedbackId Feedback ID. - * @param {number} [groupId=0] Group ID. - * @return {string} Cache key. + * @param feedbackId Feedback ID. + * @param groupId Group ID. + * @return Cache key. */ protected getAnalysisDataCacheKey(feedbackId: number, groupId: number = 0): string { return this.getAnalysisDataPrefixCacheKey(feedbackId) + groupId; @@ -327,8 +327,8 @@ export class AddonModFeedbackProvider { /** * Get prefix cache key for feedback analysis data WS calls. * - * @param {number} feedbackId Feedback ID. - * @return {string} Cache key. + * @param feedbackId Feedback ID. + * @return Cache key. */ protected getAnalysisDataPrefixCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':analysis:'; @@ -337,12 +337,12 @@ export class AddonModFeedbackProvider { /** * Find an attempt in all responses analysis. * - * @param {number} feedbackId Feedback ID. - * @param {number} attemptId Attempt id to find. - * @param {boolean} [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 {any} [previous] Only for recurrent use. Object with the previous fetched info. - * @return {Promise} Promise resolved when the info is retrieved. + * @param feedbackId Feedback ID. + * @param attemptId Attempt id to find. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @param previous Only for recurrent use. Object with the previous fetched info. + * @return Promise resolved when the info is retrieved. */ getAttempt(feedbackId: number, attemptId: number, ignoreCache?: boolean, siteId?: string, previous?: any): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -396,8 +396,8 @@ export class AddonModFeedbackProvider { /** * Get prefix cache key for feedback completion data WS calls. * - * @param {number} feedbackId Feedback ID. - * @return {string} Cache key. + * @param feedbackId Feedback ID. + * @return Cache key. */ protected getCompletedDataCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':completed:'; @@ -406,10 +406,10 @@ export class AddonModFeedbackProvider { /** * Returns the temporary completion timemodified for the current user. * - * @param {number} feedbackId Feedback ID. - * @param {boolean} [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. - * @return {Promise} Promise resolved when the info is retrieved. + * @param feedbackId Feedback ID. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the info is retrieved. */ getCurrentCompletedTimeModified(feedbackId: number, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -441,8 +441,8 @@ export class AddonModFeedbackProvider { /** * Get prefix cache key for feedback current completed temp data WS calls. * - * @param {number} feedbackId Feedback ID. - * @return {string} Cache key. + * @param feedbackId Feedback ID. + * @return Cache key. */ protected getCurrentCompletedTimeModifiedDataCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':completedtime:'; @@ -451,11 +451,11 @@ export class AddonModFeedbackProvider { /** * Returns the temporary responses or responses of the last submission for the current user. * - * @param {number} feedbackId Feedback ID. - * @param {boolean} [offline=false] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache=false] True if it should ignore cached data (it always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the info is retrieved. + * @param feedbackId Feedback ID. + * @param offline True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the info is retrieved. */ getCurrentValues(feedbackId: number, offline: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -497,8 +497,8 @@ export class AddonModFeedbackProvider { /** * Get cache key for get current values feedback data WS calls. * - * @param {number} feedbackId Feedback ID. - * @return {string} Cache key. + * @param feedbackId Feedback ID. + * @return Cache key. */ protected getCurrentValuesDataCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':currentvalues'; @@ -507,11 +507,11 @@ export class AddonModFeedbackProvider { /** * Get access information for a given feedback. * - * @param {number} feedbackId Feedback ID. - * @param {boolean} [offline=false] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache=false] True if it should ignore cached data (it always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the feedback is retrieved. + * @param feedbackId Feedback ID. + * @param offline True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the feedback is retrieved. */ getFeedbackAccessInformation(feedbackId: number, offline: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { @@ -537,8 +537,8 @@ export class AddonModFeedbackProvider { /** * Get cache key for feedback access information data WS calls. * - * @param {number} feedbackId Feedback ID. - * @return {string} Cache key. + * @param feedbackId Feedback ID. + * @return Cache key. */ protected getFeedbackAccessInformationDataCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':access'; @@ -547,8 +547,8 @@ export class AddonModFeedbackProvider { /** * Get cache key for feedback data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getFeedbackCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'feedback:' + courseId; @@ -557,8 +557,8 @@ export class AddonModFeedbackProvider { /** * Get prefix cache key for all feedback activity data WS calls. * - * @param {number} feedbackId Feedback ID. - * @return {string} Cache key. + * @param feedbackId Feedback ID. + * @return Cache key. */ protected getFeedbackDataPrefixCacheKey(feedbackId: number): string { return this.ROOT_CACHE_KEY + feedbackId; @@ -567,13 +567,13 @@ export class AddonModFeedbackProvider { /** * Get a feedback with key=value. If more than one is found, only the first will be returned. * - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [forceCache] True to always get the value from cache, false otherwise. Default false. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise resolved when the feedback is retrieved. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param siteId Site ID. If not defined, current site. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved when the feedback is retrieved. */ protected getFeedbackDataByKey(courseId: number, key: string, value: any, siteId?: string, forceCache?: boolean, ignoreCache?: boolean): Promise { @@ -612,12 +612,12 @@ export class AddonModFeedbackProvider { /** * Get a feedback by course module ID. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [forceCache] True to always get the value from cache, false otherwise. Default false. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise resolved when the feedback is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param siteId Site ID. If not defined, current site. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved when the feedback is retrieved. */ getFeedback(courseId: number, cmId: number, siteId?: string, forceCache?: boolean, ignoreCache?: boolean): Promise { return this.getFeedbackDataByKey(courseId, 'coursemodule', cmId, siteId, forceCache, ignoreCache); @@ -626,12 +626,12 @@ export class AddonModFeedbackProvider { /** * Get a feedback by ID. * - * @param {number} courseId Course ID. - * @param {number} id Feedback ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [forceCache] True to always get the value from cache, false otherwise. Default false. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise resolved when the feedback is retrieved. + * @param courseId Course ID. + * @param id Feedback ID. + * @param siteId Site ID. If not defined, current site. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved when the feedback is retrieved. */ getFeedbackById(courseId: number, id: number, siteId?: string, forceCache?: boolean, ignoreCache?: boolean): Promise { return this.getFeedbackDataByKey(courseId, 'id', id, siteId, forceCache, ignoreCache); @@ -640,10 +640,10 @@ export class AddonModFeedbackProvider { /** * Returns the items (questions) in the given feedback. * - * @param {number} feedbackId Feedback ID. - * @param {boolean} [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. - * @return {Promise} Promise resolved when the info is retrieved. + * @param feedbackId Feedback ID. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the info is retrieved. */ getItems(feedbackId: number, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -667,8 +667,8 @@ export class AddonModFeedbackProvider { /** * Get cache key for get items feedback data WS calls. * - * @param {number} feedbackId Feedback ID. - * @return {string} Cache key. + * @param feedbackId Feedback ID. + * @return Cache key. */ protected getItemsDataCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':items'; @@ -677,12 +677,12 @@ export class AddonModFeedbackProvider { /** * Retrieves a list of students who didn't submit the feedback. * - * @param {number} feedbackId Feedback ID. - * @param {number} [groupId=0] Group id, 0 means that the function will determine the user group. - * @param {number} [page=0] The page of records to return. - * @param {boolean} [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. - * @return {Promise} Promise resolved when the info is retrieved. + * @param feedbackId Feedback ID. + * @param groupId Group id, 0 means that the function will determine the user group. + * @param page The page of records to return. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the info is retrieved. */ getNonRespondents(feedbackId: number, groupId: number = 0, page: number = 0, ignoreCache?: boolean, siteId?: string) : Promise { @@ -709,9 +709,9 @@ export class AddonModFeedbackProvider { /** * Get cache key for non respondents feedback data WS calls. * - * @param {number} feedbackId Feedback ID. - * @param {number} [groupId=0] Group id, 0 means that the function will determine the user group. - * @return {string} Cache key. + * @param feedbackId Feedback ID. + * @param groupId Group id, 0 means that the function will determine the user group. + * @return Cache key. */ protected getNonRespondentsDataCacheKey(feedbackId: number, groupId: number = 0): string { return this.getNonRespondentsDataPrefixCacheKey(feedbackId) + groupId; @@ -720,8 +720,8 @@ export class AddonModFeedbackProvider { /** * Get prefix cache key for feedback non respondents data WS calls. * - * @param {number} feedbackId Feedback ID. - * @return {string} Cache key. + * @param feedbackId Feedback ID. + * @return Cache key. */ protected getNonRespondentsDataPrefixCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':nonrespondents:'; @@ -730,10 +730,10 @@ export class AddonModFeedbackProvider { /** * Get a single feedback page items. This function is not cached, use AddonModFeedbackHelperProvider#getPageItems instead. * - * @param {number} feedbackId Feedback ID. - * @param {number} page The page to get. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the info is retrieved. + * @param feedbackId Feedback ID. + * @param page The page to get. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the info is retrieved. */ getPageItems(feedbackId: number, page: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -749,12 +749,12 @@ export class AddonModFeedbackProvider { /** * Get a single feedback page items. If offline or server down it will use getItems to calculate dependencies. * - * @param {number} feedbackId Feedback ID. - * @param {number} page The page to get. - * @param {boolean} [offline=false] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache=false] 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. - * @return {Promise} Promise resolved when the info is retrieved. + * @param feedbackId Feedback ID. + * @param page The page to get. + * @param offline True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the info is retrieved. */ getPageItemsWithValues(feedbackId: number, page: number, offline: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { @@ -816,11 +816,11 @@ export class AddonModFeedbackProvider { /** * Convenience function to get the page we can jump. * - * @param {number} feedbackId Feedback ID. - * @param {number} page Page where we want to jump. - * @param {number} changePage If page change is forward (1) or backward (-1). - * @param {string} siteId Site ID. - * @return {Promise} Page number where to jump. Or false if completed or first page. + * @param feedbackId Feedback ID. + * @param page Page where we want to jump. + * @param changePage If page change is forward (1) or backward (-1). + * @param siteId Site ID. + * @return Page number where to jump. Or false if completed or first page. */ protected getPageJumpTo(feedbackId: number, page: number, changePage: number, siteId: string): Promise { return this.getPageItemsWithValues(feedbackId, page, true, false, siteId).then((resp) => { @@ -842,12 +842,12 @@ export class AddonModFeedbackProvider { /** * Returns the feedback user responses. * - * @param {number} feedbackId Feedback ID. - * @param {number} groupId Group id, 0 means that the function will determine the user group. - * @param {number} page The page of records to return. - * @param {boolean} [ignoreCache=false] 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. - * @return {Promise} Promise resolved when the info is retrieved. + * @param feedbackId Feedback ID. + * @param groupId Group id, 0 means that the function will determine the user group. + * @param page The page of records to return. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the info is retrieved. */ getResponsesAnalysis(feedbackId: number, groupId: number, page: number, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -872,9 +872,9 @@ export class AddonModFeedbackProvider { /** * Get cache key for responses analysis feedback data WS calls. * - * @param {number} feedbackId Feedback ID. - * @param {number} [groupId=0] Group id, 0 means that the function will determine the user group. - * @return {string} Cache key. + * @param feedbackId Feedback ID. + * @param groupId Group id, 0 means that the function will determine the user group. + * @return Cache key. */ protected getResponsesAnalysisDataCacheKey(feedbackId: number, groupId: number = 0): string { return this.getResponsesAnalysisDataPrefixCacheKey(feedbackId) + groupId; @@ -883,8 +883,8 @@ export class AddonModFeedbackProvider { /** * Get prefix cache key for feedback responses analysis data WS calls. * - * @param {number} feedbackId Feedback ID. - * @return {string} Cache key. + * @param feedbackId Feedback ID. + * @return Cache key. */ protected getResponsesAnalysisDataPrefixCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':responsesanalysis:'; @@ -893,11 +893,11 @@ export class AddonModFeedbackProvider { /** * Gets the resume page information. * - * @param {number} feedbackId Feedback ID. - * @param {boolean} [offline=false] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache=false] True if it should ignore cached data (it always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the info is retrieved. + * @param feedbackId Feedback ID. + * @param offline True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the info is retrieved. */ getResumePage(feedbackId: number, offline: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -929,8 +929,8 @@ export class AddonModFeedbackProvider { /** * Get prefix cache key for resume feedback page data WS calls. * - * @param {number} feedbackId Feedback ID. - * @return {string} Cache key. + * @param feedbackId Feedback ID. + * @return Cache key. */ protected getResumePageDataCacheKey(feedbackId: number): string { return this.getFeedbackDataPrefixCacheKey(feedbackId) + ':launch'; @@ -939,9 +939,9 @@ export class AddonModFeedbackProvider { /** * Invalidates feedback data except files and module info. * - * @param {number} feedbackId Feedback ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param feedbackId Feedback ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAllFeedbackData(feedbackId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -952,9 +952,9 @@ export class AddonModFeedbackProvider { /** * Invalidates feedback analysis data. * - * @param {number} feedbackId Feedback ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param feedbackId Feedback ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAnalysisData(feedbackId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -966,10 +966,10 @@ export class AddonModFeedbackProvider { * Invalidate the prefetched content. * To invalidate files, use AddonFeedbackProvider#invalidateFiles. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID of the module. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID of the module. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -994,9 +994,9 @@ export class AddonModFeedbackProvider { /** * Invalidates temporary completion record data. * - * @param {number} feedbackId Feedback ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param feedbackId Feedback ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateCurrentValuesData(feedbackId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1007,9 +1007,9 @@ export class AddonModFeedbackProvider { /** * Invalidates feedback access information data. * - * @param {number} feedbackId Feedback ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param feedbackId Feedback ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateFeedbackAccessInformationData(feedbackId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1020,9 +1020,9 @@ export class AddonModFeedbackProvider { /** * Invalidates feedback data. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateFeedbackData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1033,9 +1033,9 @@ export class AddonModFeedbackProvider { /** * Invalidate the prefetched files. * - * @param {number} moduleId The module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the files are invalidated. + * @param moduleId The module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the files are invalidated. */ invalidateFiles(moduleId: number, siteId?: string): Promise { return this.filepoolProvider.invalidateFilesByComponent(siteId, AddonModFeedbackProvider.COMPONENT, moduleId); @@ -1044,9 +1044,9 @@ export class AddonModFeedbackProvider { /** * Invalidates feedback non respondents record data. * - * @param {number} feedbackId Feedback ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param feedbackId Feedback ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateNonRespondentsData(feedbackId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1058,9 +1058,9 @@ export class AddonModFeedbackProvider { /** * Invalidates feedback user responses record data. * - * @param {number} feedbackId Feedback ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param feedbackId Feedback ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateResponsesAnalysisData(feedbackId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1072,9 +1072,9 @@ export class AddonModFeedbackProvider { /** * Invalidates launch feedback data. * - * @param {number} feedbackId Feedback ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param feedbackId Feedback ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateResumePageData(feedbackId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1085,10 +1085,10 @@ export class AddonModFeedbackProvider { /** * Returns if feedback has been completed * - * @param {number} feedbackId Feedback ID. - * @param {boolean} [ignoreCache=false] 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. - * @return {Promise} Promise resolved when the info is retrieved. + * @param feedbackId Feedback ID. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the info is retrieved. */ isCompleted(feedbackId: number, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1111,8 +1111,8 @@ export class AddonModFeedbackProvider { /** * Return whether or not the plugin is enabled in a certain site. Plugin is enabled if the feedback WS are available. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. * @since 3.3 */ isPluginEnabled(siteId?: string): Promise { @@ -1125,11 +1125,11 @@ export class AddonModFeedbackProvider { /** * Report the feedback as being viewed. * - * @param {number} id Module ID. - * @param {string} [name] Name of the feedback. - * @param {boolean} [formViewed=false] True if form was viewed. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Module ID. + * @param name Name of the feedback. + * @param formViewed True if form was viewed. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(id: number, name?: string, formViewed: boolean = false, siteId?: string): Promise { const params = { @@ -1144,14 +1144,14 @@ export class AddonModFeedbackProvider { /** * Process a jump between pages. * - * @param {number} feedbackId Feedback ID. - * @param {number} page The page being processed. - * @param {any} responses The data to be processed the key is the field name (usually type[index]_id). - * @param {boolean} goPrevious Whether we want to jump to previous page. - * @param {boolean} formHasErrors Whether the form we sent has required but empty fields (only used in offline). - * @param {number} courseId Course ID the feedback belongs to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the info is retrieved. + * @param feedbackId Feedback ID. + * @param page The page being processed. + * @param responses The data to be processed the key is the field name (usually type[index]_id). + * @param goPrevious Whether we want to jump to previous page. + * @param formHasErrors Whether the form we sent has required but empty fields (only used in offline). + * @param courseId Course ID the feedback belongs to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the info is retrieved. */ processPage(feedbackId: number, page: number, responses: any, goPrevious: boolean, formHasErrors: boolean, courseId: number, siteId?: string): Promise { @@ -1231,12 +1231,12 @@ export class AddonModFeedbackProvider { /** * Process a jump between pages. * - * @param {number} feedbackId Feedback ID. - * @param {number} page The page being processed. - * @param {any} responses The data to be processed the key is the field name (usually type[index]_id). - * @param {boolean} goPrevious Whether we want to jump to previous page. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the info is retrieved. + * @param feedbackId Feedback ID. + * @param page The page being processed. + * @param responses The data to be processed the key is the field name (usually type[index]_id). + * @param goPrevious Whether we want to jump to previous page. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the info is retrieved. */ processPageOnline(feedbackId: number, page: number, responses: any, goPrevious: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/mod/feedback/providers/helper.ts b/src/addon/mod/feedback/providers/helper.ts index e66a24287..64b3f5f2c 100644 --- a/src/addon/mod/feedback/providers/helper.ts +++ b/src/addon/mod/feedback/providers/helper.ts @@ -45,12 +45,12 @@ export class AddonModFeedbackHelperProvider { /** * Check if the page we are going to open is in the history and returns the view controller in the stack to go back. * - * @param {string} pageName Name of the page we want to navigate. - * @param {number} instance Activity instance Id. I.e FeedbackId. - * @param {string} paramName Param name where to find the instance number. - * @param {string} prefix Prefix to check if we are out of the activity context. - * @param {NavController} navCtrl Nav Controller of the view. - * @return {ViewController} Returns view controller found or null. + * @param pageName Name of the page we want to navigate. + * @param instance Activity instance Id. I.e FeedbackId. + * @param paramName Param name where to find the instance number. + * @param prefix Prefix to check if we are out of the activity context. + * @param navCtrl Nav Controller of the view. + * @return Returns view controller found or null. */ protected getPageView(pageName: string, instance: number, paramName: string, prefix: string, navCtrl: NavController): ViewController { @@ -85,10 +85,10 @@ export class AddonModFeedbackHelperProvider { /** * Retrieves a list of students who didn't submit the feedback with extra info. * - * @param {number} feedbackId Feedback ID. - * @param {number} groupId Group id, 0 means that the function will determine the user group. - * @param {number} page The page of records to return. - * @return {Promise} Promise resolved when the info is retrieved. + * @param feedbackId Feedback ID. + * @param groupId Group id, 0 means that the function will determine the user group. + * @param page The page of records to return. + * @return Promise resolved when the info is retrieved. */ getNonRespondents(feedbackId: number, groupId: number, page: number): Promise { return this.feedbackProvider.getNonRespondents(feedbackId, groupId, page).then((responses) => { @@ -103,8 +103,8 @@ export class AddonModFeedbackHelperProvider { /** * Get page items responses to be sent. * - * @param {any[]} items Items where the values are. - * @return {any} Responses object to be sent. + * @param items Items where the values are. + * @return Responses object to be sent. */ getPageItemsResponses(items: any[]): any { const responses = {}; @@ -185,10 +185,10 @@ export class AddonModFeedbackHelperProvider { /** * Returns the feedback user responses with extra info. * - * @param {number} feedbackId Feedback ID. - * @param {number} groupId Group id, 0 means that the function will determine the user group. - * @param {number} page The page of records to return. - * @return {Promise} Promise resolved when the info is retrieved. + * @param feedbackId Feedback ID. + * @param groupId Group id, 0 means that the function will determine the user group. + * @param page The page of records to return. + * @return Promise resolved when the info is retrieved. */ getResponsesAnalysis(feedbackId: number, groupId: number, page: number): Promise { return this.feedbackProvider.getResponsesAnalysis(feedbackId, groupId, page).then((responses) => { @@ -203,10 +203,10 @@ export class AddonModFeedbackHelperProvider { /** * Handle a show entries link. * - * @param {NavController} navCtrl Nav controller to use to navigate. Can be undefined/null. - * @param {any} params URL params. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param navCtrl Nav controller to use to navigate. Can be undefined/null. + * @param params URL params. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ handleShowEntriesLink(navCtrl: NavController, params: any, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -245,8 +245,8 @@ export class AddonModFeedbackHelperProvider { /** * Add Image profile url field on attempts * - * @param {any} attempts Attempts array to get profile from. - * @return {Promise} Returns the same array with the profileimageurl added if found. + * @param attempts Attempts array to get profile from. + * @return Returns the same array with the profileimageurl added if found. */ protected addImageProfileToAttempts(attempts: any): Promise { const promises = attempts.map((attempt) => { @@ -265,12 +265,12 @@ export class AddonModFeedbackHelperProvider { /** * Helper function to open a feature in the app. * - * @param {string} feature Name of the feature to open. - * @param {NavController} navCtrl NavController. - * @param {any} module Course module activity object. - * @param {number} courseId Course Id. - * @param {number} [group=0] Course module activity object. - * @return {Promise} Resolved when navigation animation is done. + * @param feature Name of the feature to open. + * @param navCtrl NavController. + * @param module Course module activity object. + * @param courseId Course Id. + * @param group Course module activity object. + * @return Resolved when navigation animation is done. */ openFeature(feature: string, navCtrl: NavController, module: any, courseId: number, group: number = 0): Promise { const pageName = feature && feature != 'analysis' ? 'AddonModFeedback' + feature + 'Page' : 'AddonModFeedbackIndexPage', @@ -300,8 +300,8 @@ export class AddonModFeedbackHelperProvider { /** * Helper funtion for item type Label. * - * @param {any} item Item to process. - * @return {any} Item processed to show form. + * @param item Item to process. + * @return Item processed to show form. */ protected getItemFormLabel(item: any): any { item.template = 'label'; @@ -314,8 +314,8 @@ export class AddonModFeedbackHelperProvider { /** * Helper funtion for item type Info. * - * @param {any} item Item to process. - * @return {any} Item processed to show form. + * @param item Item to process. + * @return Item processed to show form. */ protected getItemFormInfo(item: any): any { item.template = 'label'; @@ -340,8 +340,8 @@ export class AddonModFeedbackHelperProvider { /** * Helper funtion for item type Numeric. * - * @param {any} item Item to process. - * @return {any} Item processed to show form. + * @param item Item to process. + * @return Item processed to show form. */ protected getItemFormNumeric(item: any): any { item.template = 'numeric'; @@ -361,8 +361,8 @@ export class AddonModFeedbackHelperProvider { /** * Helper funtion for item type Text field. * - * @param {any} item Item to process. - * @return {any} Item processed to show form. + * @param item Item to process. + * @return Item processed to show form. */ protected getItemFormTextfield(item: any): any { item.template = 'textfield'; @@ -375,8 +375,8 @@ export class AddonModFeedbackHelperProvider { /** * Helper funtion for item type Textarea. * - * @param {any} item Item to process. - * @return {any} Item processed to show form. + * @param item Item to process. + * @return Item processed to show form. */ protected getItemFormTextarea(item: any): any { item.template = 'textarea'; @@ -388,8 +388,8 @@ export class AddonModFeedbackHelperProvider { /** * Helper funtion for item type Multichoice. * - * @param {any} item Item to process. - * @return {any} Item processed to show form. + * @param item Item to process. + * @return Item processed to show form. */ protected getItemFormMultichoice(item: any): any { let parts = item.presentation.split(AddonModFeedbackProvider.MULTICHOICE_TYPE_SEP) || []; @@ -443,8 +443,8 @@ export class AddonModFeedbackHelperProvider { /** * Helper funtion for item type Captcha. * - * @param {any} item Item to process. - * @return {any} Item processed to show form. + * @param item Item to process. + * @return Item processed to show form. */ protected getItemFormCaptcha(item: any): any { const data = this.textUtils.parseJSON(item.otherdata); @@ -462,9 +462,9 @@ export class AddonModFeedbackHelperProvider { /** * Process and returns item to print form. * - * @param {any} item Item to process. - * @param {boolean} preview Previewing options. - * @return {any} Item processed to show form. + * @param item Item to process. + * @param preview Previewing options. + * @return Item processed to show form. */ getItemForm(item: any, preview: boolean): any { switch (item.typ) { @@ -502,9 +502,9 @@ export class AddonModFeedbackHelperProvider { * Returns human-readable boundaries (min - max). * Based on Moodle's get_boundaries_for_display. * - * @param {number} rangeFrom Range from. - * @param {number} rangeTo Range to. - * @return {string} Human-readable boundaries. + * @param rangeFrom Range from. + * @param rangeTo Range to. + * @return Human-readable boundaries. */ protected getNumericBoundariesForDisplay(rangeFrom: number, rangeTo: number): string { const rangeFromSet = typeof rangeFrom == 'number', diff --git a/src/addon/mod/feedback/providers/list-link-handler.ts b/src/addon/mod/feedback/providers/list-link-handler.ts index 8d6750e0b..b9ecdd7a5 100644 --- a/src/addon/mod/feedback/providers/list-link-handler.ts +++ b/src/addon/mod/feedback/providers/list-link-handler.ts @@ -33,7 +33,7 @@ export class AddonModFeedbackListLinkHandler extends CoreContentLinksModuleListH /** * Check if the handler is enabled on a site level. * - * @return {Promise} Whether or not the handler is enabled on a site level. + * @return Whether or not the handler is enabled on a site level. */ isEnabled(): Promise { return this.feedbackProvider.isPluginEnabled(); diff --git a/src/addon/mod/feedback/providers/module-handler.ts b/src/addon/mod/feedback/providers/module-handler.ts index 7744ce1b3..b5b6da733 100644 --- a/src/addon/mod/feedback/providers/module-handler.ts +++ b/src/addon/mod/feedback/providers/module-handler.ts @@ -45,7 +45,7 @@ export class AddonModFeedbackModuleHandler implements CoreCourseModuleHandler { /** * Check if the handler is enabled on a site level. * - * @return {Promise} Whether or not the handler is enabled on a site level. + * @return Whether or not the handler is enabled on a site level. */ isEnabled(): Promise { return this.feedbackProvider.isPluginEnabled(); @@ -54,10 +54,10 @@ export class AddonModFeedbackModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { return { @@ -79,9 +79,9 @@ export class AddonModFeedbackModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModFeedbackIndexComponent; diff --git a/src/addon/mod/feedback/providers/offline.ts b/src/addon/mod/feedback/providers/offline.ts index b9fd588ef..86d604e16 100644 --- a/src/addon/mod/feedback/providers/offline.ts +++ b/src/addon/mod/feedback/providers/offline.ts @@ -70,10 +70,10 @@ export class AddonModFeedbackOfflineProvider { /** * Delete the stored for a certain feedback page. * - * @param {number} feedbackId Feedback ID. - * @param {number} page Page of the form to delete responses from. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if deleted, rejected if failure. + * @param feedbackId Feedback ID. + * @param page Page of the form to delete responses from. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if deleted, rejected if failure. */ deleteFeedbackPageResponses(feedbackId: number, page: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -84,8 +84,8 @@ export class AddonModFeedbackOfflineProvider { /** * Get all the stored feedback responses data from all the feedback. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with entries. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with entries. */ getAllFeedbackResponses(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -102,9 +102,9 @@ export class AddonModFeedbackOfflineProvider { /** * Get all the stored responses from a certain feedback. * - * @param {number} feedbackId Feedback ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with responses. + * @param feedbackId Feedback ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with responses. */ getFeedbackResponses(feedbackId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -121,10 +121,10 @@ export class AddonModFeedbackOfflineProvider { /** * Get the stored responses for a certain feedback page. * - * @param {number} feedbackId Feedback ID. - * @param {number} page Page of the form to get responses from. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with responses. + * @param feedbackId Feedback ID. + * @param page Page of the form to get responses from. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with responses. */ getFeedbackPageResponses(feedbackId: number, page: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -139,9 +139,9 @@ export class AddonModFeedbackOfflineProvider { /** * Get if the feedback have something to be synced. * - * @param {number} feedbackId Feedback ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if the feedback have something to be synced. + * @param feedbackId Feedback ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if the feedback have something to be synced. */ hasFeedbackOfflineData(feedbackId: number, siteId?: string): Promise { return this.getFeedbackResponses(feedbackId, siteId).then((responses) => { @@ -152,12 +152,12 @@ export class AddonModFeedbackOfflineProvider { /** * Save page responses to be sent later. * - * @param {number} feedbackId Feedback ID. - * @param {number} page The page being processed. - * @param {any} responses The data to be processed the key is the field name (usually type[index]_id) - * @param {number} courseId Course ID the feedback belongs to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param feedbackId Feedback ID. + * @param page The page being processed. + * @param responses The data to be processed the key is the field name (usually type[index]_id) + * @param courseId Course ID the feedback belongs to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ saveResponses(feedbackId: number, page: number, responses: any, courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/mod/feedback/providers/prefetch-handler.ts b/src/addon/mod/feedback/providers/prefetch-handler.ts index 097e31331..07d3d0b84 100644 --- a/src/addon/mod/feedback/providers/prefetch-handler.ts +++ b/src/addon/mod/feedback/providers/prefetch-handler.ts @@ -52,10 +52,10 @@ export class AddonModFeedbackPrefetchHandler extends CoreCourseActivityPrefetchH /** * Get the list of downloadable files. * - * @param {any} module Module to get the files. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise} Promise resolved with the list of files. + * @param module Module to get the files. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved with the list of files. */ getFiles(module: any, courseId: number, single?: boolean): Promise { let files = []; @@ -82,9 +82,9 @@ export class AddonModFeedbackPrefetchHandler extends CoreCourseActivityPrefetchH /** * Returns feedback intro files. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved with list of intro files. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @return Promise resolved with list of intro files. */ getIntroFiles(module: any, courseId: number): Promise { return this.feedbackProvider.getFeedback(courseId, module.id).catch(() => { @@ -97,9 +97,9 @@ export class AddonModFeedbackPrefetchHandler extends CoreCourseActivityPrefetchH /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.feedbackProvider.invalidateContent(moduleId, courseId); @@ -108,9 +108,9 @@ export class AddonModFeedbackPrefetchHandler extends CoreCourseActivityPrefetchH /** * Invalidate WS calls needed to determine module status. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule(module: any, courseId: number): Promise { return this.feedbackProvider.invalidateFeedbackData(courseId); @@ -121,9 +121,9 @@ export class AddonModFeedbackPrefetchHandler extends CoreCourseActivityPrefetchH * A feedback isn't downloadable if it's not open yet. * Closed feedback are downloadable because teachers can always see the results. * - * @param {any} module Module to check. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved with true if downloadable, resolved with false otherwise. + * @param module Module to check. + * @param courseId Course ID the module belongs to. + * @return Promise resolved with true if downloadable, resolved with false otherwise. */ isDownloadable(module: any, courseId: number): boolean | Promise { return this.feedbackProvider.getFeedback(courseId, module.id, undefined, true).then((feedback) => { @@ -146,7 +146,7 @@ export class AddonModFeedbackPrefetchHandler extends CoreCourseActivityPrefetchH /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ isEnabled(): boolean | Promise { return this.feedbackProvider.isPluginEnabled(); @@ -155,11 +155,11 @@ export class AddonModFeedbackPrefetchHandler extends CoreCourseActivityPrefetchH /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string): Promise { return this.prefetchPackage(module, courseId, single, this.prefetchFeedback.bind(this)); @@ -168,11 +168,11 @@ export class AddonModFeedbackPrefetchHandler extends CoreCourseActivityPrefetchH /** * Prefetch a feedback. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} single True if we're downloading a single module, false if we're downloading a whole section. - * @param {String} siteId Site ID. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. + * @return Promise resolved when done. */ protected prefetchFeedback(module: any, courseId: number, single: boolean, siteId: string): Promise { // Prefetch the feedback data. @@ -232,10 +232,10 @@ export class AddonModFeedbackPrefetchHandler extends CoreCourseActivityPrefetchH /** * Sync a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ sync(module: any, courseId: number, siteId?: any): Promise { if (!this.syncProvider) { diff --git a/src/addon/mod/feedback/providers/print-link-handler.ts b/src/addon/mod/feedback/providers/print-link-handler.ts index 3be523950..978398fb0 100644 --- a/src/addon/mod/feedback/providers/print-link-handler.ts +++ b/src/addon/mod/feedback/providers/print-link-handler.ts @@ -38,11 +38,11 @@ export class AddonModFeedbackPrintLinkHandler extends CoreContentLinksHandlerBas /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -71,11 +71,11 @@ export class AddonModFeedbackPrintLinkHandler extends CoreContentLinksHandlerBas * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { if (typeof params.id == 'undefined') { diff --git a/src/addon/mod/feedback/providers/push-click-handler.ts b/src/addon/mod/feedback/providers/push-click-handler.ts index 675e7d0dd..27f288438 100644 --- a/src/addon/mod/feedback/providers/push-click-handler.ts +++ b/src/addon/mod/feedback/providers/push-click-handler.ts @@ -36,8 +36,8 @@ export class AddonModFeedbackPushClickHandler implements CorePushNotificationsCl /** * Check if a notification click is handled by this handler. * - * @param {any} notification The notification to check. - * @return {boolean} Whether the notification click is handled by this handler + * @param notification The notification to check. + * @return Whether the notification click is handled by this handler */ handles(notification: any): boolean | Promise { if (this.utils.isTrueOrOne(notification.notif) && notification.moodlecomponent == 'mod_feedback' && @@ -52,8 +52,8 @@ export class AddonModFeedbackPushClickHandler implements CorePushNotificationsCl /** * Handle the notification click. * - * @param {any} notification The notification to check. - * @return {Promise} Promise resolved when done. + * @param notification The notification to check. + * @return Promise resolved when done. */ handleClick(notification: any): Promise { const contextUrlParams = this.urlUtils.extractUrlParams(notification.contexturl), diff --git a/src/addon/mod/feedback/providers/show-entries-link-handler.ts b/src/addon/mod/feedback/providers/show-entries-link-handler.ts index 498703386..195e3f33d 100644 --- a/src/addon/mod/feedback/providers/show-entries-link-handler.ts +++ b/src/addon/mod/feedback/providers/show-entries-link-handler.ts @@ -35,11 +35,11 @@ export class AddonModFeedbackShowEntriesLinkHandler extends CoreContentLinksHand /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -54,11 +54,11 @@ export class AddonModFeedbackShowEntriesLinkHandler extends CoreContentLinksHand * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return this.feedbackProvider.isPluginEnabled(siteId).then((enabled) => { diff --git a/src/addon/mod/feedback/providers/show-non-respondents-link-handler.ts b/src/addon/mod/feedback/providers/show-non-respondents-link-handler.ts index cb88ecaa3..8ed384cd6 100644 --- a/src/addon/mod/feedback/providers/show-non-respondents-link-handler.ts +++ b/src/addon/mod/feedback/providers/show-non-respondents-link-handler.ts @@ -38,11 +38,11 @@ export class AddonModFeedbackShowNonRespondentsLinkHandler extends CoreContentLi /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -70,11 +70,11 @@ export class AddonModFeedbackShowNonRespondentsLinkHandler extends CoreContentLi * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return this.feedbackProvider.isPluginEnabled(siteId).then((enabled) => { diff --git a/src/addon/mod/feedback/providers/sync-cron-handler.ts b/src/addon/mod/feedback/providers/sync-cron-handler.ts index 94d43e905..2e455497a 100644 --- a/src/addon/mod/feedback/providers/sync-cron-handler.ts +++ b/src/addon/mod/feedback/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class AddonModFeedbackSyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.feedbackSync.syncAllFeedbacks(siteId, force); @@ -40,7 +40,7 @@ export class AddonModFeedbackSyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return this.feedbackSync.syncInterval; diff --git a/src/addon/mod/feedback/providers/sync.ts b/src/addon/mod/feedback/providers/sync.ts index c643f237b..72072a3cf 100644 --- a/src/addon/mod/feedback/providers/sync.ts +++ b/src/addon/mod/feedback/providers/sync.ts @@ -56,11 +56,11 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv /** * Conveniece function to prefetch data after an update. * - * @param {any} module Module. - * @param {number} courseId Course ID. - * @param {RegExp} [regex] If regex matches, don't download the data. Defaults to check files and timers. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID. + * @param regex If regex matches, don't download the data. Defaults to check files and timers. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ prefetchAfterUpdate(module: any, courseId: number, regex?: RegExp, siteId?: string): Promise { regex = regex || /^.*files$|^timers/; @@ -71,9 +71,9 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv /** * Try to synchronize all the feedbacks in a certain site or in all sites. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} force Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncAllFeedbacks(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all feedbacks', this.syncAllFeedbacksFunc.bind(this), [force], siteId); @@ -82,9 +82,9 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv /** * Sync all pending feedbacks on a site. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} force Wether to force sync not depending on last execution. - * @param {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @param Promise resolved if sync is successful, rejected if sync fails. */ protected syncAllFeedbacksFunc(siteId?: string, force?: boolean): Promise { // Sync all new responses. @@ -122,9 +122,9 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv /** * Sync a feedback only if a certain time has passed since the last time. * - * @param {number} feedbackId Feedback ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the feedback is synced or if it doesn't need to be synced. + * @param feedbackId Feedback ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the feedback is synced or if it doesn't need to be synced. */ syncFeedbackIfNeeded(feedbackId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -139,9 +139,9 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv /** * Synchronize all offline responses of a feedback. * - * @param {number} feedbackId Feedback ID to be synced. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param feedbackId Feedback ID to be synced. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncFeedback(feedbackId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -260,12 +260,12 @@ export class AddonModFeedbackSyncProvider extends CoreCourseActivitySyncBaseProv /** * Convenience function to sync process page calls. * - * @param {any} feedback Feedback object. - * @param {any} data Response data. - * @param {string} siteId Site Id. - * @param {number} timemodified Current completed modification time. - * @param {any} result Result object to be modified. - * @return {Promise} Resolve when done or rejected with error. + * @param feedback Feedback object. + * @param data Response data. + * @param siteId Site Id. + * @param timemodified Current completed modification time. + * @param result Result object to be modified. + * @return Resolve when done or rejected with error. */ protected processPage(feedback: any, data: any, siteId: string, timemodified: number, result: any): Promise { // Delete all pages that are submitted before changing website. diff --git a/src/addon/mod/folder/components/index/index.ts b/src/addon/mod/folder/components/index/index.ts index d8c296b00..d23b70e38 100644 --- a/src/addon/mod/folder/components/index/index.ts +++ b/src/addon/mod/folder/components/index/index.ts @@ -70,7 +70,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { return this.folderProvider.invalidateContent(this.module.id, this.courseId); @@ -78,7 +78,7 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo /** * Convenience function to set scope data using module. - * @param {any} module Module to show. + * @param module Module to show. */ protected showModuleData(module: any): void { this.description = module.intro || module.description; @@ -96,8 +96,8 @@ export class AddonModFolderIndexComponent extends CoreCourseModuleMainResourceCo /** * Download folder contents. * - * @param {boolean} [refresh] Whether we're refreshing data. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @return Promise resolved when done. */ protected fetchContent(refresh?: boolean): Promise { let promise; diff --git a/src/addon/mod/folder/pages/index/index.ts b/src/addon/mod/folder/pages/index/index.ts index e0b187c19..2131aa82e 100644 --- a/src/addon/mod/folder/pages/index/index.ts +++ b/src/addon/mod/folder/pages/index/index.ts @@ -42,7 +42,7 @@ export class AddonModFolderIndexPage { /** * Update some data based on the folder instance. * - * @param {any} folder Folder instance. + * @param folder Folder instance. */ updateData(folder: any): void { this.title = folder.name || this.title; diff --git a/src/addon/mod/folder/providers/folder.ts b/src/addon/mod/folder/providers/folder.ts index ce3336634..989a0c69a 100644 --- a/src/addon/mod/folder/providers/folder.ts +++ b/src/addon/mod/folder/providers/folder.ts @@ -38,10 +38,10 @@ export class AddonModFolderProvider { /** * Get a folder by course module ID. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the book is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the book is retrieved. */ getFolder(courseId: number, cmId: number, siteId?: string): Promise { return this.getFolderByKey(courseId, 'coursemodule', cmId, siteId); @@ -50,11 +50,11 @@ export class AddonModFolderProvider { /** * Get a folder. * - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the book is retrieved. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the book is retrieved. */ protected getFolderByKey(courseId: number, key: string, value: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -84,8 +84,8 @@ export class AddonModFolderProvider { /** * Get cache key for folder data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getFolderCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'folder:' + courseId; @@ -94,10 +94,9 @@ export class AddonModFolderProvider { /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID of the module. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} + * @param moduleId The module ID. + * @param courseId Course ID of the module. + * @param siteId Site ID. If not defined, current site. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { const promises = []; @@ -111,9 +110,9 @@ export class AddonModFolderProvider { /** * Invalidates folder data. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateFolderData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -124,7 +123,7 @@ export class AddonModFolderProvider { /** * Returns whether or not getFolder WS available or not. * - * @return {boolean} If WS is avalaible. + * @return If WS is avalaible. * @since 3.3 */ isGetFolderWSAvailable(): boolean { @@ -134,10 +133,10 @@ export class AddonModFolderProvider { /** * Report a folder as being viewed. * - * @param {number} id Module ID. - * @param {string} [name] Name of the folder. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Module ID. + * @param name Name of the folder. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params = { diff --git a/src/addon/mod/folder/providers/helper.ts b/src/addon/mod/folder/providers/helper.ts index 9715a6a8a..38e4a4ae8 100644 --- a/src/addon/mod/folder/providers/helper.ts +++ b/src/addon/mod/folder/providers/helper.ts @@ -29,8 +29,8 @@ export class AddonModFolderHelperProvider { * Folders found in filepaths are added to the array. Each folder has the properties: name, fileicon, * type (folder), filepath and contents (array with files and subfolders). * - * @param {any[]} contents Folder contents. - * @return {any[]} Formatted contents. + * @param contents Folder contents. + * @return Formatted contents. */ formatContents(contents: any[]): any[] { const files = [], diff --git a/src/addon/mod/folder/providers/module-handler.ts b/src/addon/mod/folder/providers/module-handler.ts index 5d372a12c..b0a66e1ae 100644 --- a/src/addon/mod/folder/providers/module-handler.ts +++ b/src/addon/mod/folder/providers/module-handler.ts @@ -44,7 +44,7 @@ export class AddonModFolderModuleHandler implements CoreCourseModuleHandler { /** * Check if the handler is enabled on a site level. * - * @return {boolean|Promise} 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 { return true; @@ -53,10 +53,10 @@ export class AddonModFolderModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { return { @@ -78,9 +78,9 @@ export class AddonModFolderModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModFolderIndexComponent; diff --git a/src/addon/mod/folder/providers/pluginfile-handler.ts b/src/addon/mod/folder/providers/pluginfile-handler.ts index 943d2b0d4..ea5b6a576 100644 --- a/src/addon/mod/folder/providers/pluginfile-handler.ts +++ b/src/addon/mod/folder/providers/pluginfile-handler.ts @@ -26,8 +26,8 @@ export class AddonModFolderPluginFileHandler implements CorePluginFileHandler { /** * Return the RegExp to match the revision on pluginfile URLs. * - * @param {string[]} args Arguments of the pluginfile URL defining component and filearea at least. - * @return {RegExp} RegExp to match the revision on pluginfile URLs. + * @param args Arguments of the pluginfile URL defining component and filearea at least. + * @return RegExp to match the revision on pluginfile URLs. */ getComponentRevisionRegExp(args: string[]): RegExp { // Check filearea. @@ -40,8 +40,8 @@ export class AddonModFolderPluginFileHandler implements CorePluginFileHandler { /** * Should return the string to remove the revision on pluginfile url. * - * @param {string[]} args Arguments of the pluginfile URL defining component and filearea at least. - * @return {string} String to remove the revision on pluginfile url. + * @param args Arguments of the pluginfile URL defining component and filearea at least. + * @return String to remove the revision on pluginfile url. */ getComponentRevisionReplace(args: string[]): string { // Component + Filearea + Revision diff --git a/src/addon/mod/folder/providers/prefetch-handler.ts b/src/addon/mod/folder/providers/prefetch-handler.ts index 77197e136..f03180806 100644 --- a/src/addon/mod/folder/providers/prefetch-handler.ts +++ b/src/addon/mod/folder/providers/prefetch-handler.ts @@ -42,13 +42,13 @@ export class AddonModFolderPrefetchHandler extends CoreCourseResourcePrefetchHan /** * Download or prefetch the content. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {boolean} [prefetch] True to prefetch, false to download right away. - * @param {string} [dirPath] Path of the directory where to store all the content files. This is to keep the files - * relative paths and make the package work in an iframe. Undefined to download the files - * in the filepool root folder. - * @return {Promise} Promise resolved when all content is downloaded. Data returned is not reliable. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param prefetch True to prefetch, false to download right away. + * @param dirPath Path of the directory where to store all the content files. This is to keep the files + * relative paths and make the package work in an iframe. Undefined to download the files + * in the filepool root folder. + * @return Promise resolved when all content is downloaded. Data returned is not reliable. */ downloadOrPrefetch(module: any, courseId: number, prefetch?: boolean, dirPath?: string): Promise { const promises = []; @@ -65,9 +65,9 @@ export class AddonModFolderPrefetchHandler extends CoreCourseResourcePrefetchHan /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.folderProvider.invalidateContent(moduleId, courseId); @@ -76,9 +76,9 @@ export class AddonModFolderPrefetchHandler extends CoreCourseResourcePrefetchHan /** * Invalidate WS calls needed to determine module status. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule(module: any, courseId: number): Promise { const promises = []; diff --git a/src/addon/mod/forum/components/index/index.ts b/src/addon/mod/forum/components/index/index.ts index b3a4209b6..9d3f84803 100644 --- a/src/addon/mod/forum/components/index/index.ts +++ b/src/addon/mod/forum/components/index/index.ts @@ -163,10 +163,10 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Download the component contents. * - * @param {boolean} [refresh=false] Whether we're refreshing data. - * @param {boolean} [sync=false] If the refresh needs syncing. - * @param {boolean} [showErrors=false] Wether to show errors to the user or hide them. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @param sync If the refresh needs syncing. + * @param showErrors Wether to show errors to the user or hide them. + * @return Promise resolved when done. */ protected fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { this.loadMoreError = false; @@ -253,7 +253,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Convenience function to fetch offline discussions. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchOfflineDiscussion(): Promise { return this.forumOffline.getNewDiscussions(this.forum.id).then((offlineDiscussions) => { @@ -299,8 +299,8 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Convenience function to get forum discussions. * - * @param {boolean} refresh Whether we're refreshing data. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @return Promise resolved when done. */ protected fetchDiscussions(refresh: boolean): Promise { this.loadMoreError = false; @@ -371,8 +371,8 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Convenience function to load more forum discussions. * - * @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. - * @return {Promise} Promise resolved when done. + * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. + * @return Promise resolved when done. */ fetchMoreDiscussions(infiniteComplete?: any): Promise { return this.fetchDiscussions(false).catch((message) => { @@ -387,7 +387,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Convenience function to fetch the sort order preference. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchSortOrderPreference(): Promise { let promise; @@ -408,7 +408,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -431,7 +431,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Performs the sync of the activity. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected sync(): Promise { return this.prefetchHandler.sync(this.module, this.courseId); @@ -440,8 +440,8 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Checks if sync has succeed from result sync data. * - * @param {any} result Data returned on the sync function. - * @return {boolean} Whether it succeed or not. + * @param result Data returned on the sync function. + * @return Whether it succeed or not. */ protected hasSyncSucceed(result: any): boolean { return result.updated; @@ -450,8 +450,8 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Compares sync event data with current data to check if refresh content is needed. * - * @param {any} syncEventData Data receiven on sync observer. - * @return {boolean} True if refresh is needed, false otherwise. + * @param syncEventData Data receiven on sync observer. + * @return True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: any): boolean { return this.forum && syncEventData.source != 'index' && syncEventData.forumId == this.forum.id && @@ -461,8 +461,8 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Function called when we receive an event of new discussion or reply to discussion. * - * @param {boolean} isNewDiscussion Whether it's a new discussion event. - * @param {any} data Event data. + * @param isNewDiscussion Whether it's a new discussion event. + * @param data Event data. */ protected eventReceived(isNewDiscussion: boolean, data: any): void { if ((this.forum && this.forum.id === data.forumId) || data.cmId === this.module.id) { @@ -499,7 +499,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Opens a discussion. * - * @param {any} discussion Discussion object. + * @param discussion Discussion object. */ openDiscussion(discussion: any): void { const params = { @@ -515,7 +515,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Opens the new discussion form. * - * @param {number} [timeCreated=0] Creation time of the offline discussion. + * @param timeCreated Creation time of the offline discussion. */ openNewDiscussion(timeCreated: number = 0): void { const params = { @@ -532,7 +532,7 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom /** * Display the sort order selector modal. * - * @param {MouseEvent} event Event. + * @param event Event. */ showSortOrderSelector(event: MouseEvent): void { if (!this.sortingAvailable) { diff --git a/src/addon/mod/forum/components/post/post.ts b/src/addon/mod/forum/components/post/post.ts index d6a9ca54d..d940e20da 100644 --- a/src/addon/mod/forum/components/post/post.ts +++ b/src/addon/mod/forum/components/post/post.ts @@ -83,12 +83,12 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy { /** * Set data to new post, clearing temporary files and updating original data. * - * @param {number} [replyingTo] Id of post beeing replied. - * @param {boolean} [isEditing] True it's an offline reply beeing edited, false otherwise. - * @param {string} [subject] Subject of the reply. - * @param {string} [message] Message of the reply. - * @param {boolean} [isPrivate] True if it's private reply. - * @param {any[]} [files] Reply attachments. + * @param replyingTo Id of post beeing replied. + * @param isEditing True it's an offline reply beeing edited, false otherwise. + * @param subject Subject of the reply. + * @param message Message of the reply. + * @param isPrivate True if it's private reply. + * @param files Reply attachments. */ protected setReplyData(replyingTo?: number, isEditing?: boolean, subject?: string, message?: string, files?: any[], isPrivate?: boolean): void { @@ -172,7 +172,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy { /** * Message changed. * - * @param {string} text The new text. + * @param text The new text. */ onMessageChange(text: string): void { this.replyData.message = text; @@ -338,7 +338,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy { /** * Confirm discard changes if any. * - * @return {Promise} Promise resolved if the user confirms or data was not changed and rejected otherwise. + * @return Promise resolved if the user confirms or data was not changed and rejected otherwise. */ protected confirmDiscard(): Promise { if (this.forumHelper.hasPostDataChanged(this.replyData, this.originalData)) { diff --git a/src/addon/mod/forum/pages/discussion/discussion.ts b/src/addon/mod/forum/pages/discussion/discussion.ts index 7c395fc57..278f21f7d 100644 --- a/src/addon/mod/forum/pages/discussion/discussion.ts +++ b/src/addon/mod/forum/pages/discussion/discussion.ts @@ -188,7 +188,7 @@ export class AddonModForumDiscussionPage implements OnDestroy { /** * Check if we can leave the page or not. * - * @return {boolean|Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { let promise: any; @@ -209,7 +209,7 @@ export class AddonModForumDiscussionPage implements OnDestroy { /** * Convenience function to get the forum. * - * @return {Promise} Promise resolved with the forum. + * @return Promise resolved with the forum. */ protected fetchForum(): Promise { if (this.courseId && this.cmId) { @@ -225,10 +225,10 @@ export class AddonModForumDiscussionPage implements OnDestroy { /** * Convenience function to get the posts. * - * @param {boolean} [sync] Whether to try to synchronize the discussion. - * @param {boolean} [showErrors] Whether to show errors in a modal. - * @param {boolean} [forceMarkAsRead] Whether to mark all posts as read. - * @return {Promise} Promise resolved when done. + * @param sync Whether to try to synchronize the discussion. + * @param showErrors Whether to show errors in a modal. + * @param forceMarkAsRead Whether to mark all posts as read. + * @return Promise resolved when done. */ protected fetchPosts(sync?: boolean, showErrors?: boolean, forceMarkAsRead?: boolean): Promise { let syncPromise; @@ -405,8 +405,8 @@ export class AddonModForumDiscussionPage implements OnDestroy { /** * Tries to synchronize the posts discussion. * - * @param {boolean} showErrors Whether to show errors in a modal. - * @return {Promise} Promise resolved when done. + * @param showErrors Whether to show errors in a modal. + * @return Promise resolved when done. */ protected syncDiscussion(showErrors: boolean): Promise { const promises = []; @@ -446,10 +446,10 @@ export class AddonModForumDiscussionPage implements OnDestroy { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @param {Function} [done] Function to call when done. - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @param done Function to call when done. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved when done. */ doRefresh(refresher?: any, done?: () => void, showErrors: boolean = false): Promise { if (this.discussionLoaded) { @@ -465,9 +465,9 @@ export class AddonModForumDiscussionPage implements OnDestroy { /** * Refresh posts. * - * @param {boolean} [sync] Whether to try to synchronize the discussion. - * @param {boolean} [showErrors] Whether to show errors in a modal. - * @return {Promise} Promise resolved when done. + * @param sync Whether to try to synchronize the discussion. + * @param showErrors Whether to show errors in a modal. + * @return Promise resolved when done. */ refreshPosts(sync?: boolean, showErrors?: boolean): Promise { this.domUtils.scrollToTop(this.content); @@ -491,8 +491,8 @@ export class AddonModForumDiscussionPage implements OnDestroy { /** * Function to change posts sorting * - * @param {SortType} type Sort type. - * @return {Promise} Promised resolved when done. + * @param type Sort type. + * @return Promised resolved when done. */ changeSort(type: SortType): Promise { this.discussionLoaded = false; @@ -505,7 +505,7 @@ export class AddonModForumDiscussionPage implements OnDestroy { /** * Lock or unlock the discussion. * - * @param {boolean} locked True to lock the discussion, false to unlock. + * @param locked True to lock the discussion, false to unlock. */ setLockState(locked: boolean): void { const modal = this.domUtils.showModalLoading('core.sending', true); @@ -532,7 +532,7 @@ export class AddonModForumDiscussionPage implements OnDestroy { /** * Pin or unpin the discussion. * - * @param {boolean} pinned True to pin the discussion, false to unpin it. + * @param pinned True to pin the discussion, false to unpin it. */ setPinState(pinned: boolean): void { const modal = this.domUtils.showModalLoading('core.sending', true); @@ -559,7 +559,7 @@ export class AddonModForumDiscussionPage implements OnDestroy { /** * Star or unstar the discussion. * - * @param {boolean} starred True to star the discussion, false to unstar it. + * @param starred True to star the discussion, false to unstar it. */ toggleFavouriteState(starred: boolean): void { const modal = this.domUtils.showModalLoading('core.sending', true); diff --git a/src/addon/mod/forum/pages/index/index.ts b/src/addon/mod/forum/pages/index/index.ts index 102e0b88f..97b78dc3a 100644 --- a/src/addon/mod/forum/pages/index/index.ts +++ b/src/addon/mod/forum/pages/index/index.ts @@ -40,7 +40,7 @@ export class AddonModForumIndexPage { /** * Update some data based on the forum instance. * - * @param {any} forum Forum instance. + * @param forum Forum instance. */ updateData(forum: any): void { this.title = forum.name || this.title; diff --git a/src/addon/mod/forum/pages/new-discussion/new-discussion.ts b/src/addon/mod/forum/pages/new-discussion/new-discussion.ts index 337966e1d..1291edfaa 100644 --- a/src/addon/mod/forum/pages/new-discussion/new-discussion.ts +++ b/src/addon/mod/forum/pages/new-discussion/new-discussion.ts @@ -128,8 +128,8 @@ export class AddonModForumNewDiscussionPage implements OnDestroy { /** * Fetch if forum uses groups and the groups it uses. * - * @param {boolean} [refresh] Whether we're refreshing data. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @return Promise resolved when done. */ protected fetchDiscussionData(refresh?: boolean): Promise { return this.groupsProvider.getActivityGroupMode(this.cmId).then((mode) => { @@ -253,8 +253,8 @@ export class AddonModForumNewDiscussionPage implements OnDestroy { /** * Validate which of the groups returned by getActivityAllowedGroups in visible groups should be shown to post to. * - * @param {any[]} forumGroups Forum groups. - * @return {Promise} Promise resolved with the list of groups. + * @param forumGroups Forum groups. + * @return Promise resolved with the list of groups. */ protected validateVisibleGroups(forumGroups: any[]): Promise { // We first check if the user can post to all the groups. @@ -301,9 +301,9 @@ export class AddonModForumNewDiscussionPage implements OnDestroy { /** * Filter forum groups, returning only those that are inside user groups. * - * @param {any[]} forumGroups Forum groups. - * @param {any[]} userGroups User groups. - * @return {any[]} Filtered groups. + * @param forumGroups Forum groups. + * @param userGroups User groups. + * @return Filtered groups. */ protected filterGroups(forumGroups: any[], userGroups: any[]): any[] { const filtered = []; @@ -321,9 +321,9 @@ export class AddonModForumNewDiscussionPage implements OnDestroy { /** * Add the "All participants" option to a list of groups if the user can add a discussion to all participants. * - * @param {any[]} groups Groups. - * @param {boolean} check True to check if the user can add a discussion to all participants. - * @return {Promise} Promise resolved with the list of groups. + * @param groups Groups. + * @param check True to check if the user can add a discussion to all participants. + * @return Promise resolved with the list of groups. */ protected addAllParticipantsOption(groups: any[], check: boolean): Promise { if (!this.forumProvider.isAllParticipantsFixed()) { @@ -365,7 +365,7 @@ export class AddonModForumNewDiscussionPage implements OnDestroy { /** * Pull to refresh. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshGroups(refresher: any): void { const promises = [ @@ -384,8 +384,8 @@ export class AddonModForumNewDiscussionPage implements OnDestroy { /** * Convenience function to update or return to discussions depending on device. * - * @param {number} [discussionIds] Ids of the new discussions. - * @param {number} [discTimecreated] The time created of the discussion (if offline). + * @param discussionIds Ids of the new discussions. + * @param discTimecreated The time created of the discussion (if offline). */ protected returnToDiscussions(discussionIds?: number[], discTimecreated?: number): void { const data: any = { @@ -423,7 +423,7 @@ export class AddonModForumNewDiscussionPage implements OnDestroy { /** * Message changed. * - * @param {string} text The new text. + * @param text The new text. */ onMessageChange(text: string): void { this.newDiscussion.message = text; @@ -515,7 +515,7 @@ export class AddonModForumNewDiscussionPage implements OnDestroy { /** * Check if we can leave the page or not. * - * @return {boolean|Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { let promise: any; diff --git a/src/addon/mod/forum/pages/sort-order-selector/sort-order-selector.ts b/src/addon/mod/forum/pages/sort-order-selector/sort-order-selector.ts index 0d83646a6..eb69c3270 100644 --- a/src/addon/mod/forum/pages/sort-order-selector/sort-order-selector.ts +++ b/src/addon/mod/forum/pages/sort-order-selector/sort-order-selector.ts @@ -43,7 +43,7 @@ export class AddonModForumSortOrderSelectorPage { /** * Select a sort order. * - * @param {any} sortOrder Selected sort order. + * @param sortOrder Selected sort order. */ selectSortOrder(sortOrder: any): void { this.viewCtrl.dismiss(sortOrder); diff --git a/src/addon/mod/forum/providers/discussion-link-handler.ts b/src/addon/mod/forum/providers/discussion-link-handler.ts index d1c5399be..3b304cf5f 100644 --- a/src/addon/mod/forum/providers/discussion-link-handler.ts +++ b/src/addon/mod/forum/providers/discussion-link-handler.ts @@ -34,12 +34,12 @@ export class AddonModForumDiscussionLinkHandler extends CoreContentLinksHandlerB /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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 {any} [data] Extra data to handle the URL. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @param data Extra data to handle the URL. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number, data?: any): CoreContentLinksAction[] | Promise { @@ -67,11 +67,11 @@ export class AddonModForumDiscussionLinkHandler extends CoreContentLinksHandlerB * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return true; diff --git a/src/addon/mod/forum/providers/forum.ts b/src/addon/mod/forum/providers/forum.ts index 6a8d7aa0f..2bb8872e2 100644 --- a/src/addon/mod/forum/providers/forum.ts +++ b/src/addon/mod/forum/providers/forum.ts @@ -64,9 +64,9 @@ export class AddonModForumProvider { /** * Get cache key for can add discussion WS calls. * - * @param {number} forumId Forum ID. - * @param {number} groupId Group ID. - * @return {string} Cache key. + * @param forumId Forum ID. + * @param groupId Group ID. + * @return Cache key. */ protected getCanAddDiscussionCacheKey(forumId: number, groupId: number): string { return this.getCommonCanAddDiscussionCacheKey(forumId) + groupId; @@ -75,8 +75,8 @@ export class AddonModForumProvider { /** * Get common part of cache key for can add discussion WS calls. * - * @param {number} forumId Forum ID. - * @return {string} Cache key. + * @param forumId Forum ID. + * @return Cache key. */ protected getCommonCanAddDiscussionCacheKey(forumId: number): string { return this.ROOT_CACHE_KEY + 'canadddiscussion:' + forumId + ':'; @@ -85,8 +85,8 @@ export class AddonModForumProvider { /** * Get cache key for forum data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getForumDataCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'forum:' + courseId; @@ -95,8 +95,8 @@ export class AddonModForumProvider { /** * Get cache key for forum access information WS calls. * - * @param {number} forumId Forum ID. - * @return {string} Cache key. + * @param forumId Forum ID. + * @return Cache key. */ protected getAccessInformationCacheKey(forumId: number): string { return this.ROOT_CACHE_KEY + 'accessInformation:' + forumId; @@ -105,8 +105,8 @@ export class AddonModForumProvider { /** * Get cache key for forum discussion posts WS calls. * - * @param {number} discussionId Discussion ID. - * @return {string} Cache key. + * @param discussionId Discussion ID. + * @return Cache key. */ protected getDiscussionPostsCacheKey(discussionId: number): string { return this.ROOT_CACHE_KEY + 'discussion:' + discussionId; @@ -115,9 +115,9 @@ export class AddonModForumProvider { /** * Get cache key for forum discussions list WS calls. * - * @param {number} forumId Forum ID. - * @param {number} sortOrder Sort order. - * @return {string} Cache key. + * @param forumId Forum ID. + * @param sortOrder Sort order. + * @return Cache key. */ protected getDiscussionsListCacheKey(forumId: number, sortOrder: number): string { let key = this.ROOT_CACHE_KEY + 'discussions:' + forumId; @@ -132,13 +132,13 @@ export class AddonModForumProvider { /** * Add a new discussion. It will fail if offline or cannot connect. * - * @param {number} forumId Forum ID. - * @param {string} subject New discussion's subject. - * @param {string} message New discussion's message. - * @param {any} [options] Options (subscribe, pin, ...). - * @param {string} [groupId] Group this discussion belongs to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the discussion is created. + * @param forumId Forum ID. + * @param subject New discussion's subject. + * @param message New discussion's message. + * @param options Options (subscribe, pin, ...). + * @param groupId Group this discussion belongs to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the discussion is created. */ addNewDiscussionOnline(forumId: number, subject: string, message: string, options?: any, groupId?: number, siteId?: string) : Promise { @@ -168,13 +168,13 @@ export class AddonModForumProvider { /** * Check if a user can post to a certain group. * - * @param {number} forumId Forum ID. - * @param {number} groupId Group ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with an object with the following properties: - * - status (boolean) - * - canpindiscussions (boolean) - * - cancreateattachment (boolean) + * @param forumId Forum ID. + * @param groupId Group ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with an object with the following properties: + * - status (boolean) + * - canpindiscussions (boolean) + * - cancreateattachment (boolean) */ canAddDiscussion(forumId: number, groupId: number, siteId?: string): Promise { const params = { @@ -208,11 +208,11 @@ export class AddonModForumProvider { /** * Check if a user can post to all groups. * - * @param {number} forumId Forum ID. - * @return {Promise} Promise resolved with an object with the following properties: - * - status (boolean) - * - canpindiscussions (boolean) - * - cancreateattachment (boolean) + * @param forumId Forum ID. + * @return Promise resolved with an object with the following properties: + * - status (boolean) + * - canpindiscussions (boolean) + * - cancreateattachment (boolean) */ canAddDiscussionToAll(forumId: number): Promise { return this.canAddDiscussion(forumId, AddonModForumProvider.ALL_PARTICIPANTS); @@ -221,8 +221,8 @@ export class AddonModForumProvider { /** * Extract the starting post of a discussion from a list of posts. The post is removed from the array passed as a parameter. * - * @param {any[]} posts Posts to search. - * @return {any} Starting post or undefined if not found. + * @param posts Posts to search. + * @return Starting post or undefined if not found. */ extractStartingPost(posts: any[]): any { // Check the last post first, since they'll usually be ordered by create time. @@ -238,7 +238,7 @@ export class AddonModForumProvider { /** * There was a bug adding new discussions to All Participants (see MDL-57962). Check if it's fixed. * - * @return {boolean} True if fixed, false otherwise. + * @return True if fixed, false otherwise. */ isAllParticipantsFixed(): boolean { return this.sitesProvider.getCurrentSite().isVersionGreaterEqualThan(['3.1.5', '3.2.2']); @@ -247,9 +247,9 @@ export class AddonModForumProvider { /** * Format discussions, setting groupname if the discussion group is valid. * - * @param {number} cmId Forum cmid. - * @param {any[]} discussions List of discussions to format. - * @return {Promise} Promise resolved with the formatted discussions. + * @param cmId Forum cmid. + * @param discussions List of discussions to format. + * @return Promise resolved with the formatted discussions. */ formatDiscussionsGroups(cmId: number, discussions: any[]): Promise { discussions = this.utils.clone(discussions); @@ -288,9 +288,9 @@ export class AddonModForumProvider { /** * Get all course forums. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the forums are retrieved. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the forums are retrieved. */ getCourseForums(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -309,10 +309,10 @@ export class AddonModForumProvider { /** * Get a forum by course module ID. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the forum is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the forum is retrieved. */ getForum(courseId: number, cmId: number, siteId?: string): Promise { return this.getCourseForums(courseId, siteId).then((forums) => { @@ -328,10 +328,10 @@ export class AddonModForumProvider { /** * Get a forum by forum ID. * - * @param {number} courseId Course ID. - * @param {number} forumId Forum ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the forum is retrieved. + * @param courseId Course ID. + * @param forumId Forum ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the forum is retrieved. */ getForumById(courseId: number, forumId: number, siteId?: string): Promise { return this.getCourseForums(courseId, siteId).then((forums) => { @@ -347,10 +347,10 @@ export class AddonModForumProvider { /** * Get access information for a given forum. * - * @param {number} forumId Forum ID. - * @param {boolean} [forceCache] True to always get the value from cache. false otherwise. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Object with access information. + * @param forumId Forum ID. + * @param forceCache True to always get the value from cache. false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Object with access information. * @since 3.7 */ getAccessInformation(forumId: number, forceCache?: boolean, siteId?: string): Promise { @@ -375,9 +375,9 @@ export class AddonModForumProvider { /** * Get forum discussion posts. * - * @param {number} discussionId Discussion ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise<{posts: any[], ratinginfo?: CoreRatingInfo}>} Promise resolved with forum posts and rating info. + * @param discussionId Discussion ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with forum posts and rating info. */ getDiscussionPosts(discussionId: number, siteId?: string): Promise<{posts: any[], ratinginfo?: CoreRatingInfo}> { const params = { @@ -403,8 +403,8 @@ export class AddonModForumProvider { /** * Sort forum discussion posts by an specified field. * - * @param {any[]} posts Discussion posts to be sorted in place. - * @param {string} direction Direction of the sorting (ASC / DESC). + * @param posts Discussion posts to be sorted in place. + * @param direction Direction of the sorting (ASC / DESC). */ sortDiscussionPosts(posts: any[], direction: string): void { // @todo: Check children when sorting. @@ -422,8 +422,8 @@ export class AddonModForumProvider { /** * Return whether discussion lists can be sorted. * - * @param {CoreSite} [site] Site. If not defined, current site. - * @return {boolean} True if discussion lists can be sorted. + * @param site Site. If not defined, current site. + * @return True if discussion lists can be sorted. */ isDiscussionListSortingAvailable(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -434,7 +434,7 @@ export class AddonModForumProvider { /** * Return the list of available sort orders. * - * @return {{label: string, value: number}[]} List of sort orders. + * @return List of sort orders. */ getAvailableSortOrders(): {label: string, value: number}[] { const sortOrders = [ @@ -475,14 +475,14 @@ export class AddonModForumProvider { /** * Get forum discussions. * - * @param {number} forumId Forum ID. - * @param {number} [sortOrder] Sort order. - * @param {number} [page=0] Page. - * @param {boolean} [forceCache] True to always get the value from cache. false otherwise. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with an object with: - * - discussions: List of discussions. - * - canLoadMore: True if there may be more discussions to load. + * @param forumId Forum ID. + * @param sortOrder Sort order. + * @param page Page. + * @param forceCache True to always get the value from cache. false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with an object with: + * - discussions: List of discussions. + * - canLoadMore: True if there may be more discussions to load. */ getDiscussions(forumId: number, sortOrder?: number, page: number = 0, forceCache?: boolean, siteId?: string): Promise { sortOrder = sortOrder || AddonModForumProvider.SORTORDER_LASTPOST_DESC; @@ -555,15 +555,15 @@ export class AddonModForumProvider { * Get forum discussions in several pages. * If a page fails, the discussions until that page will be returned along with a flag indicating an error occurred. * - * @param {number} forumId Forum ID. - * @param {number} [sortOrder] Sort order. - * @param {boolean} [forceCache] True to always get the value from cache, false otherwise. - * @param {number} [numPages] Number of pages to get. If not defined, all pages. - * @param {number} [startPage] Page to start. If not defined, first page. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with an object with: - * - discussions: List of discussions. - * - error: True if an error occurred, false otherwise. + * @param forumId Forum ID. + * @param sortOrder Sort order. + * @param forceCache True to always get the value from cache, false otherwise. + * @param numPages Number of pages to get. If not defined, all pages. + * @param startPage Page to start. If not defined, first page. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with an object with: + * - discussions: List of discussions. + * - error: True if an error occurred, false otherwise. */ getDiscussionsInPages(forumId: number, sortOrder?: number, forceCache?: boolean, numPages?: number, startPage?: number, siteId?: string): Promise { @@ -606,9 +606,9 @@ export class AddonModForumProvider { /** * Invalidates can add discussion WS calls. * - * @param {number} forumId Forum ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param forumId Forum ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateCanAddDiscussion(forumId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -620,9 +620,9 @@ export class AddonModForumProvider { * Invalidate the prefetched content except files. * To invalidate files, use AddonModForum#invalidateFiles. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved when data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID. + * @return Promise resolved when data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { // Get the forum first, we need the forum ID. @@ -659,9 +659,9 @@ export class AddonModForumProvider { /** * Invalidates access information. * - * @param {number} forumId Forum ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param forumId Forum ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAccessInformation(forumId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -672,9 +672,9 @@ export class AddonModForumProvider { /** * Invalidates forum discussion posts. * - * @param {number} discussionId Discussion ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param discussionId Discussion ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateDiscussionPosts(discussionId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -685,9 +685,9 @@ export class AddonModForumProvider { /** * Invalidates discussion list. * - * @param {number} forumId Forum ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param forumId Forum ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateDiscussionsList(forumId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -700,8 +700,8 @@ export class AddonModForumProvider { /** * Invalidate the prefetched files. * - * @param {number} moduleId The module ID. - * @return {Promise} Promise resolved when the files are invalidated. + * @param moduleId The module ID. + * @return Promise resolved when the files are invalidated. */ invalidateFiles(moduleId: number): Promise { const siteId = this.sitesProvider.getCurrentSiteId(); @@ -712,8 +712,8 @@ export class AddonModForumProvider { /** * Invalidates forum data. * - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @return Promise resolved when the data is invalidated. */ invalidateForumData(courseId: number): Promise { return this.sitesProvider.getCurrentSite().invalidateWsCacheForKey(this.getForumDataCacheKey(courseId)); @@ -722,10 +722,10 @@ export class AddonModForumProvider { /** * Report a forum as being viewed. * - * @param {number} id Module ID. - * @param {string} [name] Name of the forum. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Module ID. + * @param name Name of the forum. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params = { @@ -739,11 +739,11 @@ export class AddonModForumProvider { /** * Report a forum discussion as being viewed. * - * @param {number} id Discussion ID. - * @param {number} forumId Forum ID. - * @param {string} [name] Name of the forum. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Discussion ID. + * @param forumId Forum ID. + * @param name Name of the forum. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logDiscussionView(id: number, forumId: number, name?: string, siteId?: string): Promise { const params = { @@ -757,17 +757,17 @@ export class AddonModForumProvider { /** * Reply to a certain post. * - * @param {number} postId ID of the post being replied. - * @param {number} discussionId ID of the discussion the user is replying to. - * @param {number} forumId ID of the forum the user is replying to. - * @param {string} name Forum name. - * @param {number} courseId Course ID the forum belongs to. - * @param {string} subject New post's subject. - * @param {string} message New post's message. - * @param {any} [options] Options (subscribe, attachments, ...). - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [allowOffline] True if it can be stored in offline, false otherwise. - * @return {Promise} Promise resolved with post ID if sent online, resolved with false if stored offline. + * @param postId ID of the post being replied. + * @param discussionId ID of the discussion the user is replying to. + * @param forumId ID of the forum the user is replying to. + * @param name Forum name. + * @param courseId Course ID the forum belongs to. + * @param subject New post's subject. + * @param message New post's message. + * @param options Options (subscribe, attachments, ...). + * @param siteId Site ID. If not defined, current site. + * @param allowOffline True if it can be stored in offline, false otherwise. + * @return Promise resolved with post ID if sent online, resolved with false if stored offline. */ replyPost(postId: number, discussionId: number, forumId: number, name: string, courseId: number, subject: string, message: string, options?: any, siteId?: string, allowOffline?: boolean): Promise { @@ -811,12 +811,12 @@ export class AddonModForumProvider { /** * Reply to a certain post. It will fail if offline or cannot connect. * - * @param {number} postId ID of the post being replied. - * @param {string} subject New post's subject. - * @param {string} message New post's message. - * @param {any} [options] Options (subscribe, attachments, ...). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the created post id. + * @param postId ID of the post being replied. + * @param subject New post's subject. + * @param message New post's message. + * @param options Options (subscribe, attachments, ...). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the created post id. */ replyPostOnline(postId: number, subject: string, message: string, options?: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -840,11 +840,11 @@ export class AddonModForumProvider { /** * Lock or unlock a discussion. * - * @param {number} forumId Forum id. - * @param {number} discussionId DIscussion id. - * @param {boolean} locked True to lock, false to unlock. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resvoled when done. + * @param forumId Forum id. + * @param discussionId DIscussion id. + * @param locked True to lock, false to unlock. + * @param siteId Site ID. If not defined, current site. + * @return Promise resvoled when done. * @since 3.7 */ setLockState(forumId: number, discussionId: number, locked: boolean, siteId?: string): Promise { @@ -862,8 +862,8 @@ export class AddonModForumProvider { /** * Returns whether the set pin state WS is available. * - * @param {CoreSite} [site] Site. If not defined, current site. - * @return {boolean} Whether it's available. + * @param site Site. If not defined, current site. + * @return Whether it's available. * @since 3.7 */ isSetPinStateAvailableForSite(site?: CoreSite): boolean { @@ -875,10 +875,10 @@ export class AddonModForumProvider { /** * Pin or unpin a discussion. * - * @param {number} discussionId Discussion id. - * @param {boolean} locked True to pin, false to unpin. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resvoled when done. + * @param discussionId Discussion id. + * @param locked True to pin, false to unpin. + * @param siteId Site ID. If not defined, current site. + * @return Promise resvoled when done. * @since 3.7 */ setPinState(discussionId: number, pinned: boolean, siteId?: string): Promise { @@ -895,10 +895,10 @@ export class AddonModForumProvider { /** * Star or unstar a discussion. * - * @param {number} discussionId Discussion id. - * @param {boolean} starred True to star, false to unstar. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resvoled when done. + * @param discussionId Discussion id. + * @param starred True to star, false to unstar. + * @param siteId Site ID. If not defined, current site. + * @return Promise resvoled when done. * @since 3.7 */ toggleFavouriteState(discussionId: number, starred: boolean, siteId?: string): Promise { @@ -915,7 +915,7 @@ export class AddonModForumProvider { /** * Store the users data from a discussions/posts list. * - * @param {any[]} list Array of posts or discussions. + * @param list Array of posts or discussions. */ protected storeUserData(list: any[]): void { const users = {}; diff --git a/src/addon/mod/forum/providers/helper.ts b/src/addon/mod/forum/providers/helper.ts index fb46fab35..202241d23 100644 --- a/src/addon/mod/forum/providers/helper.ts +++ b/src/addon/mod/forum/providers/helper.ts @@ -43,17 +43,17 @@ export class AddonModForumHelperProvider { /** * Add a new discussion. * - * @param {number} forumId Forum ID. - * @param {string} name Forum name. - * @param {number} courseId Course ID the forum belongs to. - * @param {string} subject New discussion's subject. - * @param {string} message New discussion's message. - * @param {any[]} [attachments] New discussion's attachments. - * @param {any} [options] Options (subscribe, pin, ...). - * @param {number[]} [groupIds] Groups this discussion belongs to. - * @param {number} [timeCreated] The time the discussion was created. Only used when editing discussion. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with ids of the created discussions or null if stored offline + * @param forumId Forum ID. + * @param name Forum name. + * @param courseId Course ID the forum belongs to. + * @param subject New discussion's subject. + * @param message New discussion's message. + * @param attachments New discussion's attachments. + * @param options Options (subscribe, pin, ...). + * @param groupIds Groups this discussion belongs to. + * @param timeCreated The time the discussion was created. Only used when editing discussion. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with ids of the created discussions or null if stored offline */ addNewDiscussion(forumId: number, name: string, courseId: number, subject: string, message: string, attachments?: any[], options?: any, groupIds?: number[], timeCreated?: number, siteId?: string): Promise { @@ -155,9 +155,9 @@ export class AddonModForumHelperProvider { /** * Convert offline reply to online format in order to be compatible with them. * - * @param {any} offlineReply Offline version of the reply. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the object converted to Online. + * @param offlineReply Offline version of the reply. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the object converted to Online. */ convertOfflineReplyToOnline(offlineReply: any, siteId?: string): Promise { const reply: any = { @@ -212,10 +212,10 @@ export class AddonModForumHelperProvider { /** * Delete stored attachment files for a new discussion. * - * @param {number} forumId Forum ID. - * @param {number} timecreated The time the discussion was created. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when deleted. + * @param forumId Forum ID. + * @param timecreated The time the discussion was created. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when deleted. */ deleteNewDiscussionStoredFiles(forumId: number, timecreated: number, siteId?: string): Promise { return this.forumOffline.getNewDiscussionFolder(forumId, timecreated, siteId).then((folderPath) => { @@ -228,11 +228,11 @@ export class AddonModForumHelperProvider { /** * Delete stored attachment files for a reply. * - * @param {number} forumId Forum ID. - * @param {number} postId ID of the post being replied. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the reply belongs to. If not defined, current user in site. - * @return {Promise} Promise resolved when deleted. + * @param forumId Forum ID. + * @param postId ID of the post being replied. + * @param siteId Site ID. If not defined, current site. + * @param userId User the reply belongs to. If not defined, current user in site. + * @return Promise resolved when deleted. */ deleteReplyStoredFiles(forumId: number, postId: number, siteId?: string, userId?: number): Promise { return this.forumOffline.getReplyFolder(forumId, postId, siteId, userId).then((folderPath) => { @@ -245,8 +245,8 @@ export class AddonModForumHelperProvider { /** * Returns the availability message of the given forum. * - * @param {any} forum Forum instance. - * @return {string} Message or null if the forum has no cut-off or due date. + * @param forum Forum instance. + * @return Message or null if the forum has no cut-off or due date. */ getAvailabilityMessage(forum: any): string { if (this.isCutoffDateReached(forum)) { @@ -269,10 +269,10 @@ export class AddonModForumHelperProvider { * * This function is inefficient because it needs to fetch all discussion pages in the worst case. * - * @param {number} forumId Forum ID. - * @param {number} discussionId Discussion ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the discussion data. + * @param forumId Forum ID. + * @param discussionId Discussion ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the discussion data. */ getDiscussionById(forumId: number, discussionId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -299,10 +299,10 @@ export class AddonModForumHelperProvider { /** * Get a list of stored attachment files for a new discussion. See AddonModForumHelper#storeNewDiscussionFiles. * - * @param {number} forumId Forum ID. - * @param {number} timecreated The time the discussion was created. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the files. + * @param forumId Forum ID. + * @param timecreated The time the discussion was created. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the files. */ getNewDiscussionStoredFiles(forumId: number, timecreated: number, siteId?: string): Promise { return this.forumOffline.getNewDiscussionFolder(forumId, timecreated, siteId).then((folderPath) => { @@ -313,11 +313,11 @@ export class AddonModForumHelperProvider { /** * Get a list of stored attachment files for a reply. See AddonModForumHelper#storeReplyFiles. * - * @param {number} forumId Forum ID. - * @param {number} postId ID of the post being replied. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the reply belongs to. If not defined, current user in site. - * @return {Promise} Promise resolved with the files. + * @param forumId Forum ID. + * @param postId ID of the post being replied. + * @param siteId Site ID. If not defined, current site. + * @param userId User the reply belongs to. If not defined, current user in site. + * @return Promise resolved with the files. */ getReplyStoredFiles(forumId: number, postId: number, siteId?: string, userId?: number): Promise { return this.forumOffline.getReplyFolder(forumId, postId, siteId, userId).then((folderPath) => { @@ -328,9 +328,9 @@ export class AddonModForumHelperProvider { /** * Check if the data of a post/discussion has changed. * - * @param {any} post Current data. - * @param {any} [original] Original ata. - * @return {boolean} True if data has changed, false otherwise. + * @param post Current data. + * @param original Original ata. + * @return True if data has changed, false otherwise. */ hasPostDataChanged(post: any, original?: any): boolean { if (!original || original.subject == null) { @@ -352,8 +352,7 @@ export class AddonModForumHelperProvider { /** * Is the cutoff date for the forum reached? * - * @param {any} forum Forum instance. - * @return {boolean} + * @param forum Forum instance. */ isCutoffDateReached(forum: any): boolean { const now = Date.now() / 1000; @@ -364,8 +363,7 @@ export class AddonModForumHelperProvider { /** * Is the due date for the forum reached? * - * @param {any} forum Forum instance. - * @return {boolean} + * @param forum Forum instance. */ isDueDateReached(forum: any): boolean { const now = Date.now() / 1000; @@ -377,11 +375,11 @@ export class AddonModForumHelperProvider { * Given a list of files (either online files or local files), store the local files in a local folder * to be submitted later. * - * @param {number} forumId Forum ID. - * @param {number} timecreated The time the discussion was created. - * @param {any[]} files List of files. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success, rejected otherwise. + * @param forumId Forum ID. + * @param timecreated The time the discussion was created. + * @param files List of files. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success, rejected otherwise. */ storeNewDiscussionFiles(forumId: number, timecreated: number, files: any[], siteId?: string): Promise { // Get the folder where to store the files. @@ -394,12 +392,12 @@ export class AddonModForumHelperProvider { * Given a list of files (either online files or local files), store the local files in a local folder * to be submitted later. * - * @param {number} forumId Forum ID. - * @param {number} postId ID of the post being replied. - * @param {any[]} files List of files. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the reply belongs to. If not defined, current user in site. - * @return {Promise} Promise resolved if success, rejected otherwise. + * @param forumId Forum ID. + * @param postId ID of the post being replied. + * @param files List of files. + * @param siteId Site ID. If not defined, current site. + * @param userId User the reply belongs to. If not defined, current user in site. + * @return Promise resolved if success, rejected otherwise. */ storeReplyFiles(forumId: number, postId: number, files: any[], siteId?: string, userId?: number): Promise { // Get the folder where to store the files. @@ -411,12 +409,12 @@ export class AddonModForumHelperProvider { /** * Upload or store some files for a new discussion, depending if the user is offline or not. * - * @param {number} forumId Forum ID. - * @param {number} timecreated The time the discussion was created. - * @param {any[]} files List of files. - * @param {boolean} offline True if files sould be stored for offline, false to upload them. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success. + * @param forumId Forum ID. + * @param timecreated The time the discussion was created. + * @param files List of files. + * @param offline True if files sould be stored for offline, false to upload them. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success. */ uploadOrStoreNewDiscussionFiles(forumId: number, timecreated: number, files: any[], offline: boolean, siteId?: string) : Promise { @@ -430,13 +428,13 @@ export class AddonModForumHelperProvider { /** * Upload or store some files for a reply, depending if the user is offline or not. * - * @param {number} forumId Forum ID. - * @param {number} postId ID of the post being replied. - * @param {any[]} files List of files. - * @param {boolean} offline True if files sould be stored for offline, false to upload them. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the reply belongs to. If not defined, current user in site. - * @return {Promise} Promise resolved if success. + * @param forumId Forum ID. + * @param postId ID of the post being replied. + * @param files List of files. + * @param offline True if files sould be stored for offline, false to upload them. + * @param siteId Site ID. If not defined, current site. + * @param userId User the reply belongs to. If not defined, current user in site. + * @return Promise resolved if success. */ uploadOrStoreReplyFiles(forumId: number, postId: number, files: any[], offline: boolean, siteId?: string, userId?: number) : Promise { diff --git a/src/addon/mod/forum/providers/index-link-handler.ts b/src/addon/mod/forum/providers/index-link-handler.ts index 2b7b23e7c..fce6e746f 100644 --- a/src/addon/mod/forum/providers/index-link-handler.ts +++ b/src/addon/mod/forum/providers/index-link-handler.ts @@ -39,11 +39,11 @@ export class AddonModForumIndexLinkHandler extends CoreContentLinksModuleIndexHa * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return true; @@ -52,11 +52,11 @@ export class AddonModForumIndexLinkHandler extends CoreContentLinksModuleIndexHa /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { diff --git a/src/addon/mod/forum/providers/module-handler.ts b/src/addon/mod/forum/providers/module-handler.ts index f87f93d03..860dea961 100644 --- a/src/addon/mod/forum/providers/module-handler.ts +++ b/src/addon/mod/forum/providers/module-handler.ts @@ -52,7 +52,7 @@ export class AddonModForumModuleHandler implements CoreCourseModuleHandler { /** * 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 { return true; @@ -61,10 +61,10 @@ export class AddonModForumModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { const data: CoreCourseModuleHandlerData = { @@ -106,9 +106,9 @@ export class AddonModForumModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModForumIndexComponent; @@ -118,7 +118,7 @@ export class AddonModForumModuleHandler implements CoreCourseModuleHandler { * Whether to display the course refresher in single activity course format. If it returns false, a refresher must be * included in the template that calls the doRefresh method of the component. Defaults to true. * - * @return {boolean} Whether the refresher should be displayed. + * @return Whether the refresher should be displayed. */ displayRefresherInSingleActivity(): boolean { return false; @@ -127,10 +127,10 @@ export class AddonModForumModuleHandler implements CoreCourseModuleHandler { /** * Triggers an update for the extra badge text. * - * @param {CoreCourseModuleHandlerData} data Course Module Handler data. - * @param {number} courseId Course ID. - * @param {number} moduleId Course module ID. - * @param {string} [siteId] Site ID. If not defined, current site. + * @param data Course Module Handler data. + * @param courseId Course ID. + * @param moduleId Course module ID. + * @param siteId Site ID. If not defined, current site. */ updateExtraBadge(data: CoreCourseModuleHandlerData, courseId: number, moduleId: number, siteId?: string): void { siteId = siteId || this.sitesProvider.getCurrentSiteId(); diff --git a/src/addon/mod/forum/providers/offline.ts b/src/addon/mod/forum/providers/offline.ts index af6a08b11..2a1f161a3 100644 --- a/src/addon/mod/forum/providers/offline.ts +++ b/src/addon/mod/forum/providers/offline.ts @@ -132,11 +132,11 @@ export class AddonModForumOfflineProvider { /** * Delete a forum offline discussion. * - * @param {number} forumId Forum ID. - * @param {number} timeCreated The time the discussion was created. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the discussion belongs to. If not defined, current user in site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param forumId Forum ID. + * @param timeCreated The time the discussion was created. + * @param siteId Site ID. If not defined, current site. + * @param userId User the discussion belongs to. If not defined, current user in site. + * @return Promise resolved if stored, rejected if failure. */ deleteNewDiscussion(forumId: number, timeCreated: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -153,11 +153,11 @@ export class AddonModForumOfflineProvider { /** * Get a forum offline discussion. * - * @param {number} forumId Forum ID. - * @param {number} timeCreated The time the discussion was created. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the discussion belongs to. If not defined, current user in site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param forumId Forum ID. + * @param timeCreated The time the discussion was created. + * @param siteId Site ID. If not defined, current site. + * @param userId User the discussion belongs to. If not defined, current user in site. + * @return Promise resolved if stored, rejected if failure. */ getNewDiscussion(forumId: number, timeCreated: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -178,8 +178,8 @@ export class AddonModForumOfflineProvider { /** * Get all offline new discussions. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with discussions. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with discussions. */ getAllNewDiscussions(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -190,10 +190,10 @@ export class AddonModForumOfflineProvider { /** * Check if there are offline new discussions to send. * - * @param {number} forumId Forum ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the discussions belong to. If not defined, current user in site. - * @return {Promise} Promise resolved with boolean: true if has offline answers, false otherwise. + * @param forumId Forum ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User the discussions belong to. If not defined, current user in site. + * @return Promise resolved with boolean: true if has offline answers, false otherwise. */ hasNewDiscussions(forumId: number, siteId?: string, userId?: number): Promise { return this.getNewDiscussions(forumId, siteId, userId).then((discussions) => { @@ -207,10 +207,10 @@ export class AddonModForumOfflineProvider { /** * Get new discussions to be synced. * - * @param {number} forumId Forum ID to get. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the discussions belong to. If not defined, current user in site. - * @return {Promise} Promise resolved with the object to be synced. + * @param forumId Forum ID to get. + * @param siteId Site ID. If not defined, current site. + * @param userId User the discussions belong to. If not defined, current user in site. + * @return Promise resolved with the object to be synced. */ getNewDiscussions(forumId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -227,17 +227,17 @@ export class AddonModForumOfflineProvider { /** * Offline version for adding a new discussion to a forum. * - * @param {number} forumId Forum ID. - * @param {string} name Forum name. - * @param {number} courseId Course ID the forum belongs to. - * @param {string} subject New discussion's subject. - * @param {string} message New discussion's message. - * @param {any} [options] Options (subscribe, pin, ...). - * @param {string} [groupId] Group this discussion belongs to. - * @param {number} [timeCreated] The time the discussion was created. If not defined, current time. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the discussion belong to. If not defined, current user in site. - * @return {Promise} Promise resolved when new discussion is successfully saved. + * @param forumId Forum ID. + * @param name Forum name. + * @param courseId Course ID the forum belongs to. + * @param subject New discussion's subject. + * @param message New discussion's message. + * @param options Options (subscribe, pin, ...). + * @param groupId Group this discussion belongs to. + * @param timeCreated The time the discussion was created. If not defined, current time. + * @param siteId Site ID. If not defined, current site. + * @param userId User the discussion belong to. If not defined, current user in site. + * @return Promise resolved when new discussion is successfully saved. */ addNewDiscussion(forumId: number, name: string, courseId: number, subject: string, message: string, options?: any, groupId?: number, timeCreated?: number, siteId?: string, userId?: number): Promise { @@ -261,10 +261,10 @@ export class AddonModForumOfflineProvider { /** * Delete forum offline replies. * - * @param {number} postId ID of the post being replied. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the reply belongs to. If not defined, current user in site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param postId ID of the post being replied. + * @param siteId Site ID. If not defined, current site. + * @param userId User the reply belongs to. If not defined, current user in site. + * @return Promise resolved if stored, rejected if failure. */ deleteReply(postId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -280,8 +280,8 @@ export class AddonModForumOfflineProvider { /** * Get all offline replies. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with replies. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with replies. */ getAllReplies(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -292,10 +292,10 @@ export class AddonModForumOfflineProvider { /** * Check if there is an offline reply for a forum to be synced. * - * @param {number} forumId ID of the forum being replied. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the replies belong to. If not defined, current user in site. - * @return {Promise} Promise resolved with boolean: true if has offline answers, false otherwise. + * @param forumId ID of the forum being replied. + * @param siteId Site ID. If not defined, current site. + * @param userId User the replies belong to. If not defined, current user in site. + * @return Promise resolved with boolean: true if has offline answers, false otherwise. */ hasForumReplies(forumId: number, siteId?: string, userId?: number): Promise { return this.getForumReplies(forumId, siteId, userId).then((replies) => { @@ -309,10 +309,10 @@ export class AddonModForumOfflineProvider { /** * Get the replies of a forum to be synced. * - * @param {number} forumId ID of the forum being replied. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the replies belong to. If not defined, current user in site. - * @return {Promise} Promise resolved with replies. + * @param forumId ID of the forum being replied. + * @param siteId Site ID. If not defined, current site. + * @param userId User the replies belong to. If not defined, current user in site. + * @return Promise resolved with replies. */ getForumReplies(forumId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -329,10 +329,10 @@ export class AddonModForumOfflineProvider { /** * Check if there is an offline reply to be synced. * - * @param {number} discussionId ID of the discussion the user is replying to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the replies belong to. If not defined, current user in site. - * @return {Promise} Promise resolved with boolean: true if has offline answers, false otherwise. + * @param discussionId ID of the discussion the user is replying to. + * @param siteId Site ID. If not defined, current site. + * @param userId User the replies belong to. If not defined, current user in site. + * @return Promise resolved with boolean: true if has offline answers, false otherwise. */ hasDiscussionReplies(discussionId: number, siteId?: string, userId?: number): Promise { return this.getDiscussionReplies(discussionId, siteId, userId).then((replies) => { @@ -346,10 +346,10 @@ export class AddonModForumOfflineProvider { /** * Get the replies of a discussion to be synced. * - * @param {number} discussionId ID of the discussion the user is replying to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the replies belong to. If not defined, current user in site. - * @return {Promise} Promise resolved with discussions. + * @param discussionId ID of the discussion the user is replying to. + * @param siteId Site ID. If not defined, current site. + * @param userId User the replies belong to. If not defined, current user in site. + * @return Promise resolved with discussions. */ getDiscussionReplies(discussionId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -366,17 +366,17 @@ export class AddonModForumOfflineProvider { /** * Offline version for replying to a certain post. * - * @param {number} postId ID of the post being replied. - * @param {number} discussionId ID of the discussion the user is replying to. - * @param {number} forumId ID of the forum the user is replying to. - * @param {string} name Forum name. - * @param {number} courseId Course ID the forum belongs to. - * @param {string} subject New post's subject. - * @param {string} message New post's message. - * @param {any} [options] Options (subscribe, attachments, ...). - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the post belong to. If not defined, current user in site. - * @return {Promise} Promise resolved when the post is created. + * @param postId ID of the post being replied. + * @param discussionId ID of the discussion the user is replying to. + * @param forumId ID of the forum the user is replying to. + * @param name Forum name. + * @param courseId Course ID the forum belongs to. + * @param subject New post's subject. + * @param message New post's message. + * @param options Options (subscribe, attachments, ...). + * @param siteId Site ID. If not defined, current site. + * @param userId User the post belong to. If not defined, current user in site. + * @return Promise resolved when the post is created. */ replyPost(postId: number, discussionId: number, forumId: number, name: string, courseId: number, subject: string, message: string, options?: any, siteId?: string, userId?: number): Promise { @@ -401,9 +401,9 @@ export class AddonModForumOfflineProvider { /** * Get the path to the folder where to store files for offline attachments in a forum. * - * @param {number} forumId Forum ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the path. + * @param forumId Forum ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the path. */ getForumFolder(forumId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -416,10 +416,10 @@ export class AddonModForumOfflineProvider { /** * Get the path to the folder where to store files for a new offline discussion. * - * @param {number} forumId Forum ID. - * @param {number} timeCreated The time the discussion was created. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the path. + * @param forumId Forum ID. + * @param timeCreated The time the discussion was created. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the path. */ getNewDiscussionFolder(forumId: number, timeCreated: number, siteId?: string): Promise { return this.getForumFolder(forumId, siteId).then((folderPath) => { @@ -430,11 +430,11 @@ export class AddonModForumOfflineProvider { /** * Get the path to the folder where to store files for a new offline reply. * - * @param {number} forumId Forum ID. - * @param {number} postId ID of the post being replied. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the replies belong to. If not defined, current user in site. - * @return {Promise} Promise resolved with the path. + * @param forumId Forum ID. + * @param postId ID of the post being replied. + * @param siteId Site ID. If not defined, current site. + * @param userId User the replies belong to. If not defined, current user in site. + * @return Promise resolved with the path. */ getReplyFolder(forumId: number, postId: number, siteId?: string, userId?: number): Promise { return this.getForumFolder(forumId, siteId).then((folderPath) => { @@ -449,8 +449,8 @@ export class AddonModForumOfflineProvider { /** * Parse "options" column of fetched records. * - * @param {any[]} records List of records. - * @return {any[]} List of records with options parsed. + * @param records List of records. + * @return List of records with options parsed. */ protected parseRecordOptions(records: any[]): any[] { records.forEach((record) => { diff --git a/src/addon/mod/forum/providers/post-link-handler.ts b/src/addon/mod/forum/providers/post-link-handler.ts index 73d691dc1..9dba78fb0 100644 --- a/src/addon/mod/forum/providers/post-link-handler.ts +++ b/src/addon/mod/forum/providers/post-link-handler.ts @@ -37,11 +37,11 @@ export class AddonModForumPostLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -72,11 +72,11 @@ export class AddonModForumPostLinkHandler extends CoreContentLinksHandlerBase { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return typeof params.forum != 'undefined'; diff --git a/src/addon/mod/forum/providers/prefetch-handler.ts b/src/addon/mod/forum/providers/prefetch-handler.ts index e698a4977..78ddd67d3 100644 --- a/src/addon/mod/forum/providers/prefetch-handler.ts +++ b/src/addon/mod/forum/providers/prefetch-handler.ts @@ -54,10 +54,10 @@ export class AddonModForumPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Get list of files. If not defined, we'll assume they're in module.contents. * - * @param {any} module Module. - * @param {Number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise} Promise resolved with the list of files. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved with the list of files. */ getFiles(module: any, courseId: number, single?: boolean): Promise { return this.forumProvider.getForum(courseId, module.id).then((forum) => { @@ -77,8 +77,8 @@ export class AddonModForumPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Given a list of forum posts, return a list with all the files (attachments and embedded files). * - * @param {any[]} posts Forum posts. - * @return {any[]} Files. + * @param posts Forum posts. + * @return Files. */ protected getPostsFiles(posts: any[]): any[] { let files = []; @@ -101,8 +101,8 @@ export class AddonModForumPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Get the posts to be prefetched. * - * @param {any} forum Forum instance. - * @return {Promise} Promise resolved with array of posts. + * @param forum Forum instance. + * @return Promise resolved with array of posts. */ protected getPostsForPrefetch(forum: any): Promise { const promises = this.forumProvider.getAvailableSortOrders().map((sortOrder) => { @@ -145,9 +145,9 @@ export class AddonModForumPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId The course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId The course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.forumProvider.invalidateContent(moduleId, courseId); @@ -157,9 +157,9 @@ export class AddonModForumPrefetchHandler extends CoreCourseActivityPrefetchHand * Invalidate WS calls needed to determine module status (usually, to check if module is downloadable). * It doesn't need to invalidate check updates. It should NOT invalidate files nor all the prefetched data. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule(module: any, courseId: number): Promise { // Invalidate forum data to recalculate unread message count badge. @@ -174,11 +174,11 @@ export class AddonModForumPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string): Promise { return this.prefetchPackage(module, courseId, single, this.prefetchForum.bind(this)); @@ -187,11 +187,11 @@ export class AddonModForumPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Prefetch a forum. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} single True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when done. + * @param module The module object returned by WS. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. + * @return Promise resolved when done. */ protected prefetchForum(module: any, courseId: number, single: boolean, siteId: string): Promise { // Get the forum data. @@ -239,10 +239,10 @@ export class AddonModForumPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Prefetch groups info for a forum. * - * @param {any} module The module object returned by WS. - * @param {number} courseI Course ID the module belongs to. - * @param {boolean} canCreateDiscussions Whether the user can create discussions in the forum. - * @return {Promise} Promise resolved when group data has been prefetched. + * @param module The module object returned by WS. + * @param courseI Course ID the module belongs to. + * @param canCreateDiscussions Whether the user can create discussions in the forum. + * @return Promise resolved when group data has been prefetched. */ protected prefetchGroupsInfo(forum: any, courseId: number, canCreateDiscussions: boolean): any { // Check group mode. @@ -299,10 +299,10 @@ export class AddonModForumPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Sync a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ sync(module: any, courseId: number, siteId?: any): Promise { const promises = []; diff --git a/src/addon/mod/forum/providers/push-click-handler.ts b/src/addon/mod/forum/providers/push-click-handler.ts index 01cff72f8..6c9bdced2 100644 --- a/src/addon/mod/forum/providers/push-click-handler.ts +++ b/src/addon/mod/forum/providers/push-click-handler.ts @@ -34,8 +34,8 @@ export class AddonModForumPushClickHandler implements CorePushNotificationsClick /** * Check if a notification click is handled by this handler. * - * @param {any} notification The notification to check. - * @return {boolean} Whether the notification click is handled by this handler + * @param notification The notification to check. + * @return Whether the notification click is handled by this handler */ handles(notification: any): boolean | Promise { return this.utils.isTrueOrOne(notification.notif) && notification.moodlecomponent == 'mod_forum' && @@ -45,8 +45,8 @@ export class AddonModForumPushClickHandler implements CorePushNotificationsClick /** * Handle the notification click. * - * @param {any} notification The notification to check. - * @return {Promise} Promise resolved when done. + * @param notification The notification to check. + * @return Promise resolved when done. */ handleClick(notification: any): Promise { const contextUrlParams = this.urlUtils.extractUrlParams(notification.contexturl), diff --git a/src/addon/mod/forum/providers/sync-cron-handler.ts b/src/addon/mod/forum/providers/sync-cron-handler.ts index 53a2406e7..65a9bc73c 100644 --- a/src/addon/mod/forum/providers/sync-cron-handler.ts +++ b/src/addon/mod/forum/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class AddonModForumSyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.forumSync.syncAllForums(siteId, force); @@ -40,7 +40,7 @@ export class AddonModForumSyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return this.forumSync.syncInterval; diff --git a/src/addon/mod/forum/providers/sync.ts b/src/addon/mod/forum/providers/sync.ts index fcfbc2743..65441da66 100644 --- a/src/addon/mod/forum/providers/sync.ts +++ b/src/addon/mod/forum/providers/sync.ts @@ -70,9 +70,9 @@ export class AddonModForumSyncProvider extends CoreSyncBaseProvider { /** * Try to synchronize all the forums in a certain site or in all sites. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncAllForums(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all forums', this.syncAllForumsFunc.bind(this), [force], siteId); @@ -81,9 +81,9 @@ export class AddonModForumSyncProvider extends CoreSyncBaseProvider { /** * Sync all forums on a site. * - * @param {string} siteId Site ID to sync. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ protected syncAllForumsFunc(siteId: string, force?: boolean): Promise { const sitePromises = []; @@ -153,10 +153,10 @@ export class AddonModForumSyncProvider extends CoreSyncBaseProvider { /** * Sync a forum only if a certain time has passed since the last time. * - * @param {number} forumId Forum ID. - * @param {number} userId User the discussion belong to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the forum is synced or if it doesn't need to be synced. + * @param forumId Forum ID. + * @param userId User the discussion belong to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the forum is synced or if it doesn't need to be synced. */ syncForumDiscussionsIfNeeded(forumId: number, userId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -173,10 +173,10 @@ export class AddonModForumSyncProvider extends CoreSyncBaseProvider { /** * Synchronize all offline discussions of a forum. * - * @param {number} forumId Forum ID to be synced. - * @param {number} [userId] User the discussions belong to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param forumId Forum ID to be synced. + * @param userId User the discussions belong to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncForumDiscussions(forumId: number, userId?: number, siteId?: string): Promise { userId = userId || this.sitesProvider.getCurrentSiteUserId(); @@ -307,11 +307,11 @@ export class AddonModForumSyncProvider extends CoreSyncBaseProvider { /** * Synchronize forum offline ratings. * - * @param {number} [cmId] Course module to be synced. If not defined, sync all forums. - * @param {number} [discussionId] Discussion id to be synced. If not defined, sync all discussions. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param cmId Course module to be synced. If not defined, sync all forums. + * @param discussionId Discussion id to be synced. If not defined, sync all discussions. + * @param force Wether to force sync not depending on last execution. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncRatings(cmId?: number, discussionId?: number, force?: boolean, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -352,10 +352,10 @@ export class AddonModForumSyncProvider extends CoreSyncBaseProvider { /** * Synchronize all offline discussion replies of a forum. * - * @param {number} forumId Forum ID to be synced. - * @param {number} [userId] User the discussions belong to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param forumId Forum ID to be synced. + * @param userId User the discussions belong to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncForumReplies(forumId: number, userId?: number, siteId?: string): Promise { // Get offline forum replies to be sent. @@ -393,10 +393,10 @@ export class AddonModForumSyncProvider extends CoreSyncBaseProvider { /** * Sync a forum discussion replies only if a certain time has passed since the last time. * - * @param {number} discussionId Discussion ID to be synced. - * @param {number} [userId] User the posts belong to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the forum discussion is synced or if it doesn't need to be synced. + * @param discussionId Discussion ID to be synced. + * @param userId User the posts belong to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the forum discussion is synced or if it doesn't need to be synced. */ syncDiscussionRepliesIfNeeded(discussionId: number, userId?: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -413,10 +413,10 @@ export class AddonModForumSyncProvider extends CoreSyncBaseProvider { /** * Synchronize all offline replies from a discussion. * - * @param {number} discussionId Discussion ID to be synced. - * @param {number} [userId] User the posts belong to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param discussionId Discussion ID to be synced. + * @param userId User the posts belong to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncDiscussionReplies(discussionId: number, userId?: number, siteId?: string): Promise { userId = userId || this.sitesProvider.getCurrentSiteUserId(); @@ -523,11 +523,11 @@ export class AddonModForumSyncProvider extends CoreSyncBaseProvider { /** * Delete a new discussion. * - * @param {number} forumId Forum ID the discussion belongs to. - * @param {number} timecreated The timecreated of the discussion. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the discussion belongs to. If not defined, current user in site. - * @return {Promise} Promise resolved when deleted. + * @param forumId Forum ID the discussion belongs to. + * @param timecreated The timecreated of the discussion. + * @param siteId Site ID. If not defined, current site. + * @param userId User the discussion belongs to. If not defined, current user in site. + * @return Promise resolved when deleted. */ protected deleteNewDiscussion(forumId: number, timecreated: number, siteId?: string, userId?: number): Promise { const promises = []; @@ -543,11 +543,11 @@ export class AddonModForumSyncProvider extends CoreSyncBaseProvider { /** * Delete a new discussion. * - * @param {number} forumId Forum ID the discussion belongs to. - * @param {number} postId ID of the post being replied. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the discussion belongs to. If not defined, current user in site. - * @return {Promise} Promise resolved when deleted. + * @param forumId Forum ID the discussion belongs to. + * @param postId ID of the post being replied. + * @param siteId Site ID. If not defined, current site. + * @param userId User the discussion belongs to. If not defined, current user in site. + * @return Promise resolved when deleted. */ protected deleteReply(forumId: number, postId: number, siteId?: string, userId?: number): Promise { const promises = []; @@ -563,12 +563,12 @@ export class AddonModForumSyncProvider extends CoreSyncBaseProvider { /** * Upload attachments of an offline post/discussion. * - * @param {number} forumId Forum ID the post belongs to. - * @param {any} post Offline post or discussion. - * @param {boolean} isDisc True if it's a new discussion, false if it's a reply. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the reply belongs to. If not defined, current user in site. - * @return {Promise} Promise resolved with draftid if uploaded, resolved with undefined if nothing to upload. + * @param forumId Forum ID the post belongs to. + * @param post Offline post or discussion. + * @param isDisc True if it's a new discussion, false if it's a reply. + * @param siteId Site ID. If not defined, current site. + * @param userId User the reply belongs to. If not defined, current user in site. + * @return Promise resolved with draftid if uploaded, resolved with undefined if nothing to upload. */ protected uploadAttachments(forumId: number, post: any, isDisc: boolean, siteId?: string, userId?: number): Promise { const attachments = post && post.options && post.options.attachmentsid; @@ -607,9 +607,9 @@ export class AddonModForumSyncProvider extends CoreSyncBaseProvider { /** * Get the ID of a forum sync. * - * @param {number} forumId Forum ID. - * @param {number} [userId] User the responses belong to.. If not defined, current user. - * @return {string} Sync ID. + * @param forumId Forum ID. + * @param userId User the responses belong to.. If not defined, current user. + * @return Sync ID. */ getForumSyncId(forumId: number, userId?: number): string { userId = userId || this.sitesProvider.getCurrentSiteUserId(); @@ -620,9 +620,9 @@ export class AddonModForumSyncProvider extends CoreSyncBaseProvider { /** * Get the ID of a discussion sync. * - * @param {number} discussionId Discussion ID. - * @param {number} [userId] User the responses belong to.. If not defined, current user. - * @return {string} Sync ID. + * @param discussionId Discussion ID. + * @param userId User the responses belong to.. If not defined, current user. + * @return Sync ID. */ getDiscussionSyncId(discussionId: number, userId?: number): string { userId = userId || this.sitesProvider.getCurrentSiteUserId(); diff --git a/src/addon/mod/forum/providers/tag-area-handler.ts b/src/addon/mod/forum/providers/tag-area-handler.ts index 02505b31c..528cc8236 100644 --- a/src/addon/mod/forum/providers/tag-area-handler.ts +++ b/src/addon/mod/forum/providers/tag-area-handler.ts @@ -29,7 +29,7 @@ export class AddonModForumTagAreaHandler implements CoreTagAreaHandler { /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return true; @@ -38,8 +38,8 @@ export class AddonModForumTagAreaHandler implements CoreTagAreaHandler { /** * Parses the rendered content of a tag index and returns the items. * - * @param {string} content Rendered content. - * @return {any[]|Promise} Area items (or promise resolved with the items). + * @param content Rendered content. + * @return Area items (or promise resolved with the items). */ parseContent(content: string): any[] | Promise { return this.tagHelper.parseFeedContent(content); @@ -48,8 +48,8 @@ export class AddonModForumTagAreaHandler implements CoreTagAreaHandler { /** * Get the component to use to display items. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return CoreTagFeedComponent; diff --git a/src/addon/mod/glossary/components/index/index.ts b/src/addon/mod/glossary/components/index/index.ts index ed3d807e9..7572f19b6 100644 --- a/src/addon/mod/glossary/components/index/index.ts +++ b/src/addon/mod/glossary/components/index/index.ts @@ -120,10 +120,10 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity /** * Download the component contents. * - * @param {boolean} [refresh=false] Whether we're refreshing data. - * @param {boolean} [sync=false] If the refresh needs syncing. - * @param {boolean} [showErrors=false] Wether to show errors to the user or hide them. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @param sync If the refresh needs syncing. + * @param showErrors Wether to show errors to the user or hide them. + * @return Promise resolved when done. */ protected fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { return this.glossaryProvider.getGlossary(this.courseId, this.module.id).then((glossary) => { @@ -167,8 +167,8 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity /** * Convenience function to fetch entries. * - * @param {boolean} [append=false] True if fetched entries are appended to exsiting ones. - * @return {Promise} Promise resolved when done. + * @param append True if fetched entries are appended to exsiting ones. + * @return Promise resolved when done. */ protected fetchEntries(append: boolean = false): Promise { this.loadMoreError = false; @@ -196,7 +196,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -217,7 +217,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity /** * Performs the sync of the activity. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected sync(): Promise { return this.prefetchHandler.sync(this.module, this.courseId); @@ -226,8 +226,8 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity /** * Checks if sync has succeed from result sync data. * - * @param {any} result Data returned on the sync function. - * @return {boolean} Whether it succeed or not. + * @param result Data returned on the sync function. + * @return Whether it succeed or not. */ protected hasSyncSucceed(result: any): boolean { return result.updated; @@ -236,8 +236,8 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity /** * Compares sync event data with current data to check if refresh content is needed. * - * @param {any} syncEventData Data receiven on sync observer. - * @return {boolean} True if refresh is needed, false otherwise. + * @param syncEventData Data receiven on sync observer. + * @return True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: any): boolean { return this.glossary && syncEventData.glossaryId == this.glossary.id && @@ -247,7 +247,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity /** * Change fetch mode. * - * @param {FetchMode} mode New mode. + * @param mode New mode. */ protected switchMode(mode: FetchMode): void { this.fetchMode = mode; @@ -321,8 +321,8 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity /** * Convenience function to load more forum discussions. * - * @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. - * @return {Promise} Promise resolved when done. + * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. + * @return Promise resolved when done. */ loadMoreEntries(infiniteComplete?: any): Promise { return this.fetchEntries(true).catch((error) => { @@ -336,7 +336,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity /** * Show the mode picker menu. * - * @param {MouseEvent} event Event. + * @param event Event. */ openModePicker(event: MouseEvent): void { const popover = this.popoverCtrl.create(AddonModGlossaryModePickerPopoverComponent, { @@ -371,7 +371,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity /** * Opens an entry. * - * @param {number} entryId Entry id. + * @param entryId Entry id. */ openEntry(entryId: number): void { const params = { @@ -385,7 +385,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity /** * Opens new entry editor. * - * @param {any} [entry] Offline entry to edit. + * @param entry Offline entry to edit. */ openNewEntry(entry?: any): void { const params = { @@ -401,7 +401,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity /** * Search entries. * - * @param {string} query Text entered on the search box. + * @param query Text entered on the search box. */ search(query: string): void { this.loadingMessage = this.translate.instant('core.searching'); @@ -413,7 +413,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity /** * Function called when we receive an event of new entry. * - * @param {any} data Event data. + * @param data Event data. */ protected eventReceived(data: any): void { if (this.glossary && this.glossary.id === data.glossaryId) { diff --git a/src/addon/mod/glossary/components/mode-picker/mode-picker.ts b/src/addon/mod/glossary/components/mode-picker/mode-picker.ts index 1881670c4..d8a22f237 100644 --- a/src/addon/mod/glossary/components/mode-picker/mode-picker.ts +++ b/src/addon/mod/glossary/components/mode-picker/mode-picker.ts @@ -57,9 +57,9 @@ export class AddonModGlossaryModePickerPopoverComponent { /** * Function called when a mode is clicked. * - * @param {Event} event Click event. - * @param {string} key Clicked mode key. - * @return {boolean} Return true if success, false if error. + * @param event Click event. + * @param key Clicked mode key. + * @return Return true if success, false if error. */ modePicked(event: Event, key: string): boolean { this.viewCtrl.dismiss(key); diff --git a/src/addon/mod/glossary/pages/edit/edit.ts b/src/addon/mod/glossary/pages/edit/edit.ts index 837b0e760..d61f40e96 100644 --- a/src/addon/mod/glossary/pages/edit/edit.ts +++ b/src/addon/mod/glossary/pages/edit/edit.ts @@ -129,7 +129,7 @@ export class AddonModGlossaryEditPage implements OnInit { /** * Definition changed. * - * @param {string} text The new text. + * @param text The new text. */ onDefinitionChange(text: string): void { this.entry.definition = text; @@ -138,7 +138,7 @@ export class AddonModGlossaryEditPage implements OnInit { /** * Check if we can leave the page or not. * - * @return {boolean|Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { let promise: any; diff --git a/src/addon/mod/glossary/pages/entry/entry.ts b/src/addon/mod/glossary/pages/entry/entry.ts index a5b38641d..238185d53 100644 --- a/src/addon/mod/glossary/pages/entry/entry.ts +++ b/src/addon/mod/glossary/pages/entry/entry.ts @@ -66,8 +66,8 @@ export class AddonModGlossaryEntryPage { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @return Promise resolved when done. */ doRefresh(refresher?: any): Promise { return this.glossaryProvider.invalidateEntry(this.entry.id).catch(() => { @@ -82,8 +82,8 @@ export class AddonModGlossaryEntryPage { /** * Convenience function to get the glossary entry. * - * @param {boolean} [refresh] Whether we're refreshing data. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @return Promise resolved when done. */ protected fetchEntry(refresh?: boolean): Promise { return this.glossaryProvider.getEntry(this.entryId).then((result) => { diff --git a/src/addon/mod/glossary/pages/index/index.ts b/src/addon/mod/glossary/pages/index/index.ts index a812235fe..f653663ba 100644 --- a/src/addon/mod/glossary/pages/index/index.ts +++ b/src/addon/mod/glossary/pages/index/index.ts @@ -40,7 +40,7 @@ export class AddonModGlossaryIndexPage { /** * Update some data based on the glossary instance. * - * @param {any} glossary Glossary instance. + * @param glossary Glossary instance. */ updateData(glossary: any): void { this.title = glossary.name || this.title; diff --git a/src/addon/mod/glossary/providers/edit-link-handler.ts b/src/addon/mod/glossary/providers/edit-link-handler.ts index c86557aee..78da8a40d 100644 --- a/src/addon/mod/glossary/providers/edit-link-handler.ts +++ b/src/addon/mod/glossary/providers/edit-link-handler.ts @@ -39,11 +39,11 @@ export class AddonModGlossaryEditLinkHandler extends CoreContentLinksHandlerBase /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -76,11 +76,11 @@ export class AddonModGlossaryEditLinkHandler extends CoreContentLinksHandlerBase * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return typeof params.cmid != 'undefined'; diff --git a/src/addon/mod/glossary/providers/entry-link-handler.ts b/src/addon/mod/glossary/providers/entry-link-handler.ts index 99acce7b7..9ae7f72b4 100644 --- a/src/addon/mod/glossary/providers/entry-link-handler.ts +++ b/src/addon/mod/glossary/providers/entry-link-handler.ts @@ -40,11 +40,11 @@ export class AddonModGlossaryEntryLinkHandler extends CoreContentLinksHandlerBas /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { diff --git a/src/addon/mod/glossary/providers/glossary.ts b/src/addon/mod/glossary/providers/glossary.ts index cd494187f..b31e09900 100644 --- a/src/addon/mod/glossary/providers/glossary.ts +++ b/src/addon/mod/glossary/providers/glossary.ts @@ -81,8 +81,8 @@ export class AddonModGlossaryProvider { /** * Get the course glossary cache key. * - * @param {number} courseId Course Id. - * @return {string} Cache key. + * @param courseId Course Id. + * @return Cache key. */ protected getCourseGlossariesCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'courseGlossaries:' + courseId; @@ -91,9 +91,9 @@ export class AddonModGlossaryProvider { /** * Get all the glossaries in a course. * - * @param {number} courseId Course Id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved with the glossaries. + * @param courseId Course Id. + * @param siteId Site ID. If not defined, current site. + * @return Resolved with the glossaries. */ getCourseGlossaries(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -114,9 +114,9 @@ export class AddonModGlossaryProvider { /** * Invalidate all glossaries in a course. * - * @param {number} courseId Course Id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when data is invalidated. + * @param courseId Course Id. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when data is invalidated. */ invalidateCourseGlossaries(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -129,11 +129,11 @@ export class AddonModGlossaryProvider { /** * Get the entries by author cache key. * - * @param {number} glossaryId Glossary Id. - * @param {string} letter First letter of firstname or lastname, or either keywords: ALL or SPECIAL. - * @param {string} field Search and order using: FIRSTNAME or LASTNAME - * @param {string} sort The direction of the order: ASC or DESC - * @return {string} Cache key. + * @param glossaryId Glossary Id. + * @param letter First letter of firstname or lastname, or either keywords: ALL or SPECIAL. + * @param field Search and order using: FIRSTNAME or LASTNAME + * @param sort The direction of the order: ASC or DESC + * @return Cache key. */ protected getEntriesByAuthorCacheKey(glossaryId: number, letter: string, field: string, sort: string): string { return this.ROOT_CACHE_KEY + 'entriesByAuthor:' + glossaryId + ':' + letter + ':' + field + ':' + sort; @@ -142,16 +142,16 @@ export class AddonModGlossaryProvider { /** * Get entries by author. * - * @param {number} glossaryId Glossary Id. - * @param {string} letter First letter of firstname or lastname, or either keywords: ALL or SPECIAL. - * @param {string} field Search and order using: FIRSTNAME or LASTNAME - * @param {string} sort The direction of the order: ASC or DESC - * @param {number} from Start returning records from here. - * @param {number} limit Number of records to return. - * @param {boolean} omitExpires True to always get the value from cache. If data isn't cached, it will call the WS. - * @param {boolean} forceOffline True to always get the value from cache. If data isn't cached, it won't call the WS. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved with the entries. + * @param glossaryId Glossary Id. + * @param letter First letter of firstname or lastname, or either keywords: ALL or SPECIAL. + * @param field Search and order using: FIRSTNAME or LASTNAME + * @param sort The direction of the order: ASC or DESC + * @param from Start returning records from here. + * @param limit Number of records to return. + * @param omitExpires True to always get the value from cache. If data isn't cached, it will call the WS. + * @param forceOffline True to always get the value from cache. If data isn't cached, it won't call the WS. + * @param siteId Site ID. If not defined, current site. + * @return Resolved with the entries. */ getEntriesByAuthor(glossaryId: number, letter: string, field: string, sort: string, from: number, limit: number, omitExpires: boolean, forceOffline: boolean, siteId?: string): Promise { @@ -178,12 +178,12 @@ export class AddonModGlossaryProvider { /** * Invalidate cache of entries by author. * - * @param {number} glossaryId Glossary Id. - * @param {string} letter First letter of firstname or lastname, or either keywords: ALL or SPECIAL. - * @param {string} field Search and order using: FIRSTNAME or LASTNAME - * @param {string} sort The direction of the order: ASC or DESC - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when data is invalidated. + * @param glossaryId Glossary Id. + * @param letter First letter of firstname or lastname, or either keywords: ALL or SPECIAL. + * @param field Search and order using: FIRSTNAME or LASTNAME + * @param sort The direction of the order: ASC or DESC + * @param siteId Site ID. If not defined, current site. + * @return Resolved when data is invalidated. */ invalidateEntriesByAuthor(glossaryId: number, letter: string, field: string, sort: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -196,15 +196,15 @@ export class AddonModGlossaryProvider { /** * Get entries by category. * - * @param {number} glossaryId Glossary Id. - * @param {string} categoryId The category ID. Use constant SHOW_ALL_CATEGORIES for all categories, or - * constant SHOW_NOT_CATEGORISED for uncategorised entries. - * @param {number} from Start returning records from here. - * @param {number} limit Number of records to return. - * @param {boolean} omitExpires True to always get the value from cache. If data isn't cached, it will call the WS. - * @param {boolean} forceOffline True to always get the value from cache. If data isn't cached, it won't call the WS. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved with the entries. + * @param glossaryId Glossary Id. + * @param categoryId The category ID. Use constant SHOW_ALL_CATEGORIES for all categories, or + * constant SHOW_NOT_CATEGORISED for uncategorised entries. + * @param from Start returning records from here. + * @param limit Number of records to return. + * @param omitExpires True to always get the value from cache. If data isn't cached, it will call the WS. + * @param forceOffline True to always get the value from cache. If data isn't cached, it won't call the WS. + * @param siteId Site ID. If not defined, current site. + * @return Resolved with the entries. */ getEntriesByCategory(glossaryId: number, categoryId: number, from: number, limit: number, omitExpires: boolean, forceOffline: boolean, siteId?: string): Promise { @@ -230,11 +230,11 @@ export class AddonModGlossaryProvider { /** * Invalidate cache of entries by category. * - * @param {number} glossaryId Glossary Id. - * @param {string} categoryId The category ID. Use constant SHOW_ALL_CATEGORIES for all categories, or - * constant SHOW_NOT_CATEGORISED for uncategorised entries. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when data is invalidated. + * @param glossaryId Glossary Id. + * @param categoryId The category ID. Use constant SHOW_ALL_CATEGORIES for all categories, or + * constant SHOW_NOT_CATEGORISED for uncategorised entries. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when data is invalidated. */ invalidateEntriesByCategory(glossaryId: number, categoryId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -247,10 +247,10 @@ export class AddonModGlossaryProvider { /** * Get the entries by category cache key. * - * @param {number} glossaryId Glossary Id. - * @param {string} categoryId The category ID. Use constant SHOW_ALL_CATEGORIES for all categories, or - * constant SHOW_NOT_CATEGORISED for uncategorised entries. - * @return {string} Cache key. + * @param glossaryId Glossary Id. + * @param categoryId The category ID. Use constant SHOW_ALL_CATEGORIES for all categories, or + * constant SHOW_NOT_CATEGORISED for uncategorised entries. + * @return Cache key. */ getEntriesByCategoryCacheKey(glossaryId: number, categoryId: number): string { return this.ROOT_CACHE_KEY + 'entriesByCategory:' + glossaryId + ':' + categoryId; @@ -259,10 +259,10 @@ export class AddonModGlossaryProvider { /** * Get the entries by date cache key. * - * @param {number} glossaryId Glossary Id. - * @param {string} order The way to order the records. - * @param {string} sort The direction of the order. - * @return {string} Cache key. + * @param glossaryId Glossary Id. + * @param order The way to order the records. + * @param sort The direction of the order. + * @return Cache key. */ getEntriesByDateCacheKey(glossaryId: number, order: string, sort: string): string { return this.ROOT_CACHE_KEY + 'entriesByDate:' + glossaryId + ':' + order + ':' + sort; @@ -271,15 +271,15 @@ export class AddonModGlossaryProvider { /** * Get entries by date. * - * @param {number} glossaryId Glossary Id. - * @param {string} order The way to order the records. - * @param {string} sort The direction of the order. - * @param {number} from Start returning records from here. - * @param {number} limit Number of records to return. - * @param {boolean} omitExpires True to always get the value from cache. If data isn't cached, it will call the WS. - * @param {boolean} forceOffline True to always get the value from cache. If data isn't cached, it won't call the WS. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved with the entries. + * @param glossaryId Glossary Id. + * @param order The way to order the records. + * @param sort The direction of the order. + * @param from Start returning records from here. + * @param limit Number of records to return. + * @param omitExpires True to always get the value from cache. If data isn't cached, it will call the WS. + * @param forceOffline True to always get the value from cache. If data isn't cached, it won't call the WS. + * @param siteId Site ID. If not defined, current site. + * @return Resolved with the entries. */ getEntriesByDate(glossaryId: number, order: string, sort: string, from: number, limit: number, omitExpires: boolean, forceOffline: boolean, siteId?: string): Promise { @@ -306,11 +306,11 @@ export class AddonModGlossaryProvider { /** * Invalidate cache of entries by date. * - * @param {number} glossaryId Glossary Id. - * @param {string} order The way to order the records. - * @param {string} sort The direction of the order. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when data is invalidated. + * @param glossaryId Glossary Id. + * @param order The way to order the records. + * @param sort The direction of the order. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when data is invalidated. */ invalidateEntriesByDate(glossaryId: number, order: string, sort: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -323,9 +323,9 @@ export class AddonModGlossaryProvider { /** * Get the entries by letter cache key. * - * @param {number} glossaryId Glossary Id. - * @param {string} letter A letter, or a special keyword. - * @return {string} Cache key. + * @param glossaryId Glossary Id. + * @param letter A letter, or a special keyword. + * @return Cache key. */ protected getEntriesByLetterCacheKey(glossaryId: number, letter: string): string { return this.ROOT_CACHE_KEY + 'entriesByLetter:' + glossaryId + ':' + letter; @@ -334,14 +334,14 @@ export class AddonModGlossaryProvider { /** * Get entries by letter. * - * @param {number} glossaryId Glossary Id. - * @param {string} letter A letter, or a special keyword. - * @param {number} from Start returning records from here. - * @param {number} limit Number of records to return. - * @param {boolean} omitExpires True to always get the value from cache. If data isn't cached, it will call the WS. - * @param {boolean} forceOffline True to always get the value from cache. If data isn't cached, it won't call the WS. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved with the entries. + * @param glossaryId Glossary Id. + * @param letter A letter, or a special keyword. + * @param from Start returning records from here. + * @param limit Number of records to return. + * @param omitExpires True to always get the value from cache. If data isn't cached, it will call the WS. + * @param forceOffline True to always get the value from cache. If data isn't cached, it won't call the WS. + * @param siteId Site ID. If not defined, current site. + * @return Resolved with the entries. */ getEntriesByLetter(glossaryId: number, letter: string, from: number, limit: number, omitExpires: boolean, forceOffline: boolean, siteId?: string): Promise { @@ -377,10 +377,10 @@ export class AddonModGlossaryProvider { /** * Invalidate cache of entries by letter. * - * @param {number} glossaryId Glossary Id. - * @param {string} letter A letter, or a special keyword. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when data is invalidated. + * @param glossaryId Glossary Id. + * @param letter A letter, or a special keyword. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when data is invalidated. */ invalidateEntriesByLetter(glossaryId: number, letter: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -393,12 +393,12 @@ export class AddonModGlossaryProvider { /** * Get the entries by search cache key. * - * @param {number} glossaryId Glossary Id. - * @param {string} query The search query. - * @param {boolean} fullSearch Whether or not full search is required. - * @param {string} order The way to order the results. - * @param {string} sort The direction of the order. - * @return {string} Cache key. + * @param glossaryId Glossary Id. + * @param query The search query. + * @param fullSearch Whether or not full search is required. + * @param order The way to order the results. + * @param sort The direction of the order. + * @return Cache key. */ protected getEntriesBySearchCacheKey(glossaryId: number, query: string, fullSearch: boolean, order: string, sort: string): string { @@ -408,17 +408,17 @@ export class AddonModGlossaryProvider { /** * Get entries by search. * - * @param {number} glossaryId Glossary Id. - * @param {string} query The search query. - * @param {boolean} fullSearch Whether or not full search is required. - * @param {string} order The way to order the results. - * @param {string} sort The direction of the order. - * @param {number} from Start returning records from here. - * @param {number} limit Number of records to return. - * @param {boolean} omitExpires True to always get the value from cache. If data isn't cached, it will call the WS. - * @param {boolean} forceOffline True to always get the value from cache. If data isn't cached, it won't call the WS. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved with the entries. + * @param glossaryId Glossary Id. + * @param query The search query. + * @param fullSearch Whether or not full search is required. + * @param order The way to order the results. + * @param sort The direction of the order. + * @param from Start returning records from here. + * @param limit Number of records to return. + * @param omitExpires True to always get the value from cache. If data isn't cached, it will call the WS. + * @param forceOffline True to always get the value from cache. If data isn't cached, it won't call the WS. + * @param siteId Site ID. If not defined, current site. + * @return Resolved with the entries. */ getEntriesBySearch(glossaryId: number, query: string, fullSearch: boolean, order: string, sort: string, from: number, limit: number, omitExpires: boolean, forceOffline: boolean, siteId?: string): Promise { @@ -446,13 +446,13 @@ export class AddonModGlossaryProvider { /** * Invalidate cache of entries by search. * - * @param {number} glossaryId Glossary Id. - * @param {string} query The search query. - * @param {boolean} fullSearch Whether or not full search is required. - * @param {string} order The way to order the results. - * @param {string} sort The direction of the order. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when data is invalidated. + * @param glossaryId Glossary Id. + * @param query The search query. + * @param fullSearch Whether or not full search is required. + * @param order The way to order the results. + * @param sort The direction of the order. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when data is invalidated. */ invalidateEntriesBySearch(glossaryId: number, query: string, fullSearch: boolean, order: string, sort: string, siteId?: string): Promise { @@ -466,8 +466,8 @@ export class AddonModGlossaryProvider { /** * Get the glossary categories cache key. * - * @param {number} glossaryId Glossary Id. - * @return {string} The cache key. + * @param glossaryId Glossary Id. + * @return The cache key. */ protected getCategoriesCacheKey(glossaryId: number): string { return this.ROOT_CACHE_KEY + 'categories:' + glossaryId; @@ -476,9 +476,9 @@ export class AddonModGlossaryProvider { /** * Get all the categories related to the glossary. * - * @param {number} glossaryId Glossary Id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the categories if supported or empty array if not. + * @param glossaryId Glossary Id. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the categories if supported or empty array if not. */ getAllCategories(glossaryId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -489,12 +489,12 @@ export class AddonModGlossaryProvider { /** * Get the categories related to the glossary by sections. It's a recursive function see initial call values. * - * @param {number} glossaryId Glossary Id. - * @param {number} from Number of categories already fetched, so fetch will be done from this number. Initial value 0. - * @param {number} limit Number of categories to fetch. Initial value LIMIT_CATEGORIES. - * @param {any[]} categories Already fetched categories where to append the fetch. Initial value []. - * @param {any} site Site object. - * @return {Promise} Promise resolved with the categories. + * @param glossaryId Glossary Id. + * @param from Number of categories already fetched, so fetch will be done from this number. Initial value 0. + * @param limit Number of categories to fetch. Initial value LIMIT_CATEGORIES. + * @param categories Already fetched categories where to append the fetch. Initial value []. + * @param site Site object. + * @return Promise resolved with the categories. */ protected getCategories(glossaryId: number, from: number, limit: number, categories: any[], site: CoreSite): Promise { const params = { @@ -523,9 +523,9 @@ export class AddonModGlossaryProvider { /** * Invalidate cache of categories by glossary id. * - * @param {number} glossaryId Glossary Id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when categories data has been invalidated, + * @param glossaryId Glossary Id. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when categories data has been invalidated, */ invalidateCategories(glossaryId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -536,8 +536,8 @@ export class AddonModGlossaryProvider { /** * Get an entry by ID cache key. * - * @param {number} entryId Entry Id. - * @return {string} Cache key. + * @param entryId Entry Id. + * @return Cache key. */ protected getEntryCacheKey(entryId: number): string { return this.ROOT_CACHE_KEY + 'getEntry:' + entryId; @@ -546,9 +546,9 @@ export class AddonModGlossaryProvider { /** * Get one entry by ID. * - * @param {number} entryId Entry ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the entry. + * @param entryId Entry ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the entry. */ getEntry(entryId: number, siteId?: string): Promise<{entry: any, ratinginfo: CoreRatingInfo, from?: number}> { return this.sitesProvider.getSite(siteId).then((site) => { @@ -619,9 +619,9 @@ export class AddonModGlossaryProvider { /** * Get a glossary ID and the "from" of a given entry. * - * @param {number} entryId Entry ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the glossary ID and the "from". + * @param entryId Entry ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the glossary ID and the "from". */ getStoredDataForEntry(entryId: number, siteId?: string): Promise<{glossaryId: number, from: number}> { return this.sitesProvider.getSite(siteId).then((site) => { @@ -641,14 +641,14 @@ export class AddonModGlossaryProvider { /** * Performs the fetch of the entries using the propper function and arguments. * - * @param {Function} fetchFunction Function to fetch. - * @param {any[]} fetchArguments Arguments to call the fetching. - * @param {number} [limitFrom=0] Number of entries already fetched, so fetch will be done from this number. - * @param {number} [limitNum] Number of records to return. Defaults to LIMIT_ENTRIES. - * @param {boolean} [omitExpires=false] True to always get the value from cache. If data isn't cached, it will call the WS. - * @param {boolean} [forceOffline=false] True to always get the value from cache. If data isn't cached, it won't call the WS. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the response. + * @param fetchFunction Function to fetch. + * @param fetchArguments Arguments to call the fetching. + * @param limitFrom Number of entries already fetched, so fetch will be done from this number. + * @param limitNum Number of records to return. Defaults to LIMIT_ENTRIES. + * @param omitExpires True to always get the value from cache. If data isn't cached, it will call the WS. + * @param forceOffline True to always get the value from cache. If data isn't cached, it won't call the WS. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the response. */ fetchEntries(fetchFunction: Function, fetchArguments: any[], limitFrom: number = 0, limitNum?: number, omitExpires: boolean = false, forceOffline: boolean = false, siteId?: string): Promise { @@ -668,12 +668,12 @@ export class AddonModGlossaryProvider { /** * Performs the whole fetch of the entries using the propper function and arguments. * - * @param {Function} fetchFunction Function to fetch. - * @param {any[]} fetchArguments Arguments to call the fetching. - * @param {boolean} [omitExpires=false] True to always get the value from cache. If data isn't cached, it will call the WS. - * @param {boolean} [forceOffline=false] True to always get the value from cache. If data isn't cached, it won't call the WS. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with all entrries. + * @param fetchFunction Function to fetch. + * @param fetchArguments Arguments to call the fetching. + * @param omitExpires True to always get the value from cache. If data isn't cached, it will call the WS. + * @param forceOffline True to always get the value from cache. If data isn't cached, it won't call the WS. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with all entrries. */ fetchAllEntries(fetchFunction: Function, fetchArguments: any[], omitExpires: boolean = false, forceOffline: boolean = false, siteId?: string): Promise { @@ -697,9 +697,9 @@ export class AddonModGlossaryProvider { /** * Invalidate cache of entry by ID. * - * @param {number} entryId Entry Id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when data is invalidated. + * @param entryId Entry Id. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when data is invalidated. */ invalidateEntry(entryId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -710,9 +710,9 @@ export class AddonModGlossaryProvider { /** * Invalidate cache of all entries in the array. * - * @param {any[]} entries Entry objects to invalidate. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved when data is invalidated. + * @param entries Entry objects to invalidate. + * @param siteId Site ID. If not defined, current site. + * @return Resolved when data is invalidated. */ protected invalidateEntries(entries: any[], siteId?: string): Promise { const keys = []; @@ -729,9 +729,9 @@ export class AddonModGlossaryProvider { * Invalidate the prefetched content except files. * To invalidate files, use AddonModGlossary#invalidateFiles. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved when data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID. + * @return Promise resolved when data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.getGlossary(courseId, moduleId).then((glossary) => { @@ -748,10 +748,10 @@ export class AddonModGlossaryProvider { * Invalidate the prefetched content for a given glossary, except files. * To invalidate files, use AddonModGlossaryProvider#invalidateFiles. * - * @param {any} glossary The glossary object. - * @param {boolean} [onlyEntriesList] If true, entries won't be invalidated. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when data is invalidated. + * @param glossary The glossary object. + * @param onlyEntriesList If true, entries won't be invalidated. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when data is invalidated. */ invalidateGlossaryEntries(glossary: any, onlyEntriesList?: boolean, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -791,9 +791,9 @@ export class AddonModGlossaryProvider { /** * Invalidate the prefetched files. * - * @param {number} moduleId The module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the files are invalidated. + * @param moduleId The module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the files are invalidated. */ protected invalidateFiles(moduleId: number, siteId?: string): Promise { return this.filepoolProvider.invalidateFilesByComponent(siteId, AddonModGlossaryProvider.COMPONENT, moduleId); @@ -802,10 +802,10 @@ export class AddonModGlossaryProvider { /** * Get one glossary by cmid. * - * @param {number} courseId Course Id. - * @param {number} cmId Course Module Id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the glossary. + * @param courseId Course Id. + * @param cmId Course Module Id. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the glossary. */ getGlossary(courseId: number, cmId: number, siteId?: string): Promise { return this.getCourseGlossaries(courseId, siteId).then((glossaries) => { @@ -822,10 +822,10 @@ export class AddonModGlossaryProvider { /** * Get one glossary by glossary ID. * - * @param {number} courseId Course Id. - * @param {number} glossaryId Glossary Id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the glossary. + * @param courseId Course Id. + * @param glossaryId Glossary Id. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the glossary. */ getGlossaryById(courseId: number, glossaryId: number, siteId?: string): Promise { return this.getCourseGlossaries(courseId, siteId).then((glossaries) => { @@ -842,19 +842,19 @@ export class AddonModGlossaryProvider { /** * Create a new entry on a glossary * - * @param {number} glossaryId Glossary ID. - * @param {string} concept Glossary entry concept. - * @param {string} definition Glossary entry concept definition. - * @param {number} courseId Course ID of the glossary. - * @param {any} [options] Array of options for the entry. - * @param {any} [attach] Attachments ID if sending online, result of CoreFileUploaderProvider#storeFilesToUpload - * otherwise. - * @param {number} [timeCreated] The time the entry was created. If not defined, current time. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {any} [discardEntry] The entry provided will be discarded if found. - * @param {boolean} [allowOffline] True if it can be stored in offline, false otherwise. - * @param {boolean} [checkDuplicates] Check for duplicates before storing offline. Only used if allowOffline is true. - * @return {Promise} Promise resolved with entry ID if entry was created in server, false if stored in device. + * @param glossaryId Glossary ID. + * @param concept Glossary entry concept. + * @param definition Glossary entry concept definition. + * @param courseId Course ID of the glossary. + * @param options Array of options for the entry. + * @param attach Attachments ID if sending online, result of CoreFileUploaderProvider#storeFilesToUpload + * otherwise. + * @param timeCreated The time the entry was created. If not defined, current time. + * @param siteId Site ID. If not defined, current site. + * @param discardEntry The entry provided will be discarded if found. + * @param allowOffline True if it can be stored in offline, false otherwise. + * @param checkDuplicates Check for duplicates before storing offline. Only used if allowOffline is true. + * @return Promise resolved with entry ID if entry was created in server, false if stored in device. */ addEntry(glossaryId: number, concept: string, definition: string, courseId: number, options: any, attach: any, timeCreated: number, siteId?: string, discardEntry?: any, allowOffline?: boolean, checkDuplicates?: boolean): @@ -918,13 +918,13 @@ export class AddonModGlossaryProvider { /** * Create a new entry on a glossary. It does not cache calls. It will fail if offline or cannot connect. * - * @param {number} glossaryId Glossary ID. - * @param {string} concept Glossary entry concept. - * @param {string} definition Glossary entry concept definition. - * @param {any} [options] Array of options for the entry. - * @param {number} [attachId] Attachments ID (if any attachment). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the entry ID if created, rejected otherwise. + * @param glossaryId Glossary ID. + * @param concept Glossary entry concept. + * @param definition Glossary entry concept definition. + * @param options Array of options for the entry. + * @param attachId Attachments ID (if any attachment). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the entry ID if created, rejected otherwise. */ addEntryOnline(glossaryId: number, concept: string, definition: string, options?: any, attachId?: number, siteId?: string): Promise { @@ -962,11 +962,11 @@ export class AddonModGlossaryProvider { /** * Check if a entry concept is already used. * - * @param {number} glossaryId Glossary ID. - * @param {string} concept Concept to check. - * @param {number} [timeCreated] Timecreated to check that is not the timecreated we are editing. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if used, resolved with false if not used or error. + * @param glossaryId Glossary ID. + * @param concept Concept to check. + * @param timeCreated Timecreated to check that is not the timecreated we are editing. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if used, resolved with false if not used or error. */ isConceptUsed(glossaryId: number, concept: string, timeCreated?: number, siteId?: string): Promise { // Check offline first. @@ -991,7 +991,7 @@ export class AddonModGlossaryProvider { * Return whether or not the plugin is enabled for editing in the current site. Plugin is enabled if the glossary WS are * available. * - * @return {boolean} Whether the glossary editing is available or not. + * @return Whether the glossary editing is available or not. */ isPluginEnabledForEditing(): boolean { return this.sitesProvider.getCurrentSite().wsAvailable('mod_glossary_add_entry'); @@ -1000,11 +1000,11 @@ export class AddonModGlossaryProvider { /** * Report a glossary as being viewed. * - * @param {number} glossaryId Glossary ID. - * @param {string} mode The mode in which the glossary was viewed. - * @param {string} [name] Name of the glossary. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param glossaryId Glossary ID. + * @param mode The mode in which the glossary was viewed. + * @param name Name of the glossary. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(glossaryId: number, mode: string, name?: string, siteId?: string): Promise { const params = { @@ -1019,11 +1019,11 @@ export class AddonModGlossaryProvider { /** * Report a glossary entry as being viewed. * - * @param {number} entryId Entry ID. - * @param {number} glossaryId Glossary ID. - * @param {string} [name] Name of the glossary. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param entryId Entry ID. + * @param glossaryId Glossary ID. + * @param name Name of the glossary. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logEntryView(entryId: number, glossaryId: number, name?: string, siteId?: string): Promise { const params = { @@ -1037,11 +1037,11 @@ export class AddonModGlossaryProvider { /** * Store several entries so we can determine their glossaryId in offline. * - * @param {number} glossaryId Glossary ID the entries belongs to. - * @param {any[]} entries Entries. - * @param {number} from The "page" the entries belong to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param glossaryId Glossary ID the entries belongs to. + * @param entries Entries. + * @param from The "page" the entries belong to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ protected storeEntries(glossaryId: number, entries: any[], from: number, siteId?: string): Promise { const promises = []; @@ -1056,11 +1056,11 @@ export class AddonModGlossaryProvider { /** * Store an entry so we can determine its glossaryId in offline. * - * @param {number} glossaryId Glossary ID the entry belongs to. - * @param {number} entryId Entry ID. - * @param {number} from The "page" the entry belongs to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param glossaryId Glossary ID the entry belongs to. + * @param entryId Entry ID. + * @param from The "page" the entry belongs to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ protected storeEntryId(glossaryId: number, entryId: number, from: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/mod/glossary/providers/helper.ts b/src/addon/mod/glossary/providers/helper.ts index 4ec569c47..4f9c86636 100644 --- a/src/addon/mod/glossary/providers/helper.ts +++ b/src/addon/mod/glossary/providers/helper.ts @@ -31,11 +31,11 @@ export class AddonModGlossaryHelperProvider { /** * Delete stored attachment files for a new entry. * - * @param {number} glossaryId Glossary ID. - * @param {string} entryName The name of the entry. - * @param {number} timeCreated The time the entry was created. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when deleted. + * @param glossaryId Glossary ID. + * @param entryName The name of the entry. + * @param timeCreated The time the entry was created. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when deleted. */ deleteStoredFiles(glossaryId: number, entryName: string, timeCreated: number, siteId?: string): Promise { return this.glossaryOffline.getEntryFolder(glossaryId, entryName, timeCreated, siteId).then((folderPath) => { @@ -48,11 +48,11 @@ export class AddonModGlossaryHelperProvider { /** * Get a list of stored attachment files for a new entry. See AddonModGlossaryHelperProvider#storeFiles. * - * @param {number} glossaryId lossary ID. - * @param {string} entryName The name of the entry. - * @param {number} [timeCreated] The time the entry was created. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the files. + * @param glossaryId lossary ID. + * @param entryName The name of the entry. + * @param timeCreated The time the entry was created. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the files. */ getStoredFiles(glossaryId: number, entryName: string, timeCreated: number, siteId?: string): Promise { return this.glossaryOffline.getEntryFolder(glossaryId, entryName, timeCreated, siteId).then((folderPath) => { @@ -63,10 +63,10 @@ export class AddonModGlossaryHelperProvider { /** * Check if the data of an entry has changed. * - * @param {any} entry Current data. - * @param {any[]} files Files attached. - * @param {any} original Original content. - * @return {boolean} True if data has changed, false otherwise. + * @param entry Current data. + * @param files Files attached. + * @param original Original content. + * @return True if data has changed, false otherwise. */ hasEntryDataChanged(entry: any, files: any[], original: any): boolean { if (!original || typeof original.concept == 'undefined') { @@ -85,12 +85,12 @@ export class AddonModGlossaryHelperProvider { * Given a list of files (either online files or local files), store the local files in a local folder * to be submitted later. * - * @param {number} glossaryId Glossary ID. - * @param {string} entryName The name of the entry. - * @param {number} [timeCreated] The time the entry was created. - * @param {any[]} files List of files. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success, rejected otherwise. + * @param glossaryId Glossary ID. + * @param entryName The name of the entry. + * @param timeCreated The time the entry was created. + * @param files List of files. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success, rejected otherwise. */ storeFiles(glossaryId: number, entryName: string, timeCreated: number, files: any[], siteId?: string): Promise { // Get the folder where to store the files. @@ -102,13 +102,13 @@ export class AddonModGlossaryHelperProvider { /** * Upload or store some files, depending if the user is offline or not. * - * @param {number} glossaryId Glossary ID. - * @param {string} entryName The name of the entry. - * @param {number} [timeCreated] The time the entry was created. - * @param {any[]} files List of files. - * @param {boolean} offline True if files sould be stored for offline, false to upload them. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success. + * @param glossaryId Glossary ID. + * @param entryName The name of the entry. + * @param timeCreated The time the entry was created. + * @param files List of files. + * @param offline True if files sould be stored for offline, false to upload them. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success. */ uploadOrStoreFiles(glossaryId: number, entryName: string, timeCreated: number, files: any[], offline: boolean, siteId?: string): Promise { diff --git a/src/addon/mod/glossary/providers/module-handler.ts b/src/addon/mod/glossary/providers/module-handler.ts index 88b952b13..9e2df7a4b 100644 --- a/src/addon/mod/glossary/providers/module-handler.ts +++ b/src/addon/mod/glossary/providers/module-handler.ts @@ -46,7 +46,7 @@ export class AddonModGlossaryModuleHandler implements CoreCourseModuleHandler { /** * 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 { return true; @@ -55,10 +55,10 @@ export class AddonModGlossaryModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { return { @@ -80,9 +80,9 @@ export class AddonModGlossaryModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModGlossaryIndexComponent; @@ -92,7 +92,7 @@ export class AddonModGlossaryModuleHandler implements CoreCourseModuleHandler { * Whether to display the course refresher in single activity course format. If it returns false, a refresher must be * included in the template that calls the doRefresh method of the component. Defaults to true. * - * @return {boolean} Whether the refresher should be displayed. + * @return Whether the refresher should be displayed. */ displayRefresherInSingleActivity(): boolean { return false; diff --git a/src/addon/mod/glossary/providers/offline.ts b/src/addon/mod/glossary/providers/offline.ts index ffe5aef84..b50c3a34c 100644 --- a/src/addon/mod/glossary/providers/offline.ts +++ b/src/addon/mod/glossary/providers/offline.ts @@ -86,11 +86,11 @@ export class AddonModGlossaryOfflineProvider { /** * Delete a new entry. * - * @param {number} glossaryId Glossary ID. - * @param {string} concept Glossary entry concept. - * @param {number} timeCreated The time the entry was created. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if deleted, rejected if failure. + * @param glossaryId Glossary ID. + * @param concept Glossary entry concept. + * @param timeCreated The time the entry was created. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if deleted, rejected if failure. */ deleteNewEntry(glossaryId: number, concept: string, timeCreated: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -107,8 +107,8 @@ export class AddonModGlossaryOfflineProvider { /** * Get all the stored new entries from all the glossaries. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with entries. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with entries. */ getAllNewEntries(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -121,11 +121,11 @@ export class AddonModGlossaryOfflineProvider { /** * Get a stored new entry. * - * @param {number} glossaryId Glossary ID. - * @param {string} concept Glossary entry concept. - * @param {number} timeCreated The time the entry was created. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with entry. + * @param glossaryId Glossary ID. + * @param concept Glossary entry concept. + * @param timeCreated The time the entry was created. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with entry. */ getNewEntry(glossaryId: number, concept: string, timeCreated: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -143,10 +143,10 @@ export class AddonModGlossaryOfflineProvider { /** * Get all the stored add entry data from a certain glossary. * - * @param {number} glossaryId Glossary ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the entries belong to. If not defined, current user in site. - * @return {Promise} Promise resolved with entries. + * @param glossaryId Glossary ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User the entries belong to. If not defined, current user in site. + * @return Promise resolved with entries. */ getGlossaryNewEntries(glossaryId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -164,11 +164,11 @@ export class AddonModGlossaryOfflineProvider { /** * Check if a concept is used offline. * - * @param {number} glossaryId Glossary ID. - * @param {string} concept Concept to check. - * @param {number} [timeCreated] Time of the entry we are editing. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if concept is found, false otherwise. + * @param glossaryId Glossary ID. + * @param concept Concept to check. + * @param timeCreated Time of the entry we are editing. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if concept is found, false otherwise. */ isConceptUsed(glossaryId: number, concept: string, timeCreated?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -198,17 +198,17 @@ export class AddonModGlossaryOfflineProvider { /** * Save a new entry to be sent later. * - * @param {number} glossaryId Glossary ID. - * @param {string} concept Glossary entry concept. - * @param {string} definition Glossary entry concept definition. - * @param {number} courseId Course ID of the glossary. - * @param {any} [options] Options for the entry. - * @param {any} [attachments] Result of CoreFileUploaderProvider#storeFilesToUpload for attachments. - * @param {number} [timeCreated] The time the entry was created. If not defined, current time. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the entry belong to. If not defined, current user in site. - * @param {any} [discardEntry] The entry provided will be discarded if found. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param glossaryId Glossary ID. + * @param concept Glossary entry concept. + * @param definition Glossary entry concept definition. + * @param courseId Course ID of the glossary. + * @param options Options for the entry. + * @param attachments Result of CoreFileUploaderProvider#storeFilesToUpload for attachments. + * @param timeCreated The time the entry was created. If not defined, current time. + * @param siteId Site ID. If not defined, current site. + * @param userId User the entry belong to. If not defined, current user in site. + * @param discardEntry The entry provided will be discarded if found. + * @return Promise resolved if stored, rejected if failure. */ addNewEntry(glossaryId: number, concept: string, definition: string, courseId: number, options?: any, attachments?: any, timeCreated?: number, siteId?: string, userId?: number, discardEntry?: any): Promise { @@ -242,9 +242,9 @@ export class AddonModGlossaryOfflineProvider { /** * Get the path to the folder where to store files for offline attachments in a glossary. * - * @param {number} glossaryId Glossary ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the path. + * @param glossaryId Glossary ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the path. */ getGlossaryFolder(glossaryId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -258,11 +258,11 @@ export class AddonModGlossaryOfflineProvider { /** * Get the path to the folder where to store files for a new offline entry. * - * @param {number} glossaryId Glossary ID. - * @param {string} concept The name of the entry. - * @param {number} timeCreated Time to allow duplicated entries. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the path. + * @param glossaryId Glossary ID. + * @param concept The name of the entry. + * @param timeCreated Time to allow duplicated entries. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the path. */ getEntryFolder(glossaryId: number, concept: string, timeCreated: number, siteId?: string): Promise { return this.getGlossaryFolder(glossaryId, siteId).then((folderPath) => { @@ -273,8 +273,8 @@ export class AddonModGlossaryOfflineProvider { /** * Parse "options" and "attachments" columns of a fetched record. * - * @param {any} records Record object - * @return {any} Record object with columns parsed. + * @param records Record object + * @return Record object with columns parsed. */ protected parseRecord(record: any): any { record.options = this.textUtils.parseJSON(record.options); diff --git a/src/addon/mod/glossary/providers/prefetch-handler.ts b/src/addon/mod/glossary/providers/prefetch-handler.ts index 9235c4b54..5b852178c 100644 --- a/src/addon/mod/glossary/providers/prefetch-handler.ts +++ b/src/addon/mod/glossary/providers/prefetch-handler.ts @@ -50,10 +50,10 @@ export class AddonModGlossaryPrefetchHandler extends CoreCourseActivityPrefetchH /** * Get list of files. If not defined, we'll assume they're in module.contents. * - * @param {any} module Module. - * @param {Number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise} Promise resolved with the list of files. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved with the list of files. */ getFiles(module: any, courseId: number, single?: boolean): Promise { return this.glossaryProvider.getGlossary(courseId, module.id).then((glossary) => { @@ -70,10 +70,10 @@ export class AddonModGlossaryPrefetchHandler extends CoreCourseActivityPrefetchH /** * Get the list of downloadable files. It includes entry embedded files. * - * @param {any} module Module to get the files. - * @param {any} glossary Glossary - * @param {any[]} entries Entries of the Glossary. - * @return {any[]} List of Files. + * @param module Module to get the files. + * @param glossary Glossary + * @param entries Entries of the Glossary. + * @return List of Files. */ protected getFilesFromGlossaryAndEntries(module: any, glossary: any, entries: any[]): any[] { let files = this.getIntroFilesFromInstance(module, glossary); @@ -96,9 +96,9 @@ export class AddonModGlossaryPrefetchHandler extends CoreCourseActivityPrefetchH /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId The course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId The course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.glossaryProvider.invalidateContent(moduleId, courseId); @@ -107,11 +107,11 @@ export class AddonModGlossaryPrefetchHandler extends CoreCourseActivityPrefetchH /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string): Promise { return this.prefetchPackage(module, courseId, single, this.prefetchGlossary.bind(this)); @@ -120,11 +120,11 @@ export class AddonModGlossaryPrefetchHandler extends CoreCourseActivityPrefetchH /** * Prefetch a glossary. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} single True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when done. + * @param module The module object returned by WS. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. + * @return Promise resolved when done. */ protected prefetchGlossary(module: any, courseId: number, single: boolean, siteId: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -193,10 +193,10 @@ export class AddonModGlossaryPrefetchHandler extends CoreCourseActivityPrefetchH /** * Sync a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ sync(module: any, courseId: number, siteId?: any): Promise { const promises = [ diff --git a/src/addon/mod/glossary/providers/sync-cron-handler.ts b/src/addon/mod/glossary/providers/sync-cron-handler.ts index d952ce356..52ed49b68 100644 --- a/src/addon/mod/glossary/providers/sync-cron-handler.ts +++ b/src/addon/mod/glossary/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class AddonModGlossarySyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.glossarySync.syncAllGlossaries(siteId, force); @@ -40,7 +40,7 @@ export class AddonModGlossarySyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return this.glossarySync.syncInterval; diff --git a/src/addon/mod/glossary/providers/sync.ts b/src/addon/mod/glossary/providers/sync.ts index 746563f67..da90b1f65 100644 --- a/src/addon/mod/glossary/providers/sync.ts +++ b/src/addon/mod/glossary/providers/sync.ts @@ -67,9 +67,9 @@ export class AddonModGlossarySyncProvider extends CoreSyncBaseProvider { /** * Try to synchronize all the glossaries in a certain site or in all sites. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncAllGlossaries(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all glossaries', this.syncAllGlossariesFunc.bind(this), [force], siteId); @@ -78,9 +78,9 @@ export class AddonModGlossarySyncProvider extends CoreSyncBaseProvider { /** * Sync all glossaries on a site. * - * @param {string} siteId Site ID to sync. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ protected syncAllGlossariesFunc(siteId: string, force?: boolean): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -126,10 +126,10 @@ export class AddonModGlossarySyncProvider extends CoreSyncBaseProvider { /** * Sync a glossary only if a certain time has passed since the last time. * - * @param {number} glossaryId Glossary ID. - * @param {number} userId User the entry belong to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the glossary is synced or if it doesn't need to be synced. + * @param glossaryId Glossary ID. + * @param userId User the entry belong to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the glossary is synced or if it doesn't need to be synced. */ syncGlossaryEntriesIfNeeded(glossaryId: number, userId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -146,10 +146,10 @@ export class AddonModGlossarySyncProvider extends CoreSyncBaseProvider { /** * Synchronize all offline entries of a glossary. * - * @param {number} glossaryId Glossary ID to be synced. - * @param {number} [userId] User the entries belong to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param glossaryId Glossary ID to be synced. + * @param userId User the entries belong to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncGlossaryEntries(glossaryId: number, userId?: number, siteId?: string): Promise { userId = userId || this.sitesProvider.getCurrentSiteUserId(); @@ -258,10 +258,10 @@ export class AddonModGlossarySyncProvider extends CoreSyncBaseProvider { /** * Synchronize offline ratings. * - * @param {number} [cmId] Course module to be synced. If not defined, sync all glossaries. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param cmId Course module to be synced. If not defined, sync all glossaries. + * @param force Wether to force sync not depending on last execution. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncRatings(cmId?: number, force?: boolean, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -303,11 +303,11 @@ export class AddonModGlossarySyncProvider extends CoreSyncBaseProvider { /** * Delete a new entry. * - * @param {number} glossaryId Glossary ID. - * @param {string} concept Glossary entry concept. - * @param {number} timeCreated Time to allow duplicated entries. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when deleted. + * @param glossaryId Glossary ID. + * @param concept Glossary entry concept. + * @param timeCreated Time to allow duplicated entries. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when deleted. */ protected deleteAddEntry(glossaryId: number, concept: string, timeCreated: number, siteId?: string): Promise { const promises = []; @@ -323,10 +323,10 @@ export class AddonModGlossarySyncProvider extends CoreSyncBaseProvider { /** * Upload attachments of an offline entry. * - * @param {number} glossaryId Glossary ID. - * @param {any} entry Offline entry. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with draftid if uploaded, resolved with 0 if nothing to upload. + * @param glossaryId Glossary ID. + * @param entry Offline entry. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with draftid if uploaded, resolved with 0 if nothing to upload. */ protected uploadAttachments(glossaryId: number, entry: any, siteId?: string): Promise { if (entry.attachments) { @@ -357,9 +357,9 @@ export class AddonModGlossarySyncProvider extends CoreSyncBaseProvider { /** * Get the ID of a glossary sync. * - * @param {number} glossaryId Glossary ID. - * @param {number} [userId] User the entries belong to.. If not defined, current user. - * @return {string} Sync ID. + * @param glossaryId Glossary ID. + * @param userId User the entries belong to.. If not defined, current user. + * @return Sync ID. */ protected getGlossarySyncId(glossaryId: number, userId?: number): string { userId = userId || this.sitesProvider.getCurrentSiteUserId(); diff --git a/src/addon/mod/glossary/providers/tag-area-handler.ts b/src/addon/mod/glossary/providers/tag-area-handler.ts index 4c62f698d..fc1d3345e 100644 --- a/src/addon/mod/glossary/providers/tag-area-handler.ts +++ b/src/addon/mod/glossary/providers/tag-area-handler.ts @@ -29,7 +29,7 @@ export class AddonModGlossaryTagAreaHandler implements CoreTagAreaHandler { /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return true; @@ -38,8 +38,8 @@ export class AddonModGlossaryTagAreaHandler implements CoreTagAreaHandler { /** * Parses the rendered content of a tag index and returns the items. * - * @param {string} content Rendered content. - * @return {any[]|Promise} Area items (or promise resolved with the items). + * @param content Rendered content. + * @return Area items (or promise resolved with the items). */ parseContent(content: string): any[] | Promise { return this.tagHelper.parseFeedContent(content); @@ -48,8 +48,8 @@ export class AddonModGlossaryTagAreaHandler implements CoreTagAreaHandler { /** * Get the component to use to display items. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return CoreTagFeedComponent; diff --git a/src/addon/mod/imscp/components/index/index.ts b/src/addon/mod/imscp/components/index/index.ts index 3b793da19..37edb9b87 100644 --- a/src/addon/mod/imscp/components/index/index.ts +++ b/src/addon/mod/imscp/components/index/index.ts @@ -62,7 +62,7 @@ export class AddonModImscpIndexComponent extends CoreCourseModuleMainResourceCom /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { return this.imscpProvider.invalidateContent(this.module.id, this.courseId); @@ -71,8 +71,8 @@ export class AddonModImscpIndexComponent extends CoreCourseModuleMainResourceCom /** * Download imscp contents. * - * @param {boolean} [refresh] Whether we're refreshing data. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @return Promise resolved when done. */ protected fetchContent(refresh?: boolean): Promise { let downloadFailed = false; @@ -120,8 +120,8 @@ export class AddonModImscpIndexComponent extends CoreCourseModuleMainResourceCom /** * Loads an item. * - * @param {string} itemId Item ID. - * @return {Promise} Promise resolved when done. + * @param itemId Item ID. + * @return Promise resolved when done. */ loadItem(itemId: string): Promise { return this.imscpProvider.getIframeSrc(this.module, itemId).then((src) => { @@ -144,7 +144,7 @@ export class AddonModImscpIndexComponent extends CoreCourseModuleMainResourceCom /** * Show the TOC. * - * @param {MouseEvent} event Event. + * @param event Event. */ showToc(event: MouseEvent): void { // Create the toc modal. diff --git a/src/addon/mod/imscp/pages/index/index.ts b/src/addon/mod/imscp/pages/index/index.ts index b94d81b8b..8300d2629 100644 --- a/src/addon/mod/imscp/pages/index/index.ts +++ b/src/addon/mod/imscp/pages/index/index.ts @@ -40,7 +40,7 @@ export class AddonModImscpIndexPage { /** * Update some data based on the imscp instance. * - * @param {any} imscp Imscp instance. + * @param imscp Imscp instance. */ updateData(imscp: any): void { this.title = imscp.name || this.title; diff --git a/src/addon/mod/imscp/pages/toc/toc.ts b/src/addon/mod/imscp/pages/toc/toc.ts index 1880e4813..80f67f1b7 100644 --- a/src/addon/mod/imscp/pages/toc/toc.ts +++ b/src/addon/mod/imscp/pages/toc/toc.ts @@ -35,7 +35,7 @@ export class AddonModImscpTocPage { /** * Function called when an item is clicked. * - * @param {string} id ID of the clicked item. + * @param id ID of the clicked item. */ loadItem(id: string): void { this.viewCtrl.dismiss(id); @@ -44,8 +44,8 @@ export class AddonModImscpTocPage { /** * Get dummy array for padding. * - * @param {number} n Array length. - * @return {number[]} Dummy array with n elements. + * @param n Array length. + * @return Dummy array with n elements. */ getNumberForPadding(n: number): number[] { return new Array(n); diff --git a/src/addon/mod/imscp/providers/imscp.ts b/src/addon/mod/imscp/providers/imscp.ts index 86166f3c2..366cb7bf6 100644 --- a/src/addon/mod/imscp/providers/imscp.ts +++ b/src/addon/mod/imscp/providers/imscp.ts @@ -39,8 +39,8 @@ export class AddonModImscpProvider { /** * Get the IMSCP toc as an array. * - * @param {any[]} contents The module contents. - * @return {any} The toc. + * @param contents The module contents. + * @return The toc. */ protected getToc(contents: any[]): any { if (!contents || !contents.length) { @@ -53,8 +53,8 @@ export class AddonModImscpProvider { /** * Get the imscp toc as an array of items (not nested) to build the navigation tree. * - * @param {any[]} contents The module contents. - * @return {any[]} The toc as a list. + * @param contents The module contents. + * @return The toc as a list. */ createItemList(contents: any[]): any[] { const items = []; @@ -72,9 +72,9 @@ export class AddonModImscpProvider { /** * Get the previous item to the given one. * - * @param {any[]} items The items list. - * @param {string} itemId The current item. - * @return {string} The previous item id. + * @param items The items list. + * @param itemId The current item. + * @return The previous item id. */ getPreviousItem(items: any[], itemId: string): string { const position = this.getItemPosition(items, itemId); @@ -93,9 +93,9 @@ export class AddonModImscpProvider { /** * Get the next item to the given one. * - * @param {any[]} items The items list. - * @param {string} itemId The current item. - * @return {string} The next item id. + * @param items The items list. + * @param itemId The current item. + * @return The next item id. */ getNextItem(items: any[], itemId: string): string { const position = this.getItemPosition(items, itemId); @@ -114,9 +114,9 @@ export class AddonModImscpProvider { /** * Get the position of a item. * - * @param {any[]} items The items list. - * @param {string} itemId The item to search. - * @return {number} The item position. + * @param items The items list. + * @param itemId The item to search. + * @return The item position. */ protected getItemPosition(items: any[], itemId: string): number { for (let i = 0; i < items.length; i++) { @@ -131,8 +131,8 @@ export class AddonModImscpProvider { /** * Check if we should ommit the file download. * - * @param {string} fileName The file name - * @return {boolean} True if we should ommit the file. + * @param fileName The file name + * @return True if we should ommit the file. */ protected checkSpecialFiles(fileName: string): boolean { return fileName == 'imsmanifest.xml'; @@ -141,8 +141,8 @@ export class AddonModImscpProvider { /** * Get cache key for imscp data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getImscpDataCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'imscp:' + courseId; @@ -151,11 +151,11 @@ export class AddonModImscpProvider { /** * Get a imscp with key=value. If more than one is found, only the first will be returned. * - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the imscp is retrieved. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the imscp is retrieved. */ protected getImscpByKey(courseId: number, key: string, value: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -183,10 +183,10 @@ export class AddonModImscpProvider { /** * Get a imscp by course module ID. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the imscp is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the imscp is retrieved. */ getImscp(courseId: number, cmId: number, siteId?: string): Promise { return this.getImscpByKey(courseId, 'coursemodule', cmId, siteId); @@ -195,9 +195,9 @@ export class AddonModImscpProvider { /** * Given a filepath, get a certain fileurl from module contents. * - * @param {any[]} contents Module contents. - * @param {string} targetFilePath Path of the searched file. - * @return {string} File URL. + * @param contents Module contents. + * @param targetFilePath Path of the searched file. + * @return File URL. */ protected getFileUrlFromContents(contents: any[], targetFilePath: string): string { let indexUrl; @@ -218,9 +218,9 @@ export class AddonModImscpProvider { /** * Get src of a imscp item. * - * @param {any} module The module object. - * @param {string} [itemHref] Href of item to get. If not defined, gets src of main item. - * @return {Promise} Promise resolved with the item src. + * @param module The module object. + * @param itemHref Href of item to get. If not defined, gets src of main item. + * @return Promise resolved with the item src. */ getIframeSrc(module: any, itemHref?: string): Promise { if (!itemHref) { @@ -254,10 +254,10 @@ export class AddonModImscpProvider { /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID of the module. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the content is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID of the module. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the content is invalidated. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -274,9 +274,9 @@ export class AddonModImscpProvider { /** * Invalidates imscp data. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateImscpData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -288,8 +288,8 @@ export class AddonModImscpProvider { * Check if a file is downloadable. The file param must have 'type' and 'filename' attributes * like in core_course_get_contents response. * - * @param {any} file File to check. - * @return {boolean} True if downloadable, false otherwise. + * @param file File to check. + * @return True if downloadable, false otherwise. */ isFileDownloadable(file: any): boolean { return file.type === 'file' && !this.checkSpecialFiles(file.filename); @@ -298,8 +298,8 @@ export class AddonModImscpProvider { /** * Return whether or not the plugin is enabled in a certain site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ isPluginEnabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -310,10 +310,10 @@ export class AddonModImscpProvider { /** * Report a IMSCP as being viewed. * - * @param {string} id Module ID. - * @param {string} [name] Name of the imscp. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Module ID. + * @param name Name of the imscp. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params = { diff --git a/src/addon/mod/imscp/providers/list-link-handler.ts b/src/addon/mod/imscp/providers/list-link-handler.ts index 21bb3dbc4..eec7da06e 100644 --- a/src/addon/mod/imscp/providers/list-link-handler.ts +++ b/src/addon/mod/imscp/providers/list-link-handler.ts @@ -33,7 +33,7 @@ export class AddonModImscpListLinkHandler extends CoreContentLinksModuleListHand /** * Check if the handler is enabled on a site level. * - * @return {boolean|Promise} 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 { return this.imscpProvider.isPluginEnabled(); diff --git a/src/addon/mod/imscp/providers/module-handler.ts b/src/addon/mod/imscp/providers/module-handler.ts index 94f5e48ea..dc3abc139 100644 --- a/src/addon/mod/imscp/providers/module-handler.ts +++ b/src/addon/mod/imscp/providers/module-handler.ts @@ -45,7 +45,7 @@ export class AddonModImscpModuleHandler implements CoreCourseModuleHandler { /** * Check if the handler is enabled on a site level. * - * @return {boolean|Promise} 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 { return this.imscpProvider.isPluginEnabled(); @@ -54,10 +54,10 @@ export class AddonModImscpModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { return { @@ -79,9 +79,9 @@ export class AddonModImscpModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModImscpIndexComponent; diff --git a/src/addon/mod/imscp/providers/pluginfile-handler.ts b/src/addon/mod/imscp/providers/pluginfile-handler.ts index f3cd322d6..d15124b18 100644 --- a/src/addon/mod/imscp/providers/pluginfile-handler.ts +++ b/src/addon/mod/imscp/providers/pluginfile-handler.ts @@ -26,8 +26,8 @@ export class AddonModImscpPluginFileHandler implements CorePluginFileHandler { /** * Return the RegExp to match the revision on pluginfile URLs. * - * @param {string[]} args Arguments of the pluginfile URL defining component and filearea at least. - * @return {RegExp} RegExp to match the revision on pluginfile URLs. + * @param args Arguments of the pluginfile URL defining component and filearea at least. + * @return RegExp to match the revision on pluginfile URLs. */ getComponentRevisionRegExp(args: string[]): RegExp { // Check filearea. @@ -47,8 +47,8 @@ export class AddonModImscpPluginFileHandler implements CorePluginFileHandler { /** * Should return the string to remove the revision on pluginfile url. * - * @param {string[]} args Arguments of the pluginfile URL defining component and filearea at least. - * @return {string} String to remove the revision on pluginfile url. + * @param args Arguments of the pluginfile URL defining component and filearea at least. + * @return String to remove the revision on pluginfile url. */ getComponentRevisionReplace(args: string[]): string { // Component + Filearea + Revision diff --git a/src/addon/mod/imscp/providers/prefetch-handler.ts b/src/addon/mod/imscp/providers/prefetch-handler.ts index 6f8a10c9e..65d49dbbc 100644 --- a/src/addon/mod/imscp/providers/prefetch-handler.ts +++ b/src/addon/mod/imscp/providers/prefetch-handler.ts @@ -42,13 +42,13 @@ export class AddonModImscpPrefetchHandler extends CoreCourseResourcePrefetchHand /** * Download or prefetch the content. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {boolean} [prefetch] True to prefetch, false to download right away. - * @param {string} [dirPath] Path of the directory where to store all the content files. This is to keep the files - * relative paths and make the package work in an iframe. Undefined to download the files - * in the filepool root folder. - * @return {Promise} Promise resolved when all content is downloaded. Data returned is not reliable. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param prefetch True to prefetch, false to download right away. + * @param dirPath Path of the directory where to store all the content files. This is to keep the files + * relative paths and make the package work in an iframe. Undefined to download the files + * in the filepool root folder. + * @return Promise resolved when all content is downloaded. Data returned is not reliable. */ downloadOrPrefetch(module: any, courseId: number, prefetch?: boolean, dirPath?: string): Promise { const siteId = this.sitesProvider.getCurrentSiteId(); @@ -66,9 +66,9 @@ export class AddonModImscpPrefetchHandler extends CoreCourseResourcePrefetchHand /** * Returns module intro files. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved with list of intro files. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @return Promise resolved with list of intro files. */ getIntroFiles(module: any, courseId: number): Promise { return this.imscpProvider.getImscp(courseId, module.id).catch(() => { @@ -81,9 +81,9 @@ export class AddonModImscpPrefetchHandler extends CoreCourseResourcePrefetchHand /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.imscpProvider.invalidateContent(moduleId, courseId); @@ -92,9 +92,9 @@ export class AddonModImscpPrefetchHandler extends CoreCourseResourcePrefetchHand /** * Invalidate WS calls needed to determine module status. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule(module: any, courseId: number): Promise { const promises = []; @@ -108,7 +108,7 @@ export class AddonModImscpPrefetchHandler extends CoreCourseResourcePrefetchHand /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ isEnabled(): boolean | Promise { return this.imscpProvider.isPluginEnabled(); @@ -117,8 +117,8 @@ export class AddonModImscpPrefetchHandler extends CoreCourseResourcePrefetchHand /** * Check if a file is downloadable. * - * @param {any} file File to check. - * @return {boolean} Whether the file is downloadable. + * @param file File to check. + * @return Whether the file is downloadable. */ isFileDownloadable(file: any): boolean { return this.imscpProvider.isFileDownloadable(file); diff --git a/src/addon/mod/label/providers/label.ts b/src/addon/mod/label/providers/label.ts index 2b4e79534..ec75856b6 100644 --- a/src/addon/mod/label/providers/label.ts +++ b/src/addon/mod/label/providers/label.ts @@ -33,8 +33,8 @@ export class AddonModLabelProvider { /** * Get cache key for label data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getLabelDataCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'label:' + courseId; @@ -43,13 +43,13 @@ export class AddonModLabelProvider { /** * Get a label with key=value. If more than one is found, only the first will be returned. * - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {boolean} [forceCache] True to always get the value from cache, false otherwise. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not provided, current site. - * @return {Promise} Promise resolved when the label is retrieved. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param forceCache True to always get the value from cache, false otherwise. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not provided, current site. + * @return Promise resolved when the label is retrieved. */ protected getLabelByField(courseId: number, key: string, value: any, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise { @@ -86,12 +86,12 @@ export class AddonModLabelProvider { /** * Get a label by course module ID. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {boolean} [forceCache] True to always get the value from cache, false otherwise. - * @param {boolean} [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. - * @return {Promise} Promise resolved when the label is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param forceCache True to always get the value from cache, false otherwise. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the label is retrieved. */ getLabel(courseId: number, cmId: number, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise { return this.getLabelByField(courseId, 'coursemodule', cmId, forceCache, ignoreCache, siteId); @@ -100,12 +100,12 @@ export class AddonModLabelProvider { /** * Get a label by ID. * - * @param {number} courseId Course ID. - * @param {number} labelId Label ID. - * @param {boolean} [forceCache] True to always get the value from cache, false otherwise. - * @param {boolean} [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. - * @return {Promise} Promise resolved when the label is retrieved. + * @param courseId Course ID. + * @param labelId Label ID. + * @param forceCache True to always get the value from cache, false otherwise. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the label is retrieved. */ getLabelById(courseId: number, labelId: number, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise { return this.getLabelByField(courseId, 'id', labelId, forceCache, ignoreCache, siteId); @@ -114,9 +114,9 @@ export class AddonModLabelProvider { /** * Invalidate label data. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateLabelData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(null).then((site) => { @@ -127,10 +127,10 @@ export class AddonModLabelProvider { /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when data is invalidated. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -147,8 +147,8 @@ export class AddonModLabelProvider { /** * Check if the site has the WS to get label data. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether it's available. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether it's available. * @since 3.3 */ isGetLabelAvailable(siteId?: string): Promise { @@ -160,8 +160,8 @@ export class AddonModLabelProvider { /** * Check if the site has the WS to get label data. * - * @param {CoreSite} [site] Site. If not defined, current site. - * @return {boolean} Whether it's available. + * @param site Site. If not defined, current site. + * @return Whether it's available. * @since 3.3 */ isGetLabelAvailableForSite(site?: CoreSite): boolean { diff --git a/src/addon/mod/label/providers/module-handler.ts b/src/addon/mod/label/providers/module-handler.ts index 8c8ecfeb8..6a8f72a75 100644 --- a/src/addon/mod/label/providers/module-handler.ts +++ b/src/addon/mod/label/providers/module-handler.ts @@ -44,7 +44,7 @@ export class AddonModLabelModuleHandler implements CoreCourseModuleHandler { /** * 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 { return true; @@ -53,10 +53,10 @@ export class AddonModLabelModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { // Remove the description from the module so it isn't rendered twice. @@ -76,10 +76,10 @@ export class AddonModLabelModuleHandler implements CoreCourseModuleHandler { * The component returned must implement CoreCourseModuleMainComponent. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param course The course object. + * @param module The module object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getMainComponent(injector: Injector, course: any, module: any): any | Promise { // There's no need to implement this because label cannot be used in singleactivity course format. diff --git a/src/addon/mod/label/providers/prefetch-handler.ts b/src/addon/mod/label/providers/prefetch-handler.ts index 3f86dec31..a52ad9ab8 100644 --- a/src/addon/mod/label/providers/prefetch-handler.ts +++ b/src/addon/mod/label/providers/prefetch-handler.ts @@ -44,10 +44,10 @@ export class AddonModLabelPrefetchHandler extends CoreCourseResourcePrefetchHand /** * Returns module intro files. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise resolved with list of intro files. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved with list of intro files. */ getIntroFiles(module: any, courseId: number, ignoreCache?: boolean): Promise { let promise; @@ -66,9 +66,9 @@ export class AddonModLabelPrefetchHandler extends CoreCourseResourcePrefetchHand /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.labelProvider.invalidateContent(moduleId, courseId); @@ -77,9 +77,9 @@ export class AddonModLabelPrefetchHandler extends CoreCourseResourcePrefetchHand /** * Invalidate WS calls needed to determine module status. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule(module: any, courseId: number): Promise { const promises = []; diff --git a/src/addon/mod/lesson/components/index/index.ts b/src/addon/mod/lesson/components/index/index.ts index b179e7993..d236da208 100644 --- a/src/addon/mod/lesson/components/index/index.ts +++ b/src/addon/mod/lesson/components/index/index.ts @@ -93,7 +93,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Change the group displayed. * - * @param {number} groupId Group ID to display. + * @param groupId Group ID to display. */ changeGroup(groupId: number): void { this.reportLoaded = false; @@ -108,10 +108,10 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Get the lesson data. * - * @param {boolean} [refresh=false] If it's refreshing content. - * @param {boolean} [sync=false] If it should try to sync. - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved when done. + * @param refresh If it's refreshing content. + * @param sync If it should try to sync. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved when done. */ protected fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { @@ -217,7 +217,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Fetch the reports data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchReportData(): Promise { return this.groupsProvider.getActivityGroupInfo(this.module.id).then((groupInfo) => { @@ -232,8 +232,8 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Checks if sync has succeed from result sync data. * - * @param {any} result Data returned on the sync function. - * @return {boolean} If suceed or not. + * @param result Data returned on the sync function. + * @return If suceed or not. */ protected hasSyncSucceed(result: any): boolean { if (result.updated || this.dataSent) { @@ -292,7 +292,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -316,8 +316,8 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Compares sync event data with current data to check if refresh content is needed. * - * @param {any} syncEventData Data receiven on sync observer. - * @return {boolean} True if refresh is needed, false otherwise. + * @param syncEventData Data receiven on sync observer. + * @return True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: any): boolean { return this.lesson && syncEventData.lessonId == this.lesson.id; @@ -326,7 +326,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Function called when the lesson is ready to be seen (no pending prevent access reasons). * - * @param {boolean} [refresh=false] If it's refreshing content. + * @param refresh If it's refreshing content. */ protected lessonReady(refresh?: boolean): void { this.askPassword = false; @@ -355,8 +355,8 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Open the lesson player. * - * @param {boolean} continueLast Whether to continue the last retake. - * @return {Promise} Promise resolved when done. + * @param continueLast Whether to continue the last retake. + * @return Promise resolved when done. */ protected playLesson(continueLast: boolean): Promise { // Calculate the pageId to load. If there is timelimit, lesson is always restarted from the start. @@ -426,8 +426,8 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Set a group to view the reports. * - * @param {number} groupId Group ID. - * @return {Promise} Promise resolved when done. + * @param groupId Group ID. + * @return Promise resolved when done. */ protected setGroup(groupId: number): Promise { this.group = groupId; @@ -498,8 +498,8 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Displays some data based on the current status. * - * @param {string} status The current status. - * @param {string} [previousStatus] The previous status. If not defined, there is no previous status. + * @param status The current status. + * @param previousStatus The previous status. If not defined, there is no previous status. */ protected showStatus(status: string, previousStatus?: string): void { this.showSpinner = status == CoreConstants.DOWNLOADING; @@ -508,7 +508,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Start the lesson. * - * @param {boolean} [continueLast] Whether to continue the last attempt. + * @param continueLast Whether to continue the last attempt. */ start(continueLast?: boolean): void { if (this.showSpinner) { @@ -547,8 +547,8 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Submit password for password protected lessons. * - * @param {Event} e Event. - * @param {HTMLInputElement} passwordEl The password input. + * @param e Event. + * @param passwordEl The password input. */ submitPassword(e: Event, passwordEl: HTMLInputElement): void { e.preventDefault(); @@ -591,7 +591,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Performs the sync of the activity. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected sync(): Promise { return this.lessonSync.syncLesson(this.lesson.id, true).then((result) => { @@ -611,8 +611,8 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo /** * Validate a password and retrieve extra data. * - * @param {string} password The password to validate. - * @return {Promise} Promise resolved when done. + * @param password The password to validate. + * @return Promise resolved when done. */ protected validatePassword(password: string): Promise { return this.lessonProvider.getLessonWithPassword(this.lesson.id, password).then((lessonData) => { diff --git a/src/addon/mod/lesson/pages/index/index.ts b/src/addon/mod/lesson/pages/index/index.ts index 838cbe8a3..8899c8077 100644 --- a/src/addon/mod/lesson/pages/index/index.ts +++ b/src/addon/mod/lesson/pages/index/index.ts @@ -44,7 +44,7 @@ export class AddonModLessonIndexPage { /** * Update some data based on the lesson instance. * - * @param {any} lesson Lesson instance. + * @param lesson Lesson instance. */ updateData(lesson: any): void { this.title = lesson.name || this.title; diff --git a/src/addon/mod/lesson/pages/menu-modal/menu-modal.ts b/src/addon/mod/lesson/pages/menu-modal/menu-modal.ts index a9406ceb4..e9548064c 100644 --- a/src/addon/mod/lesson/pages/menu-modal/menu-modal.ts +++ b/src/addon/mod/lesson/pages/menu-modal/menu-modal.ts @@ -31,7 +31,6 @@ export class AddonModLessonMenuModalPage { * the menu dynamically based on the data retrieved by the page that opened the modal. * - The onDidDismiss function takes a while to be called, making the app seem slow. This way we can directly call * the functions we need without having to wait for the modal to be dismissed. - * @type {any} */ pageInstance: any; @@ -49,7 +48,7 @@ export class AddonModLessonMenuModalPage { /** * Load a certain page. * - * @param {number} pageId The page ID to load. + * @param pageId The page ID to load. */ loadPage(pageId: number): void { this.pageInstance.changePage && this.pageInstance.changePage(pageId); diff --git a/src/addon/mod/lesson/pages/password-modal/password-modal.ts b/src/addon/mod/lesson/pages/password-modal/password-modal.ts index d748163eb..b1e7699a5 100644 --- a/src/addon/mod/lesson/pages/password-modal/password-modal.ts +++ b/src/addon/mod/lesson/pages/password-modal/password-modal.ts @@ -30,8 +30,8 @@ export class AddonModLessonPasswordModalPage { /** * Send the password back. * - * @param {Event} e Event. - * @param {HTMLInputElement} password The input element. + * @param e Event. + * @param password The input element. */ submitPassword(e: Event, password: HTMLInputElement): void { e.preventDefault(); diff --git a/src/addon/mod/lesson/pages/player/player.ts b/src/addon/mod/lesson/pages/player/player.ts index a19c4e48f..8c96a6721 100644 --- a/src/addon/mod/lesson/pages/player/player.ts +++ b/src/addon/mod/lesson/pages/player/player.ts @@ -130,7 +130,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy { /** * Check if we can leave the page or not. * - * @return {boolean|Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { if (this.forceLeave) { @@ -157,7 +157,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy { /** * A button was clicked. * - * @param {any} data Button data. + * @param data Button data. */ buttonClicked(data: any): void { this.processPage(data); @@ -166,11 +166,11 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy { /** * Call a function and go offline if allowed and the call fails. * - * @param {Function} func Function to call. - * @param {any[]} args Arguments to pass to the function. - * @param {number} offlineParamPos Position of the offline parameter in the args. - * @param {number} [jumpsParamPos] Position of the jumps parameter in the args. - * @return {Promise} Promise resolved in success, rejected otherwise. + * @param func Function to call. + * @param args Arguments to pass to the function. + * @param offlineParamPos Position of the offline parameter in the args. + * @param jumpsParamPos Position of the jumps parameter in the args. + * @return Promise resolved in success, rejected otherwise. */ protected callFunction(func: Function, args: any[], offlineParamPos: number, jumpsParamPos?: number): Promise { return func.apply(func, args).catch((error) => { @@ -200,8 +200,8 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy { /** * Change the page from menu or when continuing from a feedback page. * - * @param {number} pageId Page to load. - * @param {boolean} [ignoreCurrent] If true, allow loading current page. + * @param pageId Page to load. + * @param ignoreCurrent If true, allow loading current page. */ changePage(pageId: number, ignoreCurrent?: boolean): void { if (!ignoreCurrent && !this.eolData && this.currentPage == pageId) { @@ -222,7 +222,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy { /** * Get the lesson data and load the page. * - * @return {Promise} Promise resolved with true if success, resolved with false otherwise. + * @return Promise resolved with true if success, resolved with false otherwise. */ protected fetchLessonData(): Promise { // Wait for any ongoing sync to finish. We won't sync a lesson while it's being played. @@ -315,8 +315,8 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy { /** * Finish the retake. * - * @param {boolean} [outOfTime] Whether the retake is finished because the user ran out of time. - * @return {Promise} Promise resolved when done. + * @param outOfTime Whether the retake is finished because the user ran out of time. + * @return Promise resolved when done. */ protected finishRetake(outOfTime?: boolean): Promise { let promise; @@ -386,8 +386,8 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy { /** * Jump to a certain page after performing an action. * - * @param {number} pageId The page to load. - * @return {Promise} Promise resolved when done. + * @param pageId The page to load. + * @return Promise resolved when done. */ protected jumpToPage(pageId: number): Promise { if (pageId === 0) { @@ -411,8 +411,8 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy { /** * Start or continue a retake. * - * @param {number} pageId The page to load. - * @return {Promise} Promise resolved when done. + * @param pageId The page to load. + * @return Promise resolved when done. */ protected launchRetake(pageId: number): Promise { let promise; @@ -453,7 +453,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy { /** * Load the lesson menu. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected loadMenu(): Promise { if (this.loadingMenu) { @@ -479,8 +479,8 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy { /** * Load a certain page. * - * @param {number} pageId The page to load. - * @return {Promise} Promise resolved when done. + * @param pageId The page to load. + * @return Promise resolved when done. */ protected loadPage(pageId: number): Promise { if (pageId == AddonModLessonProvider.LESSON_EOL) { @@ -535,8 +535,8 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy { /** * Process a page, sending some data. * - * @param {any} data The data to send. - * @return {Promise} Promise resolved when done. + * @param data The data to send. + * @return Promise resolved when done. */ protected processPage(data: any): Promise { this.loaded = false; @@ -605,7 +605,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy { /** * Review the lesson. * - * @param {number} pageId Page to load. + * @param pageId Page to load. */ reviewLesson(pageId: number): void { this.loaded = false; @@ -622,7 +622,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy { /** * Submit a question. * - * @param {Event} e Event. + * @param e Event. */ submitQuestion(e: Event): void { e.preventDefault(); diff --git a/src/addon/mod/lesson/pages/user-retake/user-retake.ts b/src/addon/mod/lesson/pages/user-retake/user-retake.ts index 394f78176..48a8ff7e9 100644 --- a/src/addon/mod/lesson/pages/user-retake/user-retake.ts +++ b/src/addon/mod/lesson/pages/user-retake/user-retake.ts @@ -72,7 +72,7 @@ export class AddonModLessonUserRetakePage implements OnInit { /** * Change the retake displayed. * - * @param {number} retakeNumber The new retake number. + * @param retakeNumber The new retake number. */ changeRetake(retakeNumber: number): void { this.loaded = false; @@ -88,7 +88,7 @@ export class AddonModLessonUserRetakePage implements OnInit { /** * Pull to refresh. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ doRefresh(refresher: any): void { this.refreshData().finally(() => { @@ -99,7 +99,7 @@ export class AddonModLessonUserRetakePage implements OnInit { /** * Get lesson and retake data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchData(): Promise { return this.lessonProvider.getLessonById(this.courseId, this.lessonId).then((lessonData) => { @@ -166,7 +166,7 @@ export class AddonModLessonUserRetakePage implements OnInit { /** * Refreshes data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected refreshData(): Promise { const promises = []; @@ -187,8 +187,8 @@ export class AddonModLessonUserRetakePage implements OnInit { /** * Set the retake to view and load its data. * - * @param {number}retakeNumber Retake number to set. - * @return {Promise} Promise resolved when done. + * @param retakeNumber Retake number to set. + * @return Promise resolved when done. */ protected setRetake(retakeNumber: number): Promise { this.selectedRetake = retakeNumber; diff --git a/src/addon/mod/lesson/providers/grade-link-handler.ts b/src/addon/mod/lesson/providers/grade-link-handler.ts index f76eb8b52..27bf35d6e 100644 --- a/src/addon/mod/lesson/providers/grade-link-handler.ts +++ b/src/addon/mod/lesson/providers/grade-link-handler.ts @@ -39,12 +39,12 @@ export class AddonModLessonGradeLinkHandler extends CoreContentLinksModuleGradeH /** * Go to the page to review. * - * @param {string} url The URL to treat. - * @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @param {number} courseId Course ID related to the URL. - * @param {string} siteId Site to use. - * @param {NavController} [navCtrl] Nav Controller to use to navigate. - * @return {Promise} Promise resolved when done. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. + * @param siteId Site to use. + * @param navCtrl Nav Controller to use to navigate. + * @return Promise resolved when done. */ protected goToReview(url: string, params: any, courseId: number, siteId: string, navCtrl?: NavController): Promise { @@ -83,11 +83,11 @@ export class AddonModLessonGradeLinkHandler extends CoreContentLinksModuleGradeH * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return this.lessonProvider.isPluginEnabled(); diff --git a/src/addon/mod/lesson/providers/helper.ts b/src/addon/mod/lesson/providers/helper.ts index 234c0fd45..0fadbf3f5 100644 --- a/src/addon/mod/lesson/providers/helper.ts +++ b/src/addon/mod/lesson/providers/helper.ts @@ -33,8 +33,8 @@ export class AddonModLessonHelperProvider { /** * Given the HTML of next activity link, format it to extract the href and the text. * - * @param {string} activityLink HTML of the activity link. - * @return {{formatted: boolean, label: string, href: string}} Formatted data. + * @param activityLink HTML of the activity link. + * @return Formatted data. */ formatActivityLink(activityLink: string): {formatted: boolean, label: string, href: string} { const element = this.domUtils.convertToElement(activityLink), @@ -59,8 +59,8 @@ export class AddonModLessonHelperProvider { /** * Given the HTML of an answer from a content page, extract the data to render the answer. * - * @param {String} html Answer's HTML. - * @return {{buttonText: string, content: string}} Data to render the answer. + * @param html Answer's HTML. + * @return Data to render the answer. */ getContentPageAnswerDataFromHtml(html: string): {buttonText: string, content: string} { const data = { @@ -86,8 +86,8 @@ export class AddonModLessonHelperProvider { /** * Get the buttons to change pages. * - * @param {string} html Page's HTML. - * @return {any[]} List of buttons. + * @param html Page's HTML. + * @return List of buttons. */ getPageButtonsFromHtml(html: string): any[] { const buttons = [], @@ -138,8 +138,8 @@ export class AddonModLessonHelperProvider { /** * Given a page data (result of getPageData), get the page contents. * - * @param {any} data Page data. - * @return {string} Page contents. + * @param data Page data. + * @return Page contents. */ getPageContentsFromPageData(data: any): string { // Search the page contents inside the whole page HTML. Use data.pagecontent because it's filtered. @@ -164,9 +164,9 @@ export class AddonModLessonHelperProvider { /** * Get a question and all the data required to render it from the page data (result of AddonModLessonProvider.getPageData). * - * @param {FormGroup} questionForm The form group where to add the controls. - * @param {any} pageData Page data (result of $mmaModLesson#getPageData). - * @return {any} Question data. + * @param questionForm The form group where to add the controls. + * @param pageData Page data (result of $mmaModLesson#getPageData). + * @return Question data. */ getQuestionFromPageData(questionForm: FormGroup, pageData: any): any { const question: any = {}, @@ -359,9 +359,9 @@ export class AddonModLessonHelperProvider { /** * Given the HTML of an answer from a question page, extract the data to render the answer. * - * @param {string} html Answer's HTML. - * @return {any} Object with the data to render the answer. If the answer doesn't require any parsing, return a string with - * the HTML. + * @param html Answer's HTML. + * @return Object with the data to render the answer. If the answer doesn't require any parsing, return a string with + * the HTML. */ getQuestionPageAnswerDataFromHtml(html: string): any { const data: any = {}, @@ -419,9 +419,9 @@ export class AddonModLessonHelperProvider { /** * Get a label to identify a retake (lesson attempt). * - * @param {any} retake Retake object. - * @param {boolean} [includeDuration] Whether to include the duration of the retake. - * @return {string} Retake label. + * @param retake Retake object. + * @param includeDuration Whether to include the duration of the retake. + * @return Retake label. */ getRetakeLabel(retake: any, includeDuration?: boolean): string { const data = { @@ -455,9 +455,9 @@ export class AddonModLessonHelperProvider { /** * Prepare the question data to be sent to server. * - * @param {any} question Question to prepare. - * @param {any} data Data to prepare. - * @return {any} Data to send. + * @param question Question to prepare. + * @param data Data to prepare. + * @return Data to send. */ prepareQuestionData(question: any, data: any): any { if (question.template == 'essay' && question.textarea) { @@ -478,8 +478,8 @@ export class AddonModLessonHelperProvider { /** * Given the feedback of a process page in HTML, remove the question text. * - * @param {string} html Feedback's HTML. - * @return {string} Feedback without the question text. + * @param html Feedback's HTML. + * @return Feedback without the question text. */ removeQuestionFromFeedback(html: string): string { const element = this.domUtils.convertToElement(html); diff --git a/src/addon/mod/lesson/providers/index-link-handler.ts b/src/addon/mod/lesson/providers/index-link-handler.ts index 16d77cd6e..6228dcbf4 100644 --- a/src/addon/mod/lesson/providers/index-link-handler.ts +++ b/src/addon/mod/lesson/providers/index-link-handler.ts @@ -36,11 +36,11 @@ export class AddonModLessonIndexLinkHandler extends CoreContentLinksModuleIndexH /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -65,11 +65,11 @@ export class AddonModLessonIndexLinkHandler extends CoreContentLinksModuleIndexH * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return this.lessonProvider.isPluginEnabled(); @@ -78,12 +78,12 @@ export class AddonModLessonIndexLinkHandler extends CoreContentLinksModuleIndexH /** * Navigate to a lesson module (index page) with a fixed password. * - * @param {number} moduleId Module ID. - * @param {number} courseId Course ID. - * @param {string} password Password. - * @param {string} siteId Site ID. - * @param {NavController} navCtrl Navigation controller. - * @return {Promise} Promise resolved when navigated. + * @param moduleId Module ID. + * @param courseId Course ID. + * @param password Password. + * @param siteId Site ID. + * @param navCtrl Navigation controller. + * @return Promise resolved when navigated. */ protected navigateToModuleWithPassword(moduleId: number, courseId: number, password: string, siteId: string, navCtrl?: NavController): Promise { diff --git a/src/addon/mod/lesson/providers/lesson-offline.ts b/src/addon/mod/lesson/providers/lesson-offline.ts index 1d7882461..7cfc872fb 100644 --- a/src/addon/mod/lesson/providers/lesson-offline.ts +++ b/src/addon/mod/lesson/providers/lesson-offline.ts @@ -138,12 +138,12 @@ export class AddonModLessonOfflineProvider { /** * Delete an offline attempt. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Lesson retake number. - * @param {number} pageId Page ID. - * @param {number} timemodified The timemodified of the attempt. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param lessonId Lesson ID. + * @param retake Lesson retake number. + * @param pageId Page ID. + * @param timemodified The timemodified of the attempt. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ deleteAttempt(lessonId: number, retake: number, pageId: number, timemodified: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -159,9 +159,9 @@ export class AddonModLessonOfflineProvider { /** * Delete offline lesson retake. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ deleteRetake(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -172,11 +172,11 @@ export class AddonModLessonOfflineProvider { /** * Delete offline attempts for a retake and page. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Lesson retake number. - * @param {number} pageId Page ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param lessonId Lesson ID. + * @param retake Lesson retake number. + * @param pageId Page ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ deleteRetakeAttemptsForPage(lessonId: number, retake: number, pageId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -188,13 +188,13 @@ export class AddonModLessonOfflineProvider { /** * Mark a retake as finished. * - * @param {number} lessonId Lesson ID. - * @param {number} courseId Course ID the lesson belongs to. - * @param {number} retake Retake number. - * @param {boolean} finished Whether retake is finished. - * @param {boolean} outOfTime If the user ran out of time. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success, rejected otherwise. + * @param lessonId Lesson ID. + * @param courseId Course ID the lesson belongs to. + * @param retake Retake number. + * @param finished Whether retake is finished. + * @param outOfTime If the user ran out of time. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success, rejected otherwise. */ finishRetake(lessonId: number, courseId: number, retake: number, finished?: boolean, outOfTime?: boolean, siteId?: string) : Promise { @@ -214,8 +214,8 @@ export class AddonModLessonOfflineProvider { /** * Get all the offline page attempts in a certain site. * - * @param {string} [siteId] Site ID. If not set, use current site. - * @return {Promise} Promise resolved when the offline attempts are retrieved. + * @param siteId Site ID. If not set, use current site. + * @return Promise resolved when the offline attempts are retrieved. */ getAllAttempts(siteId?: string): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -228,8 +228,8 @@ export class AddonModLessonOfflineProvider { /** * Get all the lessons that have offline data in a certain site. * - * @param {string} [siteId] Site ID. If not set, use current site. - * @return {Promise} Promise resolved with an object containing the lessons. + * @param siteId Site ID. If not set, use current site. + * @return Promise resolved with an object containing the lessons. */ getAllLessonsWithData(siteId?: string): Promise { const promises = [], @@ -257,8 +257,8 @@ export class AddonModLessonOfflineProvider { /** * Get all the offline retakes in a certain site. * - * @param {string} [siteId] Site ID. If not set, use current site. - * @return {Promise} Promise resolved when the offline retakes are retrieved. + * @param siteId Site ID. If not set, use current site. + * @return Promise resolved when the offline retakes are retrieved. */ getAllRetakes(siteId?: string): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -269,10 +269,10 @@ export class AddonModLessonOfflineProvider { /** * Retrieve the last offline attempt stored in a retake. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the attempt (undefined if no attempts). + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the attempt (undefined if no attempts). */ getLastQuestionPageAttempt(lessonId: number, retake: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -297,9 +297,9 @@ export class AddonModLessonOfflineProvider { /** * Retrieve all offline attempts for a lesson. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the attempts. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the attempts. */ getLessonAttempts(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -312,8 +312,8 @@ export class AddonModLessonOfflineProvider { /** * Given a list of DB entries (either retakes or page attempts), get the list of lessons. * - * @param {any} lessons Object where to store the lessons. - * @param {any[]} entries List of DB entries. + * @param lessons Object where to store the lessons. + * @param entries List of DB entries. */ protected getLessonsFromEntries(lessons: any, entries: any[]): void { entries.forEach((entry) => { @@ -329,12 +329,12 @@ export class AddonModLessonOfflineProvider { /** * Get attempts for question pages and retake in a lesson. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {boolean} [correct] True to only fetch correct attempts, false to get them all. - * @param {number} [pageId] If defined, only get attempts on this page. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the attempts. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param correct True to only fetch correct attempts, false to get them all. + * @param pageId If defined, only get attempts on this page. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the attempts. */ getQuestionsAttempts(lessonId: number, retake: number, correct?: boolean, pageId?: number, siteId?: string): Promise { let promise; @@ -361,9 +361,9 @@ export class AddonModLessonOfflineProvider { /** * Retrieve a retake from site DB. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the retake. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the retake. */ getRetake(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -374,10 +374,10 @@ export class AddonModLessonOfflineProvider { /** * Retrieve all offline attempts for a retake. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the retake attempts. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the retake attempts. */ getRetakeAttempts(lessonId: number, retake: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -390,11 +390,11 @@ export class AddonModLessonOfflineProvider { /** * Retrieve offline attempts for a retake and page. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Lesson retake number. - * @param {number} pageId Page ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the retake attempts. + * @param lessonId Lesson ID. + * @param retake Lesson retake number. + * @param pageId Page ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the retake attempts. */ getRetakeAttemptsForPage(lessonId: number, retake: number, pageId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -408,11 +408,11 @@ export class AddonModLessonOfflineProvider { /** * Retrieve offline attempts for certain pages for a retake. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {number} type Type of the pages to get: TYPE_QUESTION or TYPE_STRUCTURE. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the retake attempts. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param type Type of the pages to get: TYPE_QUESTION or TYPE_STRUCTURE. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the retake attempts. */ getRetakeAttemptsForType(lessonId: number, retake: number, type: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -426,11 +426,11 @@ export class AddonModLessonOfflineProvider { /** * Get stored retake. If not found or doesn't match the retake number, return a new one. * - * @param {number} lessonId Lesson ID. - * @param {number} courseId Course ID the lesson belongs to. - * @param {number} retake Retake number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the retake. + * @param lessonId Lesson ID. + * @param courseId Course ID the lesson belongs to. + * @param retake Retake number. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the retake. */ protected getRetakeWithFallback(lessonId: number, courseId: number, retake: number, siteId?: string): Promise { // Get current stored retake. @@ -455,9 +455,9 @@ export class AddonModLessonOfflineProvider { /** * Check if there is a finished retake for a certain lesson. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean. */ hasFinishedRetake(lessonId: number, siteId?: string): Promise { return this.getRetake(lessonId, siteId).then((retake) => { @@ -470,9 +470,9 @@ export class AddonModLessonOfflineProvider { /** * Check if a lesson has offline data. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean. */ hasOfflineData(lessonId: number, siteId?: string): Promise { const promises = []; @@ -498,10 +498,10 @@ export class AddonModLessonOfflineProvider { /** * Check if there are offline attempts for a retake. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with a boolean. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with a boolean. */ hasRetakeAttempts(lessonId: number, retake: number, siteId?: string): Promise { return this.getRetakeAttempts(lessonId, retake, siteId).then((list) => { @@ -514,8 +514,8 @@ export class AddonModLessonOfflineProvider { /** * Parse some properties of a page attempt. * - * @param {any} attempt The attempt to treat. - * @return {any} The treated attempt. + * @param attempt The attempt to treat. + * @return The treated attempt. */ protected parsePageAttempt(attempt: any): any { attempt.data = this.textUtils.parseJSON(attempt.data); @@ -527,8 +527,8 @@ export class AddonModLessonOfflineProvider { /** * Parse some properties of some page attempts. * - * @param {any[]} attempts The attempts to treat. - * @return {any[]} The treated attempts. + * @param attempts The attempts to treat. + * @return The treated attempts. */ protected parsePageAttempts(attempts: any[]): any[] { attempts.forEach((attempt) => { @@ -541,17 +541,17 @@ export class AddonModLessonOfflineProvider { /** * Process a lesson page, saving its data. * - * @param {number} lessonId Lesson ID. - * @param {number} courseId Course ID the lesson belongs to. - * @param {number} retake Retake number. - * @param {any} page Page. - * @param {any} data Data to save. - * @param {number} newPageId New page ID (calculated). - * @param {number} [answerId] The answer ID that the user answered. - * @param {boolean} [correct] If answer is correct. Only for question pages. - * @param {any} [userAnswer] The user's answer (userresponse from checkAnswer). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success, rejected otherwise. + * @param lessonId Lesson ID. + * @param courseId Course ID the lesson belongs to. + * @param retake Retake number. + * @param page Page. + * @param data Data to save. + * @param newPageId New page ID (calculated). + * @param answerId The answer ID that the user answered. + * @param correct If answer is correct. Only for question pages. + * @param userAnswer The user's answer (userresponse from checkAnswer). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success, rejected otherwise. */ processPage(lessonId: number, courseId: number, retake: number, page: any, data: any, newPageId: number, answerId?: number, correct?: boolean, userAnswer?: any, siteId?: string): Promise { @@ -583,12 +583,12 @@ export class AddonModLessonOfflineProvider { /** * Set the last question page attempted in a retake. * - * @param {number} lessonId Lesson ID. - * @param {number} courseId Course ID the lesson belongs to. - * @param {number} retake Retake number. - * @param {number} lastPage ID of the last question page attempted. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success, rejected otherwise. + * @param lessonId Lesson ID. + * @param courseId Course ID the lesson belongs to. + * @param retake Retake number. + * @param lastPage ID of the last question page attempted. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success, rejected otherwise. */ setLastQuestionPageAttempted(lessonId: number, courseId: number, retake: number, lastPage: number, siteId?: string) : Promise { diff --git a/src/addon/mod/lesson/providers/lesson-sync.ts b/src/addon/mod/lesson/providers/lesson-sync.ts index 1a1abdaf6..d17c76200 100644 --- a/src/addon/mod/lesson/providers/lesson-sync.ts +++ b/src/addon/mod/lesson/providers/lesson-sync.ts @@ -37,13 +37,11 @@ import { AddonModLessonPrefetchHandler } from './prefetch-handler'; export interface AddonModLessonSyncResult { /** * List of warnings. - * @type {string[]} */ warnings: string[]; /** * Whether some data was sent to the server or offline data was updated. - * @type {boolean} */ updated: boolean; } @@ -108,9 +106,9 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid /** * Unmark a retake as finished in a synchronization. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ deleteRetakeFinishedInSync(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -123,9 +121,9 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid /** * Get a retake finished in a synchronization for a certain lesson (if any). * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the retake entry (undefined if no retake). + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the retake entry (undefined if no retake). */ getRetakeFinishedInSync(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -138,10 +136,10 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid /** * Check if a lesson has data to synchronize. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether it has data to sync. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether it has data to sync. */ hasDataToSync(lessonId: number, retake: number, siteId?: string): Promise { const promises = []; @@ -165,11 +163,11 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid /** * Mark a retake as finished in a synchronization. * - * @param {number} lessonId Lesson ID. - * @param {number} retake The retake number. - * @param {number} pageId The page ID to start reviewing from. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param lessonId Lesson ID. + * @param retake The retake number. + * @param pageId The page ID to start reviewing from. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ setRetakeFinishedInSync(lessonId: number, retake: number, pageId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -185,9 +183,9 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid /** * Try to synchronize all the lessons in a certain site or in all sites. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncAllLessons(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all lessons', this.syncAllLessonsFunc.bind(this), [force], siteId); @@ -196,9 +194,9 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid /** * Sync all lessons on a site. * - * @param {string} siteId Site ID to sync. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @param {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. + * @param force Wether to force sync not depending on last execution. + * @param Promise resolved if sync is successful, rejected if sync fails. */ protected syncAllLessonsFunc(siteId: string, force?: boolean): Promise { // Get all the lessons that have something to be synchronized. @@ -228,10 +226,10 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid /** * Sync a lesson only if a certain time has passed since the last time. * - * @param {any} lessonId Lesson ID. - * @param {boolean} [askPreflight] Whether we should ask for password if needed. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the lesson is synced or if it doesn't need to be synced. + * @param lessonId Lesson ID. + * @param askPreflight Whether we should ask for password if needed. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the lesson is synced or if it doesn't need to be synced. */ syncLessonIfNeeded(lessonId: number, askPassword?: boolean, siteId?: string): Promise { return this.isSyncNeeded(lessonId, siteId).then((needed) => { @@ -244,11 +242,11 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid /** * Try to synchronize a lesson. * - * @param {number} lessonId Lesson ID. - * @param {boolean} askPassword True if we should ask for password if needed, false otherwise. - * @param {boolean} ignoreBlock True to ignore the sync block setting. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success. + * @param lessonId Lesson ID. + * @param askPassword True if we should ask for password if needed, false otherwise. + * @param ignoreBlock True to ignore the sync block setting. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success. */ syncLesson(lessonId: number, askPassword?: boolean, ignoreBlock?: boolean, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -458,12 +456,12 @@ export class AddonModLessonSyncProvider extends CoreCourseActivitySyncBaseProvid /** * Send an attempt to the site and delete it afterwards. * - * @param {any} lesson Lesson. - * @param {string} password Password (if any). - * @param {any} attempt Attempt to send. - * @param {AddonModLessonSyncResult} result Result where to store the data. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param lesson Lesson. + * @param password Password (if any). + * @param attempt Attempt to send. + * @param result Result where to store the data. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ protected sendAttempt(lesson: any, password: string, attempt: any, result: AddonModLessonSyncResult, siteId?: string) : Promise { diff --git a/src/addon/mod/lesson/providers/lesson.ts b/src/addon/mod/lesson/providers/lesson.ts index 72feffd7f..69f5daca7 100644 --- a/src/addon/mod/lesson/providers/lesson.ts +++ b/src/addon/mod/lesson/providers/lesson.ts @@ -58,43 +58,36 @@ export interface AddonModLessonRecordAttemptResult extends AddonModLessonCheckAn export interface AddonModLessonGrade { /** * Number of questions answered. - * @type {number} */ nquestions: number; /** * Number of question attempts. - * @type {number} */ attempts: number; /** * Max points possible. - * @type {number} */ total: number; /** * Points earned by the student. - * @type {number} */ earned: number; /** * Calculated percentage grade. - * @type {number} */ grade: number; /** * Numer of manually graded questions. - * @type {number} */ nmanual: number; /** * Point value for manually graded questions. - * @type {number} */ manualpoints: number; } @@ -200,12 +193,12 @@ export class AddonModLessonProvider { /** * Add an answer and its response to a feedback string (HTML). * - * @param {string} feedback The current feedback. - * @param {string} answer Student answer. - * @param {number} answerFormat Answer format. - * @param {string} response Response. - * @param {string} className Class to add to the response. - * @return {string} New feedback. + * @param feedback The current feedback. + * @param answer Student answer. + * @param answerFormat Answer format. + * @param response Response. + * @param className Class to add to the response. + * @return New feedback. */ protected addAnswerAndResponseToFeedback(feedback: string, answer: string, answerFormat: number, response: string, className: string): string { @@ -229,9 +222,9 @@ export class AddonModLessonProvider { /** * Add a message to a list of messages, following the format of the messages returned by WS. * - * @param {any[]} messages List of messages where to add the message. - * @param {string} stringName The ID of the message to be translated. E.g. 'addon.mod_lesson.numberofpagesviewednotice'. - * @param {any} [stringParams] The params of the message (if any). + * @param messages List of messages where to add the message. + * @param stringName The ID of the message to be translated. E.g. 'addon.mod_lesson.numberofpagesviewednotice'. + * @param stringParams The params of the message (if any). */ protected addMessage(messages: any[], stringName: string, stringParams?: any): void { messages.push({ @@ -242,10 +235,10 @@ export class AddonModLessonProvider { /** * Add a property to the result of the "process EOL page" simulation in offline. * - * @param {any} result Result where to add the value. - * @param {string} name Name of the property. - * @param {any} value Value to add. - * @param {boolean} addMessage Whether to add a message related to the value. + * @param result Result where to add the value. + * @param name Name of the property. + * @param value Value to add. + * @param addMessage Whether to add a message related to the value. */ protected addResultValueEolPage(result: any, name: string, value: any, addMessage?: boolean): void { let message = ''; @@ -265,8 +258,8 @@ export class AddonModLessonProvider { /** * Check if an answer page (from getUserRetake) is a content page. * - * @param {any} page Answer page. - * @return {boolean} Whether it's a content page. + * @param page Answer page. + * @return Whether it's a content page. */ answerPageIsContent(page: any): boolean { // The page doesn't have any reliable field to use for checking this. Check qtype first (translated string). @@ -291,8 +284,8 @@ export class AddonModLessonProvider { /** * Check if an answer page (from getUserRetake) is a question page. * - * @param {any} page Answer page. - * @return {boolean} Whether it's a question page. + * @param page Answer page. + * @return Whether it's a question page. */ answerPageIsQuestion(page: any): boolean { if (!page.answerdata) { @@ -320,13 +313,13 @@ export class AddonModLessonProvider { /** * Calculate some offline data like progress and ongoingscore. * - * @param {any} lesson Lesson. - * @param {any} accessInfo Result of get access info. - * @param {string} [password] Lesson password (if any). - * @param {boolean} [review] If the user wants to review just after finishing (1 hour margin). - * @param {any} [pageIndex] Object containing all the pages indexed by ID. If not defined, it will be calculated. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise<{reviewmode: boolean, progress: number, ongoingscore: string}>} Promise resolved with the data. + * @param lesson Lesson. + * @param accessInfo Result of get access info. + * @param password Lesson password (if any). + * @param review If the user wants to review just after finishing (1 hour margin). + * @param pageIndex Object containing all the pages indexed by ID. If not defined, it will be calculated. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the data. */ protected calculateOfflineData(lesson: any, accessInfo?: any, password?: string, review?: boolean, pageIndex?: any, siteId?: string): Promise<{reviewmode: boolean, progress: number, ongoingscore: string}> { @@ -365,13 +358,13 @@ export class AddonModLessonProvider { * Calculate the progress of the current user in the lesson. * Based on Moodle's calculate_progress. * - * @param {number} lessonId Lesson ID. - * @param {any} accessInfo Result of get access info. - * @param {string} [password] Lesson password (if any). - * @param {boolean} [review] If the user wants to review just after finishing (1 hour margin). - * @param {any} [pageIndex] Object containing all the pages indexed by ID. If not defined, it will be calculated. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with a number: the progress (scale 0-100). + * @param lessonId Lesson ID. + * @param accessInfo Result of get access info. + * @param password Lesson password (if any). + * @param review If the user wants to review just after finishing (1 hour margin). + * @param pageIndex Object containing all the pages indexed by ID. If not defined, it will be calculated. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with a number: the progress (scale 0-100). */ calculateProgress(lessonId: number, accessInfo: any, password?: string, review?: boolean, pageIndex?: any, siteId?: string) : Promise { @@ -429,12 +422,12 @@ export class AddonModLessonProvider { * Check if the answer provided by the user is correct or not and return the result object. * This method is based on the check_answer implementation of all page types (Moodle). * - * @param {any} lesson Lesson. - * @param {any} pageData Result of getPageData for the page to process. - * @param {any} data Data containing the user answer. - * @param {any} jumps Result of get pages possible jumps. - * @param {any} pageIndex Object containing all the pages indexed by ID. - * @return {AddonModLessonCheckAnswerResult} Result. + * @param lesson Lesson. + * @param pageData Result of getPageData for the page to process. + * @param data Data containing the user answer. + * @param jumps Result of get pages possible jumps. + * @param pageIndex Object containing all the pages indexed by ID. + * @return Result. */ protected checkAnswer(lesson: any, pageData: any, data: any, jumps: any, pageIndex: any): AddonModLessonCheckAnswerResult { // Default result. @@ -492,9 +485,9 @@ export class AddonModLessonProvider { /** * Check an essay answer. * - * @param {any} pageData Result of getPageData for the page to process. - * @param {any} data Data containing the user answer. - * @param {AddonModLessonCheckAnswerResult} result Object where to store the result. + * @param pageData Result of getPageData for the page to process. + * @param data Data containing the user answer. + * @param result Object where to store the result. */ protected checkAnswerEssay(pageData: any, data: any, result: AddonModLessonCheckAnswerResult): void { let studentAnswer; @@ -549,9 +542,9 @@ export class AddonModLessonProvider { /** * Check a matching answer. * - * @param {any} pageData Result of getPageData for the page to process. - * @param {any} data Data containing the user answer. - * @param {AddonModLessonCheckAnswerResult} result Object where to store the result. + * @param pageData Result of getPageData for the page to process. + * @param data Data containing the user answer. + * @param result Object where to store the result. */ protected checkAnswerMatching(pageData: any, data: any, result: AddonModLessonCheckAnswerResult): void { if (!data) { @@ -620,11 +613,11 @@ export class AddonModLessonProvider { /** * Check a multichoice answer. * - * @param {any} lesson Lesson. - * @param {any} pageData Result of getPageData for the page to process. - * @param {any} data Data containing the user answer. - * @param {any} pageIndex Object containing all the pages indexed by ID. - * @param {AddonModLessonCheckAnswerResult} result Object where to store the result. + * @param lesson Lesson. + * @param pageData Result of getPageData for the page to process. + * @param data Data containing the user answer. + * @param pageIndex Object containing all the pages indexed by ID. + * @param result Object where to store the result. */ protected checkAnswerMultichoice(lesson: any, pageData: any, data: any, pageIndex: any, result: AddonModLessonCheckAnswerResult): void { @@ -751,11 +744,11 @@ export class AddonModLessonProvider { /** * Check a numerical answer. * - * @param {any} lesson Lesson. - * @param {any} pageData Result of getPageData for the page to process. - * @param {any} data Data containing the user answer. - * @param {any} pageIndex Object containing all the pages indexed by ID. - * @param {any} result Object where to store the result. + * @param lesson Lesson. + * @param pageData Result of getPageData for the page to process. + * @param data Data containing the user answer. + * @param pageIndex Object containing all the pages indexed by ID. + * @param result Object where to store the result. */ protected checkAnswerNumerical(lesson: any, pageData: any, data: any, pageIndex: any, result: AddonModLessonCheckAnswerResult) : void { @@ -807,11 +800,11 @@ export class AddonModLessonProvider { /** * Check a short answer. * - * @param {any} lesson Lesson. - * @param {any} pageData Result of getPageData for the page to process. - * @param {any} data Data containing the user answer. - * @param {any} pageIndex Object containing all the pages indexed by ID. - * @param {any} result Object where to store the result. + * @param lesson Lesson. + * @param pageData Result of getPageData for the page to process. + * @param data Data containing the user answer. + * @param pageIndex Object containing all the pages indexed by ID. + * @param result Object where to store the result. */ protected checkAnswerShort(lesson: any, pageData: any, data: any, pageIndex: any, result: AddonModLessonCheckAnswerResult) : void { @@ -925,11 +918,11 @@ export class AddonModLessonProvider { /** * Check a truefalse answer. * - * @param {any} lesson Lesson. - * @param {any} pageData Result of getPageData for the page to process. - * @param {any} data Data containing the user answer. - * @param {any} pageIndex Object containing all the pages indexed by ID. - * @param {any} result Object where to store the result. + * @param lesson Lesson. + * @param pageData Result of getPageData for the page to process. + * @param data Data containing the user answer. + * @param pageIndex Object containing all the pages indexed by ID. + * @param result Object where to store the result. */ protected checkAnswerTruefalse(lesson: any, pageData: any, data: any, pageIndex: any, result: AddonModLessonCheckAnswerResult) : void { @@ -959,9 +952,9 @@ export class AddonModLessonProvider { /** * Check the "other answers" value. * - * @param {any} lesson Lesson. - * @param {any} pageData Result of getPageData for the page to process. - * @param {AddonModLessonCheckAnswerResult} result Object where to store the result. + * @param lesson Lesson. + * @param pageData Result of getPageData for the page to process. + * @param result Object where to store the result. */ protected checkOtherAnswers(lesson: any, pageData: any, result: AddonModLessonCheckAnswerResult): void { // We could check here to see if we have a wrong answer jump to use. @@ -986,8 +979,8 @@ export class AddonModLessonProvider { /** * Create a list of pages indexed by page ID based on a list of pages. * - * @param {Object[]} pageList Result of get pages. - * @return {any} Pages index. + * @param pageList Result of get pages. + * @return Pages index. */ protected createPagesIndex(pageList: any[]): any { // Index the pages by page ID. @@ -1003,15 +996,15 @@ export class AddonModLessonProvider { /** * Finishes a retake. * - * @param {any} lesson Lesson. - * @param {number} courseId Course ID the lesson belongs to. - * @param {string} [password] Lesson password (if any). - * @param {boolean} [outOfTime] If the user ran out of time. - * @param {boolean} [review] If the user wants to review just after finishing (1 hour margin). - * @param {boolean} [offline] Whether it's offline mode. - * @param {any} [accessInfo] Result of get access info. Required if offline is true. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success, rejected otherwise. + * @param lesson Lesson. + * @param courseId Course ID the lesson belongs to. + * @param password Lesson password (if any). + * @param outOfTime If the user ran out of time. + * @param review If the user wants to review just after finishing (1 hour margin). + * @param offline Whether it's offline mode. + * @param accessInfo Result of get access info. Required if offline is true. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success, rejected otherwise. */ finishRetake(lesson: any, courseId: number, password?: string, outOfTime?: boolean, review?: boolean, offline?: boolean, accessInfo?: any, siteId?: string): Promise { @@ -1144,12 +1137,12 @@ export class AddonModLessonProvider { /** * Finishes a retake. It will fail if offline or cannot connect. * - * @param {number} lessonId Lesson ID. - * @param {string} [password] Lesson password (if any). - * @param {boolean} [outOfTime] If the user ran out of time. - * @param {boolean} [review] If the user wants to review just after finishing (1 hour margin). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success, rejected otherwise. + * @param lessonId Lesson ID. + * @param password Lesson password (if any). + * @param outOfTime If the user ran out of time. + * @param review If the user wants to review just after finishing (1 hour margin). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success, rejected otherwise. */ finishRetakeOnline(lessonId: number, password?: string, outOfTime?: boolean, review?: boolean, siteId?: string): Promise { @@ -1186,11 +1179,11 @@ export class AddonModLessonProvider { /** * Get the access information of a certain lesson. * - * @param {number} lessonId Lesson ID. - * @param {boolean} [forceCache] Whether it should always return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the access information. + * @param lessonId Lesson ID. + * @param forceCache Whether it should always return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the access information. */ getAccessInformation(lessonId: number, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1215,8 +1208,8 @@ export class AddonModLessonProvider { /** * Get cache key for access information WS calls. * - * @param {number} lessonId Lesson ID. - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @return Cache key. */ protected getAccessInformationCacheKey(lessonId: number): string { return this.ROOT_CACHE_KEY + 'accessInfo:' + lessonId; @@ -1225,10 +1218,10 @@ export class AddonModLessonProvider { /** * Get content pages viewed in online and offline. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise<{online: any[], offline: any[]}>} Promise resolved with an object with the online and offline viewed pages. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with an object with the online and offline viewed pages. */ getContentPagesViewed(lessonId: number, retake: number, siteId?: string): Promise<{online: any[], offline: any[]}> { const promises = [], @@ -1258,9 +1251,9 @@ export class AddonModLessonProvider { /** * Get cache key for get content pages viewed WS calls. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @return Cache key. */ protected getContentPagesViewedCacheKey(lessonId: number, retake: number): string { return this.getContentPagesViewedCommonCacheKey(lessonId) + ':' + retake; @@ -1269,8 +1262,8 @@ export class AddonModLessonProvider { /** * Get common cache key for get content pages viewed WS calls. * - * @param {number} lessonId Lesson ID. - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @return Cache key. */ protected getContentPagesViewedCommonCacheKey(lessonId: number): string { return this.ROOT_CACHE_KEY + 'contentPagesViewed:' + lessonId; @@ -1279,10 +1272,10 @@ export class AddonModLessonProvider { /** * Get IDS of content pages viewed in online and offline. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with list of IDs. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with list of IDs. */ getContentPagesViewedIds(lessonId: number, retake: number, siteId?: string): Promise { return this.getContentPagesViewed(lessonId, retake, siteId).then((result) => { @@ -1304,12 +1297,12 @@ export class AddonModLessonProvider { /** * Get the list of content pages viewed in the site for a certain retake. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {boolean} [forceCache] Whether it should always return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the viewed pages. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param forceCache Whether it should always return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the viewed pages. */ getContentPagesViewedOnline(lessonId: number, retake: number, forceCache?: boolean, ignoreCache?: boolean, siteId?: string) : Promise { @@ -1339,10 +1332,10 @@ export class AddonModLessonProvider { /** * Get the last content page viewed. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the last content page viewed. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the last content page viewed. */ getLastContentPageViewed(lessonId: number, retake: number, siteId?: string): Promise { return this.getContentPagesViewed(lessonId, retake, siteId).then((data) => { @@ -1373,10 +1366,10 @@ export class AddonModLessonProvider { * Get the last page seen. * Based on Moodle's get_last_page_seen. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the last page seen. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the last page seen. */ getLastPageSeen(lessonId: number, retake: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -1411,12 +1404,12 @@ export class AddonModLessonProvider { /** * Get a Lesson by module ID. * - * @param {number} courseId Course ID. - * @param {number} cmid Course module ID. - * @param {boolean} [forceCache] Whether it should always return cached data. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the lesson is retrieved. + * @param courseId Course ID. + * @param cmid Course module ID. + * @param forceCache Whether it should always return cached data. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the lesson is retrieved. */ getLesson(courseId: number, cmId: number, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise { return this.getLessonByField(courseId, 'coursemodule', cmId, forceCache, ignoreCache, siteId); @@ -1425,13 +1418,13 @@ export class AddonModLessonProvider { /** * Get a Lesson with key=value. If more than one is found, only the first will be returned. * - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {boolean} [forceCache] Whether it should always return cached data. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the lesson is retrieved. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param forceCache Whether it should always return cached data. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the lesson is retrieved. */ protected getLessonByField(courseId: number, key: string, value: any, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise { @@ -1471,12 +1464,12 @@ export class AddonModLessonProvider { /** * Get a Lesson by lesson ID. * - * @param {number} courseId Course ID. - * @param {number} id Lesson ID. - * @param {boolean} [forceCache] Whether it should always return cached data. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the lesson is retrieved. + * @param courseId Course ID. + * @param id Lesson ID. + * @param forceCache Whether it should always return cached data. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the lesson is retrieved. */ getLessonById(courseId: number, id: number, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise { return this.getLessonByField(courseId, 'id', id, forceCache, ignoreCache, siteId); @@ -1485,8 +1478,8 @@ export class AddonModLessonProvider { /** * Get cache key for Lesson data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getLessonDataCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'lesson:' + courseId; @@ -1495,14 +1488,14 @@ export class AddonModLessonProvider { /** * Get a lesson protected with password. * - * @param {number} lessonId Lesson ID. - * @param {string} [password] Password. - * @param {boolean} [validatePassword=true] If true, the function will fail if the password is wrong. - * If false, it will return a lesson with the basic data if password is wrong. - * @param {boolean} [forceCache] Whether it should always return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the lesson. + * @param lessonId Lesson ID. + * @param password Password. + * @param validatePassword If true, the function will fail if the password is wrong. + * If false, it will return a lesson with the basic data if password is wrong. + * @param forceCache Whether it should always return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the lesson. */ getLessonWithPassword(lessonId: number, password?: string, validatePassword: boolean = true, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise { @@ -1549,8 +1542,8 @@ export class AddonModLessonProvider { /** * Get cache key for get lesson with password WS calls. * - * @param {number} lessonId Lesson ID. - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @return Cache key. */ protected getLessonWithPasswordCacheKey(lessonId: number): string { return this.ROOT_CACHE_KEY + 'lessonWithPswrd:' + lessonId; @@ -1559,10 +1552,10 @@ export class AddonModLessonProvider { /** * Given a page ID, a jumpto and all the possible jumps, calcualate the new page ID. * - * @param {number} pageId Current page ID. - * @param {number} jumpTo The jumpto. - * @param {any} jumps Result of get pages possible jumps. - * @return {number} New page ID. + * @param pageId Current page ID. + * @param jumpTo The jumpto. + * @param jumps Result of get pages possible jumps. + * @return New page ID. */ protected getNewPageId(pageId: number, jumpTo: number, jumps: any): number { // If jump not found, return current jumpTo. @@ -1579,13 +1572,13 @@ export class AddonModLessonProvider { /** * Get the ongoing score message for the user (depending on the user permission and lesson settings). * - * @param {any} lesson Lesson. - * @param {any} accessInfo Result of get access info. - * @param {string} [password] Lesson password (if any). - * @param {boolean} [review] If the user wants to review just after finishing (1 hour margin). - * @param {any} [pageIndex] Object containing all the pages indexed by ID. If not provided, it will be calculated. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the ongoing score message. + * @param lesson Lesson. + * @param accessInfo Result of get access info. + * @param password Lesson password (if any). + * @param review If the user wants to review just after finishing (1 hour margin). + * @param pageIndex Object containing all the pages indexed by ID. If not provided, it will be calculated. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the ongoing score message. */ getOngoingScoreMessage(lesson: any, accessInfo: any, password?: string, review?: boolean, pageIndex?: any, siteId?: string) : Promise { @@ -1619,12 +1612,12 @@ export class AddonModLessonProvider { /** * Get the possible answers from a page. * - * @param {any} lesson Lesson. - * @param {number} pageId Page ID. - * @param {string} [password] Lesson password (if any). - * @param {boolean} [review] If the user wants to review just after finishing (1 hour margin). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the list of possible answers. + * @param lesson Lesson. + * @param pageId Page ID. + * @param password Lesson password (if any). + * @param review If the user wants to review just after finishing (1 hour margin). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of possible answers. */ protected getPageAnswers(lesson: any, pageId: number, password?: string, review?: boolean, siteId?: string): Promise { return this.getPageData(lesson, pageId, password, review, true, true, false, undefined, undefined, siteId).then((data) => { @@ -1635,12 +1628,12 @@ export class AddonModLessonProvider { /** * Get all the possible answers from a list of pages, indexed by answerId. * - * @param {any} lesson Lesson. - * @param {number[]} pageIds List of page IDs. - * @param {string} [password] Lesson password (if any). - * @param {boolean} [review] If the user wants to review just after finishing (1 hour margin). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with an object containing the answers. + * @param lesson Lesson. + * @param pageIds List of page IDs. + * @param password Lesson password (if any). + * @param review If the user wants to review just after finishing (1 hour margin). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with an object containing the answers. */ protected getPagesAnswers(lesson: any, pageIds: number[], password?: string, review?: boolean, siteId?: string) : Promise { @@ -1666,17 +1659,17 @@ export class AddonModLessonProvider { /** * Get page data. * - * @param {any} lesson Lesson. - * @param {number} pageId Page ID. - * @param {string} [password] Lesson password (if any). - * @param {boolean} [review] If the user wants to review just after finishing (1 hour margin). - * @param {boolean} [includeContents] Include the page rendered contents. - * @param {boolean} [forceCache] Whether it should always return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {any} [accessInfo] Result of get access info. Required if offline is true. - * @param {any} [jumps] Result of get pages possible jumps. Required if offline is true. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the page data. + * @param lesson Lesson. + * @param pageId Page ID. + * @param password Lesson password (if any). + * @param review If the user wants to review just after finishing (1 hour margin). + * @param includeContents Include the page rendered contents. + * @param forceCache Whether it should always return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param accessInfo Result of get access info. Required if offline is true. + * @param jumps Result of get pages possible jumps. Required if offline is true. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the page data. */ getPageData(lesson: any, pageId: number, password?: string, review?: boolean, includeContents?: boolean, forceCache?: boolean, ignoreCache?: boolean, accessInfo?: any, jumps?: any, siteId?: string): Promise { @@ -1732,9 +1725,9 @@ export class AddonModLessonProvider { /** * Get cache key for get page data WS calls. * - * @param {number} lessonId Lesson ID. - * @param {number} pageId Page ID. - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @param pageId Page ID. + * @return Cache key. */ protected getPageDataCacheKey(lessonId: number, pageId: number): string { return this.getPageDataCommonCacheKey(lessonId) + ':' + pageId; @@ -1743,8 +1736,8 @@ export class AddonModLessonProvider { /** * Get common cache key for get page data WS calls. * - * @param {number} lessonId Lesson ID. - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @return Cache key. */ protected getPageDataCommonCacheKey(lessonId: number): string { return this.ROOT_CACHE_KEY + 'pageData:' + lessonId; @@ -1753,12 +1746,12 @@ export class AddonModLessonProvider { /** * Get lesson pages. * - * @param {number} lessonId Lesson ID. - * @param {string} [password] Lesson password (if any). - * @param {boolean} [forceCache] Whether it should always return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the pages. + * @param lessonId Lesson ID. + * @param password Lesson password (if any). + * @param forceCache Whether it should always return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the pages. */ getPages(lessonId: number, password?: string, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise { @@ -1791,8 +1784,8 @@ export class AddonModLessonProvider { /** * Get cache key for get pages WS calls. * - * @param {number} lessonId Lesson ID. - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @return Cache key. */ protected getPagesCacheKey(lessonId: number): string { return this.ROOT_CACHE_KEY + 'pages:' + lessonId; @@ -1801,11 +1794,11 @@ export class AddonModLessonProvider { /** * Get possible jumps for a lesson. * - * @param {number} lessonId Lesson ID. - * @param {boolean} [forceCache] Whether it should always return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the jumps. + * @param lessonId Lesson ID. + * @param forceCache Whether it should always return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the jumps. */ getPagesPossibleJumps(lessonId: number, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise { @@ -1847,8 +1840,8 @@ export class AddonModLessonProvider { /** * Get cache key for get pages possible jumps WS calls. * - * @param {number} lessonId Lesson ID. - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @return Cache key. */ protected getPagesPossibleJumpsCacheKey(lessonId: number): string { return this.ROOT_CACHE_KEY + 'pagesJumps:' + lessonId; @@ -1859,12 +1852,12 @@ export class AddonModLessonProvider { * Please try to use WS response messages instead of this function if possible. * Based on Moodle's add_messages_on_page_process. * - * @param {any} lesson Lesson. - * @param {any} accessInfo Result of get access info. - * @param {any} result Result of process page. - * @param {boolean} review If the user wants to review just after finishing (1 hour margin). - * @param {any} jumps Result of get pages possible jumps. - * @return {any[]} Array with the messages. + * @param lesson Lesson. + * @param accessInfo Result of get access info. + * @param result Result of process page. + * @param review If the user wants to review just after finishing (1 hour margin). + * @param jumps Result of get pages possible jumps. + * @return Array with the messages. */ getPageProcessMessages(lesson: any, accessInfo: any, result: any, review: boolean, jumps: any): any[] { const messages = []; @@ -1894,12 +1887,12 @@ export class AddonModLessonProvider { /** * Get the IDs of all the pages that have at least 1 question attempt. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {boolean} [correct] True to only fetch correct attempts, false to get them all. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, site's user. - * @return {Promise} Promise resolved with the IDs. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param correct True to only fetch correct attempts, false to get them all. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, site's user. + * @return Promise resolved with the IDs. */ getPagesIdsWithQuestionAttempts(lessonId: number, retake: number, correct?: boolean, siteId?: string, userId?: number) : Promise { @@ -1925,14 +1918,14 @@ export class AddonModLessonProvider { * Please try to use WS response messages instead of this function if possible. * Based on Moodle's add_messages_on_page_view. * - * @param {any} lesson Lesson. - * @param {any} accessInfo Result of get access info. Required if offline is true. - * @param {any} page Page loaded. - * @param {boolean} review If the user wants to review just after finishing (1 hour margin). - * @param {any} jumps Result of get pages possible jumps. - * @param {string} [password] Lesson password (if any). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the list of messages. + * @param lesson Lesson. + * @param accessInfo Result of get access info. Required if offline is true. + * @param page Page loaded. + * @param review If the user wants to review just after finishing (1 hour margin). + * @param jumps Result of get pages possible jumps. + * @param password Lesson password (if any). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of messages. */ getPageViewMessages(lesson: any, accessInfo: any, page: any, review: boolean, jumps: any, password?: string, siteId?: string) : Promise { @@ -1991,13 +1984,13 @@ export class AddonModLessonProvider { /** * Get questions attempts, including offline attempts. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {boolean} [correct] True to only fetch correct attempts, false to get them all. - * @param {number} [pageId] If defined, only get attempts on this page. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, site's user. - * @return {Promise<{online: any[], offline: any[]}>} Promise resolved with the questions attempts. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param correct True to only fetch correct attempts, false to get them all. + * @param pageId If defined, only get attempts on this page. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, site's user. + * @return Promise resolved with the questions attempts. */ getQuestionsAttempts(lessonId: number, retake: number, correct?: boolean, pageId?: number, siteId?: string, userId?: number) : Promise<{online: any[], offline: any[]}> { @@ -2028,10 +2021,10 @@ export class AddonModLessonProvider { /** * Get cache key for get questions attempts WS calls. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {number} userId User ID. - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param userId User ID. + * @return Cache key. */ protected getQuestionsAttemptsCacheKey(lessonId: number, retake: number, userId: number): string { return this.getQuestionsAttemptsCommonCacheKey(lessonId) + ':' + userId + ':' + retake; @@ -2040,8 +2033,8 @@ export class AddonModLessonProvider { /** * Get common cache key for get questions attempts WS calls. * - * @param {number} lessonId Lesson ID. - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @return Cache key. */ protected getQuestionsAttemptsCommonCacheKey(lessonId: number): string { return this.ROOT_CACHE_KEY + 'questionsAttempts:' + lessonId; @@ -2050,15 +2043,15 @@ export class AddonModLessonProvider { /** * Get questions attempts from the site. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {boolean} [correct] True to only fetch correct attempts, false to get them all. - * @param {number} [pageId] If defined, only get attempts on this page. - * @param {boolean} [forceCache] Whether it should always return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether 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 {number} [userId] User ID. If not defined, site's user. - * @return {Promise} Promise resolved with the questions attempts. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param correct True to only fetch correct attempts, false to get them all. + * @param pageId If defined, only get attempts on this page. + * @param forceCache Whether it should always return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, site's user. + * @return Promise resolved with the questions attempts. */ getQuestionsAttemptsOnline(lessonId: number, retake: number, correct?: boolean, pageId?: number, forceCache?: boolean, ignoreCache?: boolean, siteId?: string, userId?: number): Promise { @@ -2107,12 +2100,12 @@ export class AddonModLessonProvider { /** * Get the overview of retakes in a lesson (named "attempts overview" in Moodle). * - * @param {number} lessonId Lesson ID. - * @param {number} [groupId] The group to get. If not defined, all participants. - * @param {boolean} [forceCache] Whether it should always return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the retakes overview. + * @param lessonId Lesson ID. + * @param groupId The group to get. If not defined, all participants. + * @param forceCache Whether it should always return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the retakes overview. */ getRetakesOverview(lessonId: number, groupId?: number, forceCache?: boolean, ignoreCache?: boolean, siteId?: string) : Promise { @@ -2145,9 +2138,9 @@ export class AddonModLessonProvider { /** * Get cache key for get retakes overview WS calls. * - * @param {number} lessonId Lesson ID. - * @param {number} groupId Group ID. - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @param groupId Group ID. + * @return Cache key. */ protected getRetakesOverviewCacheKey(lessonId: number, groupId: number): string { return this.getRetakesOverviewCommonCacheKey(lessonId) + ':' + groupId; @@ -2156,8 +2149,8 @@ export class AddonModLessonProvider { /** * Get common cache key for get retakes overview WS calls. * - * @param {number} lessonId Lesson ID. - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @return Cache key. */ protected getRetakesOverviewCommonCacheKey(lessonId: number): string { return this.ROOT_CACHE_KEY + 'retakesOverview:' + lessonId; @@ -2166,9 +2159,9 @@ export class AddonModLessonProvider { /** * Get a password stored in DB. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with password on success, rejected otherwise. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with password on success, rejected otherwise. */ getStoredPassword(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2183,10 +2176,10 @@ export class AddonModLessonProvider { * encountered or no more pages exist. * Based on Moodle's get_sub_pages_of. * - * @param {any} pages Index of lesson pages, indexed by page ID. See createPagesIndex. - * @param {number} pageId Page ID to get subpages of. - * @param {number[]} end An array of LESSON_PAGE_* types that signify an end of the subtype. - * @return {Object[]} List of subpages. + * @param pages Index of lesson pages, indexed by page ID. See createPagesIndex. + * @param pageId Page ID to get subpages of. + * @param end An array of LESSON_PAGE_* types that signify an end of the subtype. + * @return List of subpages. */ getSubpagesOf(pages: any, pageId: number, ends: number[]): any[] { const subPages = []; @@ -2210,12 +2203,12 @@ export class AddonModLessonProvider { /** * Get lesson timers. * - * @param {number} lessonId Lesson ID. - * @param {boolean} [forceCache] Whether it should always return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether 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 {number} [userId] User ID. If not defined, site's current user. - * @return {Promise} Promise resolved with the pages. + * @param lessonId Lesson ID. + * @param forceCache Whether it should always return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, site's current user. + * @return Promise resolved with the pages. */ getTimers(lessonId: number, forceCache?: boolean, ignoreCache?: boolean, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2245,9 +2238,9 @@ export class AddonModLessonProvider { /** * Get cache key for get timers WS calls. * - * @param {number} lessonId Lesson ID. - * @param {number} userId User ID. - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @param userId User ID. + * @return Cache key. */ protected getTimersCacheKey(lessonId: number, userId: number): string { return this.getTimersCommonCacheKey(lessonId) + ':' + userId; @@ -2256,8 +2249,8 @@ export class AddonModLessonProvider { /** * Get common cache key for get timers WS calls. * - * @param {number} lessonId Lesson ID. - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @return Cache key. */ protected getTimersCommonCacheKey(lessonId: number): string { return this.ROOT_CACHE_KEY + 'timers:' + lessonId; @@ -2266,8 +2259,8 @@ export class AddonModLessonProvider { /** * Get the list of used answers (with valid answer) in a multichoice question page. * - * @param {any} pageData Result of getPageData for the page to process. - * @return {any[]} List of used answers. + * @param pageData Result of getPageData for the page to process. + * @return List of used answers. */ protected getUsedAnswersMultichoice(pageData: any): any[] { const answers = this.utils.clone(pageData.answers); @@ -2280,8 +2273,8 @@ export class AddonModLessonProvider { /** * Get the user's response in a matching question page. * - * @param {any} data Data containing the user answer. - * @return {any} User response. + * @param data Data containing the user answer. + * @return User response. */ protected getUserResponseMatching(data: any): any { if (data.response) { @@ -2306,8 +2299,8 @@ export class AddonModLessonProvider { /** * Get the user's response in a multichoice page if multiple answers are allowed. * - * @param {any} data Data containing the user answer. - * @return {any[]} User response. + * @param data Data containing the user answer. + * @return User response. */ protected getUserResponseMultichoice(data: any): any[] { if (data.answer) { @@ -2336,13 +2329,13 @@ export class AddonModLessonProvider { /** * Get a user's retake. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number - * @param {number} [userId] User ID. Undefined for current user. - * @param {boolean} [forceCache] Whether it should always return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the retake data. + * @param lessonId Lesson ID. + * @param retake Retake number + * @param userId User ID. Undefined for current user. + * @param forceCache Whether it should always return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the retake data. */ getUserRetake(lessonId: number, retake: number, userId?: number, forceCache?: boolean, ignoreCache?: boolean, siteId?: string) : Promise { @@ -2374,10 +2367,10 @@ export class AddonModLessonProvider { /** * Get cache key for get user retake WS calls. * - * @param {number} lessonId Lesson ID. - * @param {number} userId User ID. - * @param {number} retake Retake number - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @param userId User ID. + * @param retake Retake number + * @return Cache key. */ protected getUserRetakeCacheKey(lessonId: number, userId: number, retake: number): string { return this.getUserRetakeUserCacheKey(lessonId, userId) + ':' + retake; @@ -2386,9 +2379,9 @@ export class AddonModLessonProvider { /** * Get user cache key for get user retake WS calls. * - * @param {number} lessonId Lesson ID. - * @param {number} userId User ID. - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @param userId User ID. + * @return Cache key. */ protected getUserRetakeUserCacheKey(lessonId: number, userId: number): string { return this.getUserRetakeLessonCacheKey(lessonId) + ':' + userId; @@ -2397,8 +2390,8 @@ export class AddonModLessonProvider { /** * Get lesson cache key for get user retake WS calls. * - * @param {number} lessonId Lesson ID. - * @return {string} Cache key. + * @param lessonId Lesson ID. + * @return Cache key. */ protected getUserRetakeLessonCacheKey(lessonId: number): string { return this.ROOT_CACHE_KEY + 'userRetake:' + lessonId; @@ -2407,10 +2400,10 @@ export class AddonModLessonProvider { /** * Get the prevent access reason to display for a certain lesson. * - * @param {any} info Lesson access info. - * @param {boolean} [ignorePassword] Whether password protected reason should be ignored (user already entered the password). - * @param {boolean} [isReview] Whether user is reviewing a retake. - * @return {any} Prevent access reason. + * @param info Lesson access info. + * @param ignorePassword Whether password protected reason should be ignored (user already entered the password). + * @param isReview Whether user is reviewing a retake. + * @return Prevent access reason. */ getPreventAccessReason(info: any, ignorePassword?: boolean, isReview?: boolean): any { let result; @@ -2443,10 +2436,10 @@ export class AddonModLessonProvider { * Check if a jump is correct. * Based in Moodle's jumpto_is_correct. * - * @param {number} pageId ID of the page from which you are jumping from. - * @param {number} jumpTo The jumpto number. - * @param {any} pageIndex Object containing all the pages indexed by ID. See createPagesIndex. - * @return {boolean} Whether jump is correct. + * @param pageId ID of the page from which you are jumping from. + * @param jumpTo The jumpto number. + * @param pageIndex Object containing all the pages indexed by ID. See createPagesIndex. + * @return Whether jump is correct. */ jumptoIsCorrect(pageId: number, jumpTo: number, pageIndex: any): boolean { // First test the special values. @@ -2480,9 +2473,9 @@ export class AddonModLessonProvider { /** * Invalidates Lesson data. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAccessInformation(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2493,9 +2486,9 @@ export class AddonModLessonProvider { /** * Invalidates content pages viewed for all retakes. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateContentPagesViewed(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2506,10 +2499,10 @@ export class AddonModLessonProvider { /** * Invalidates content pages viewed for a certain retake. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateContentPagesViewedForRetake(lessonId: number, retake: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2520,9 +2513,9 @@ export class AddonModLessonProvider { /** * Invalidates Lesson data. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateLessonData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2533,9 +2526,9 @@ export class AddonModLessonProvider { /** * Invalidates lesson with password. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateLessonWithPassword(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2546,9 +2539,9 @@ export class AddonModLessonProvider { /** * Invalidates page data for all pages. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidatePageData(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2559,10 +2552,10 @@ export class AddonModLessonProvider { /** * Invalidates page data for a certain page. * - * @param {number} lessonId Lesson ID. - * @param {number} pageId Page ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param pageId Page ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidatePageDataForPage(lessonId: number, pageId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2573,9 +2566,9 @@ export class AddonModLessonProvider { /** * Invalidates pages. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidatePages(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2586,9 +2579,9 @@ export class AddonModLessonProvider { /** * Invalidates pages possible jumps. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidatePagesPossibleJumps(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2599,9 +2592,9 @@ export class AddonModLessonProvider { /** * Invalidates questions attempts for all retakes. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateQuestionsAttempts(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2612,11 +2605,11 @@ export class AddonModLessonProvider { /** * Invalidates question attempts for a certain retake and user. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {string} [siteId] Site ID. If not defined, current site.. - * @param {number} [userId] User ID. If not defined, site's user. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param siteId Site ID. If not defined, current site.. + * @param userId User ID. If not defined, site's user. + * @return Promise resolved when the data is invalidated. */ invalidateQuestionsAttemptsForRetake(lessonId: number, retake: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2629,9 +2622,9 @@ export class AddonModLessonProvider { /** * Invalidates retakes overview for all groups in a lesson. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateRetakesOverview(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2642,10 +2635,10 @@ export class AddonModLessonProvider { /** * Invalidates retakes overview for a certain group in a lesson. * - * @param {number} lessonId Lesson ID. - * @param {number} groupId Group ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param groupId Group ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateRetakesOverviewForGroup(lessonId: number, groupId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2656,9 +2649,9 @@ export class AddonModLessonProvider { /** * Invalidates timers for all users in a lesson. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateTimers(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2669,10 +2662,10 @@ export class AddonModLessonProvider { /** * Invalidates timers for a certain user. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, site's current user. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, site's current user. + * @return Promise resolved when the data is invalidated. */ invalidateTimersForUser(lessonId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2685,11 +2678,11 @@ export class AddonModLessonProvider { /** * Invalidates a certain retake for a certain user. * - * @param {number} lessonId Lesson ID. - * @param {number} retake Retake number. - * @param {number} [userId] User ID. Undefined for current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param retake Retake number. + * @param userId User ID. Undefined for current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateUserRetake(lessonId: number, retake: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2702,9 +2695,9 @@ export class AddonModLessonProvider { /** * Invalidates all retakes for all users in a lesson. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateUserRetakesForLesson(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2715,10 +2708,10 @@ export class AddonModLessonProvider { /** * Invalidates all retakes for a certain user in a lesson. * - * @param {number} lessonId Lesson ID. - * @param {number} [userId] User ID. Undefined for current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param lessonId Lesson ID. + * @param userId User ID. Undefined for current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateUserRetakesForUser(lessonId: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2731,11 +2724,11 @@ export class AddonModLessonProvider { /** * Check if a page answer is correct. * - * @param {any} lesson Lesson. - * @param {number} pageId The page ID. - * @param {any} answer The answer to check. - * @param {any} pageIndex Object containing all the pages indexed by ID. - * @return {boolean} Whether the answer is correct. + * @param lesson Lesson. + * @param pageId The page ID. + * @param answer The answer to check. + * @param pageIndex Object containing all the pages indexed by ID. + * @return Whether the answer is correct. */ protected isAnswerCorrect(lesson: any, pageId: number, answer: any, pageIndex: any): boolean { if (lesson.custom) { @@ -2749,8 +2742,8 @@ export class AddonModLessonProvider { /** * Check if a lesson is enabled to be used in offline. * - * @param {any} lesson Lesson. - * @return {boolean} Whether offline is enabled. + * @param lesson Lesson. + * @return Whether offline is enabled. */ isLessonOffline(lesson: any): boolean { return !!lesson.allowofflineattempts; @@ -2759,8 +2752,8 @@ export class AddonModLessonProvider { /** * Check if a lesson is password protected based in the access info. * - * @param {any} info Lesson access info. - * @return {boolean} Whether the lesson is password protected. + * @param info Lesson access info. + * @return Whether the lesson is password protected. */ isPasswordProtected(info: any): boolean { if (info && info.preventaccessreasons) { @@ -2779,8 +2772,8 @@ export class AddonModLessonProvider { /** * Return whether or not the plugin is enabled in a certain site. Plugin is enabled if the lesson WS are available. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ isPluginEnabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2792,8 +2785,8 @@ export class AddonModLessonProvider { /** * Check if a page is a question page or a content page. * - * @param {number} type Type of the page. - * @return {boolean} True if question page, false if content page. + * @param type Type of the page. + * @return True if question page, false if content page. */ isQuestionPage(type: number): boolean { return type == AddonModLessonProvider.TYPE_QUESTION; @@ -2802,12 +2795,12 @@ export class AddonModLessonProvider { /** * Start or continue a retake. * - * @param {string} id Lesson ID. - * @param {string} [password] Lesson password (if any). - * @param {number} [pageId] Page id to continue from (only when continuing a retake). - * @param {boolean} [review] If the user wants to review just after finishing (1 hour margin). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Lesson ID. + * @param password Lesson password (if any). + * @param pageId Page id to continue from (only when continuing a retake). + * @param review If the user wants to review just after finishing (1 hour margin). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ launchRetake(id: number, password?: string, pageId?: number, review?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -2837,8 +2830,8 @@ export class AddonModLessonProvider { /** * Check if the user left during a timed session. * - * @param {any} info Lesson access info. - * @return {boolean} True if left during timed, false otherwise. + * @param info Lesson access info. + * @return True if left during timed, false otherwise. */ leftDuringTimed(info: any): boolean { return info && info.lastpageseen && info.lastpageseen != AddonModLessonProvider.LESSON_EOL && info.leftduringtimedsession; @@ -2848,8 +2841,8 @@ export class AddonModLessonProvider { * Checks to see if a LESSON_CLUSTERJUMP or a LESSON_UNSEENBRANCHPAGE is used in a lesson. * Based on Moodle's lesson_display_teacher_warning. * - * @param {any} jumps Result of get pages possible jumps. - * @return {boolean} Whether the lesson uses one of those jumps. + * @param jumps Result of get pages possible jumps. + * @return Whether the lesson uses one of those jumps. */ lessonDisplayTeacherWarning(jumps: any): boolean { if (!jumps) { @@ -2875,14 +2868,14 @@ export class AddonModLessonProvider { * Calculates a user's grade for a lesson. * Based on Moodle's lesson_grade. * - * @param {any} lesson Lesson. - * @param {number} retake Retake number. - * @param {string} [password] Lesson password (if any). - * @param {boolean} [review] If the user wants to review just after finishing (1 hour margin). - * @param {any} [pageIndex] Object containing all the pages indexed by ID. If not provided, it will be calculated. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, site's user. - * @return {Promise} Promise resolved with the grade data. + * @param lesson Lesson. + * @param retake Retake number. + * @param password Lesson password (if any). + * @param review If the user wants to review just after finishing (1 hour margin). + * @param pageIndex Object containing all the pages indexed by ID. If not provided, it will be calculated. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, site's user. + * @return Promise resolved with the grade data. */ lessonGrade(lesson: any, retake: number, password?: string, review?: boolean, pageIndex?: any, siteId?: string, userId?: number): Promise { @@ -3024,11 +3017,11 @@ export class AddonModLessonProvider { /** * Report a lesson as being viewed. * - * @param {string} id Module ID. - * @param {string} [password] Lesson password (if any). - * @param {string} [name] Name of the assign. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Module ID. + * @param password Lesson password (if any). + * @param name Name of the assign. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logViewLesson(id: number, password?: string, name?: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -3049,17 +3042,17 @@ export class AddonModLessonProvider { /** * Process a lesson page, saving its data. * - * @param {any} lesson Lesson. - * @param {number} courseId Course ID the lesson belongs to. - * @param {any} pageData Result of getPageData for the page to process. - * @param {any} data Data to save. - * @param {string} [password] Lesson password (if any). - * @param {boolean} [review] If the user wants to review just after finishing (1 hour margin). - * @param {boolean} [offline] Whether it's offline mode. - * @param {any} [accessInfo] Result of get access info. Required if offline is true. - * @param {any} [jumps] Result of get pages possible jumps. Required if offline is true. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param lesson Lesson. + * @param courseId Course ID the lesson belongs to. + * @param pageData Result of getPageData for the page to process. + * @param data Data to save. + * @param password Lesson password (if any). + * @param review If the user wants to review just after finishing (1 hour margin). + * @param offline Whether it's offline mode. + * @param accessInfo Result of get access info. Required if offline is true. + * @param jumps Result of get pages possible jumps. Required if offline is true. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ processPage(lesson: any, courseId: number, pageData: any, data: any, password?: string, review?: boolean, offline?: boolean, accessInfo?: boolean, jumps?: any, siteId?: string): Promise { @@ -3118,13 +3111,13 @@ export class AddonModLessonProvider { /** * Process a lesson page, saving its data. It will fail if offline or cannot connect. * - * @param {number} lessonId Lesson ID. - * @param {number} pageId Page ID. - * @param {any} data Data to save. - * @param {string} [password] Lesson password (if any). - * @param {boolean} [review] If the user wants to review just after finishing (1 hour margin). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success, rejected otherwise. + * @param lessonId Lesson ID. + * @param pageId Page ID. + * @param data Data to save. + * @param password Lesson password (if any). + * @param review If the user wants to review just after finishing (1 hour margin). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success, rejected otherwise. */ processPageOnline(lessonId: number, pageId: number, data: any, password?: string, review?: boolean, siteId?: string) : Promise { @@ -3149,16 +3142,16 @@ export class AddonModLessonProvider { * Records an attempt on a certain page. * Based on Moodle's record_attempt. * - * @param {any} lesson Lesson. - * @param {number} courseId Course ID the lesson belongs to. - * @param {any} pageData Result of getPageData for the page to process. - * @param {any} data Data to save. - * @param {boolean} review If the user wants to review just after finishing (1 hour margin). - * @param {any} accessInfo Result of get access info. - * @param {any} jumps Result of get pages possible jumps. - * @param {any} pageIndex Object containing all the pages indexed by ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the result. + * @param lesson Lesson. + * @param courseId Course ID the lesson belongs to. + * @param pageData Result of getPageData for the page to process. + * @param data Data to save. + * @param review If the user wants to review just after finishing (1 hour margin). + * @param accessInfo Result of get access info. + * @param jumps Result of get pages possible jumps. + * @param pageIndex Object containing all the pages indexed by ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the result. */ protected recordAttempt(lesson: any, courseId: number, pageData: any, data: any, review: boolean, accessInfo: any, jumps: any, pageIndex: any, siteId?: string): Promise { @@ -3333,9 +3326,9 @@ export class AddonModLessonProvider { /** * Remove a password stored in DB. * - * @param {number} lessonId Lesson ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when removed. + * @param lessonId Lesson ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when removed. */ removeStoredPassword(lessonId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -3346,10 +3339,10 @@ export class AddonModLessonProvider { /** * Store a password in DB. * - * @param {number} lessonId Lesson ID. - * @param {string} password Password to store. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when stored. + * @param lessonId Lesson ID. + * @param password Password to store. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when stored. */ storePassword(lessonId: number, password: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -3368,11 +3361,11 @@ export class AddonModLessonProvider { * modify the list of viewedPagesIds for cluster pages. * Based on Moodle's valid_page_and_view. * - * @param {any} pages Index of lesson pages, indexed by page ID. See createPagesIndex. - * @param {any} page Page to check. - * @param {any} validPages Valid pages, indexed by page ID. - * @param {number[]} viewedPagesIds List of viewed pages IDs. - * @return {number} Next page ID. + * @param pages Index of lesson pages, indexed by page ID. See createPagesIndex. + * @param page Page to check. + * @param validPages Valid pages, indexed by page ID. + * @param viewedPagesIds List of viewed pages IDs. + * @return Next page ID. */ validPageAndView(pages: any, page: any, validPages: any, viewedPagesIds: number[]): number { diff --git a/src/addon/mod/lesson/providers/list-link-handler.ts b/src/addon/mod/lesson/providers/list-link-handler.ts index d208a3bba..273e6d6f8 100644 --- a/src/addon/mod/lesson/providers/list-link-handler.ts +++ b/src/addon/mod/lesson/providers/list-link-handler.ts @@ -33,7 +33,7 @@ export class AddonModLessonListLinkHandler extends CoreContentLinksModuleListHan /** * Check if the handler is enabled on a site level. * - * @return {Promise} Promise resolved with boolean: whether or not the handler is enabled on a site level. + * @return Promise resolved with boolean: whether or not the handler is enabled on a site level. */ isEnabled(): Promise { return this.lessonProvider.isPluginEnabled(); diff --git a/src/addon/mod/lesson/providers/module-handler.ts b/src/addon/mod/lesson/providers/module-handler.ts index ec28dc40c..a2e706cd0 100644 --- a/src/addon/mod/lesson/providers/module-handler.ts +++ b/src/addon/mod/lesson/providers/module-handler.ts @@ -45,7 +45,7 @@ export class AddonModLessonModuleHandler implements CoreCourseModuleHandler { /** * Check if the handler is enabled on a site level. * - * @return {Promise} Promise resolved with boolean: whether or not the handler is enabled on a site level. + * @return Promise resolved with boolean: whether or not the handler is enabled on a site level. */ isEnabled(): Promise { return this.lessonProvider.isPluginEnabled(); @@ -54,10 +54,10 @@ export class AddonModLessonModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { return { @@ -79,9 +79,9 @@ export class AddonModLessonModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModLessonIndexComponent; diff --git a/src/addon/mod/lesson/providers/prefetch-handler.ts b/src/addon/mod/lesson/providers/prefetch-handler.ts index bbd7666c6..80a32c44b 100644 --- a/src/addon/mod/lesson/providers/prefetch-handler.ts +++ b/src/addon/mod/lesson/providers/prefetch-handler.ts @@ -50,8 +50,8 @@ export class AddonModLessonPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Ask password. * - * @param {any} info Lesson access info. - * @return {Promise} Promise resolved with the password. + * @param info Lesson access info. + * @return Promise resolved with the password. */ protected askUserPassword(info: any): Promise { // Create and show the modal. @@ -74,11 +74,11 @@ export class AddonModLessonPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Get the download size of a module. * - * @param {any} module Module. - * @param {Number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise<{size: number, total: boolean}>} Promise resolved with the size and a boolean indicating if it was able - * to calculate the total size. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved with the size and a boolean indicating if it was able + * to calculate the total size. */ getDownloadSize(module: any, courseId: any, single?: boolean): Promise<{ size: number, total: boolean }> { const siteId = this.sitesProvider.getCurrentSiteId(); @@ -115,12 +115,12 @@ export class AddonModLessonPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Get the lesson password if needed. If not stored, it can ask the user to enter it. * - * @param {number} lessonId Lesson ID. - * @param {boolean} [forceCache] Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {boolean} [askPassword] True if we should ask for password if needed, false otherwise. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise<{password?: string, lesson?: any, accessInfo: any}>} Promise resolved when done. + * @param lessonId Lesson ID. + * @param forceCache Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param askPassword True if we should ask for password if needed, false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ getLessonPassword(lessonId: number, forceCache?: boolean, ignoreCache?: boolean, askPassword?: boolean, siteId?: string) : Promise<{password?: string, lesson?: any, accessInfo: any}> { @@ -167,9 +167,9 @@ export class AddonModLessonPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId The course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId The course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { // Only invalidate the data that doesn't ignore cache when prefetching. @@ -185,9 +185,9 @@ export class AddonModLessonPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Invalidate WS calls needed to determine module status. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule(module: any, courseId: number): Promise { const siteId = this.sitesProvider.getCurrentSiteId(); @@ -206,9 +206,9 @@ export class AddonModLessonPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Check if a module can be downloaded. If the function is not defined, we assume that all modules are downloadable. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {boolean|Promise} Whether the module can be downloaded. The promise should never be rejected. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Whether the module can be downloaded. The promise should never be rejected. */ isDownloadable(module: any, courseId: number): boolean | Promise { const siteId = this.sitesProvider.getCurrentSiteId(); @@ -230,7 +230,7 @@ export class AddonModLessonPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ isEnabled(): boolean | Promise { return this.lessonProvider.isPluginEnabled(); @@ -239,11 +239,11 @@ export class AddonModLessonPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string): Promise { return this.prefetchPackage(module, courseId, single, this.prefetchLesson.bind(this)); @@ -252,11 +252,11 @@ export class AddonModLessonPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Prefetch a lesson. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} single True if we're downloading a single module, false if we're downloading a whole section. - * @param {String} siteId Site ID. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. + * @return Promise resolved when done. */ protected prefetchLesson(module: any, courseId: number, single: boolean, siteId: string): Promise { let lesson, @@ -427,13 +427,13 @@ export class AddonModLessonPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Validate the password. * - * @param {number} lessonId Lesson ID. - * @param {any} info Lesson access info. - * @param {string} pwd Password to check. - * @param {boolean} [forceCache] Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise<{password: string, lesson: any, accessInfo: any}>} Promise resolved when done. + * @param lessonId Lesson ID. + * @param info Lesson access info. + * @param pwd Password to check. + * @param forceCache Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ protected validatePassword(lessonId: number, info: any, pwd: string, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise<{password: string, lesson: any, accessInfo: any}> { @@ -455,10 +455,10 @@ export class AddonModLessonPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Sync a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ sync(module: any, courseId: number, siteId?: any): Promise { if (!this.syncProvider) { diff --git a/src/addon/mod/lesson/providers/push-click-handler.ts b/src/addon/mod/lesson/providers/push-click-handler.ts index 649436683..db47c4b56 100644 --- a/src/addon/mod/lesson/providers/push-click-handler.ts +++ b/src/addon/mod/lesson/providers/push-click-handler.ts @@ -33,8 +33,8 @@ export class AddonModLessonPushClickHandler implements CorePushNotificationsClic /** * Check if a notification click is handled by this handler. * - * @param {any} notification The notification to check. - * @return {boolean} Whether the notification click is handled by this handler + * @param notification The notification to check. + * @return Whether the notification click is handled by this handler */ handles(notification: any): boolean | Promise { if (this.utils.isTrueOrOne(notification.notif) && notification.moodlecomponent == 'mod_lesson' && @@ -49,8 +49,8 @@ export class AddonModLessonPushClickHandler implements CorePushNotificationsClic /** * Handle the notification click. * - * @param {any} notification The notification to check. - * @return {Promise} Promise resolved when done. + * @param notification The notification to check. + * @return Promise resolved when done. */ handleClick(notification: any): Promise { const data = notification.customdata || {}, diff --git a/src/addon/mod/lesson/providers/report-link-handler.ts b/src/addon/mod/lesson/providers/report-link-handler.ts index 76d8703ac..790f110b2 100644 --- a/src/addon/mod/lesson/providers/report-link-handler.ts +++ b/src/addon/mod/lesson/providers/report-link-handler.ts @@ -40,11 +40,11 @@ export class AddonModLessonReportLinkHandler extends CoreContentLinksHandlerBase /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -67,11 +67,11 @@ export class AddonModLessonReportLinkHandler extends CoreContentLinksHandlerBase * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { if (params.action == 'reportdetail' && !params.userid) { @@ -85,12 +85,12 @@ export class AddonModLessonReportLinkHandler extends CoreContentLinksHandlerBase /** * Open report overview. * - * @param {number} moduleId Module ID. - * @param {number} courseId Course ID. - * @param {string} groupId Group ID. - * @param {string} siteId Site ID. - * @param {NavController} [navCtrl] The NavController to use to navigate. - * @return {Promise} Promise resolved when done. + * @param moduleId Module ID. + * @param courseId Course ID. + * @param groupId Group ID. + * @param siteId Site ID. + * @param navCtrl The NavController to use to navigate. + * @return Promise resolved when done. */ protected openReportOverview(moduleId: number, courseId?: number, groupId?: number, siteId?: string, navCtrl?: NavController) : Promise { @@ -119,14 +119,14 @@ export class AddonModLessonReportLinkHandler extends CoreContentLinksHandlerBase /** * Open a user's retake. * - * @param {number} moduleId Module ID. - * @param {number} userId User ID. - * @param {number} courseId Course ID. - * @param {number} retake Retake to open. - * @param {string} groupId Group ID. - * @param {string} siteId Site ID. - * @param {NavController} [navCtrl] The NavController to use to navigate. - * @return {Promise} Promise resolved when done. + * @param moduleId Module ID. + * @param userId User ID. + * @param courseId Course ID. + * @param retake Retake to open. + * @param groupId Group ID. + * @param siteId Site ID. + * @param navCtrl The NavController to use to navigate. + * @return Promise resolved when done. */ protected openUserRetake(moduleId: number, userId: number, courseId: number, retake: number, siteId: string, navCtrl?: NavController): Promise { diff --git a/src/addon/mod/lesson/providers/sync-cron-handler.ts b/src/addon/mod/lesson/providers/sync-cron-handler.ts index 3d204645a..446eb712c 100644 --- a/src/addon/mod/lesson/providers/sync-cron-handler.ts +++ b/src/addon/mod/lesson/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class AddonModLessonSyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.lessonSync.syncAllLessons(siteId, force); @@ -40,7 +40,7 @@ export class AddonModLessonSyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return this.lessonSync.syncInterval; diff --git a/src/addon/mod/lti/components/index/index.ts b/src/addon/mod/lti/components/index/index.ts index f61c1e50f..53819e792 100644 --- a/src/addon/mod/lti/components/index/index.ts +++ b/src/addon/mod/lti/components/index/index.ts @@ -57,10 +57,10 @@ export class AddonModLtiIndexComponent extends CoreCourseModuleMainActivityCompo /** * Get the LTI data. * - * @param {boolean} [refresh=false] If it's refreshing content. - * @param {boolean} [sync=false] If it should try to sync. - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved when done. + * @param refresh If it's refreshing content. + * @param sync If it should try to sync. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved when done. */ protected fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { return this.ltiProvider.getLti(this.courseId, this.module.id).then((ltiData) => { @@ -76,7 +76,7 @@ export class AddonModLtiIndexComponent extends CoreCourseModuleMainActivityCompo /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; diff --git a/src/addon/mod/lti/pages/index/index.ts b/src/addon/mod/lti/pages/index/index.ts index ea6ab0034..7109d0d7d 100644 --- a/src/addon/mod/lti/pages/index/index.ts +++ b/src/addon/mod/lti/pages/index/index.ts @@ -40,7 +40,7 @@ export class AddonModLtiIndexPage { /** * Update some data based on the LTI instance. * - * @param {any} lti LTI instance. + * @param lti LTI instance. */ updateData(lti: any): void { this.title = lti.name || this.title; diff --git a/src/addon/mod/lti/providers/lti.ts b/src/addon/mod/lti/providers/lti.ts index b9c1eea85..73eef5121 100644 --- a/src/addon/mod/lti/providers/lti.ts +++ b/src/addon/mod/lti/providers/lti.ts @@ -50,7 +50,7 @@ export class AddonModLtiProvider { /** * Delete launcher. * - * @return {Promise} Promise resolved when the launcher file is deleted. + * @return Promise resolved when the launcher file is deleted. */ deleteLauncher(): Promise { return this.fileProvider.removeFile(this.LAUNCHER_FILE_NAME); @@ -59,9 +59,9 @@ export class AddonModLtiProvider { /** * Generates a launcher file. * - * @param {string} url Launch URL. - * @param {AddonModLtiParam[]} params Launch params. - * @return {Promise} Promise resolved with the file URL. + * @param url Launch URL. + * @param params Launch params. + * @return Promise resolved with the file URL. */ generateLauncher(url: string, params: AddonModLtiParam[]): Promise { if (!this.fileProvider.isAvailable()) { @@ -100,9 +100,9 @@ export class AddonModLtiProvider { /** * Get a LTI. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @return {Promise} Promise resolved when the LTI is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @return Promise resolved when the LTI is retrieved. */ getLti(courseId: number, cmId: number): Promise { const params: any = { @@ -128,8 +128,8 @@ export class AddonModLtiProvider { /** * Get cache key for LTI data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getLtiCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'lti:' + courseId; @@ -138,8 +138,8 @@ export class AddonModLtiProvider { /** * Get a LTI launch data. * - * @param {number} id LTI id. - * @return {Promise} Promise resolved when the launch data is retrieved. + * @param id LTI id. + * @return Promise resolved when the launch data is retrieved. */ getLtiLaunchData(id: number): Promise { const params: any = { @@ -166,8 +166,8 @@ export class AddonModLtiProvider { /** * Get cache key for LTI launch data WS calls. * - * @param {number} id LTI id. - * @return {string} Cache key. + * @param id LTI id. + * @return Cache key. */ protected getLtiLaunchDataCacheKey(id: number): string { return this.ROOT_CACHE_KEY + 'launch:' + id; @@ -176,8 +176,8 @@ export class AddonModLtiProvider { /** * Invalidates LTI data. * - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @return Promise resolved when the data is invalidated. */ invalidateLti(courseId: number): Promise { return this.sitesProvider.getCurrentSite().invalidateWsCacheForKey(this.getLtiCacheKey(courseId)); @@ -186,8 +186,8 @@ export class AddonModLtiProvider { /** * Invalidates options. * - * @param {number} id LTI id. - * @return {Promise} Promise resolved when the data is invalidated. + * @param id LTI id. + * @return Promise resolved when the data is invalidated. */ invalidateLtiLaunchData(id: number): Promise { return this.sitesProvider.getCurrentSite().invalidateWsCacheForKey(this.getLtiLaunchDataCacheKey(id)); @@ -196,9 +196,9 @@ export class AddonModLtiProvider { /** * Launch LTI. * - * @param {string} url Launch URL. - * @param {AddonModLtiParam[]} params Launch params. - * @return {Promise} Promise resolved when the WS call is successful. + * @param url Launch URL. + * @param params Launch params. + * @return Promise resolved when the WS call is successful. */ launch(url: string, params: AddonModLtiParam[]): Promise { if (!this.urlUtils.isHttpURL(url)) { @@ -214,10 +214,10 @@ export class AddonModLtiProvider { /** * Report the LTI as being viewed. * - * @param {string} id LTI id. - * @param {string} [name] Name of the lti. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id LTI id. + * @param name Name of the lti. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params: any = { diff --git a/src/addon/mod/lti/providers/module-handler.ts b/src/addon/mod/lti/providers/module-handler.ts index 351fd9020..36757b9a8 100644 --- a/src/addon/mod/lti/providers/module-handler.ts +++ b/src/addon/mod/lti/providers/module-handler.ts @@ -55,7 +55,7 @@ export class AddonModLtiModuleHandler implements CoreCourseModuleHandler { /** * Check if the handler is enabled on a site level. * - * @return {boolean|Promise} 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 { return true; @@ -64,10 +64,10 @@ export class AddonModLtiModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { const data: CoreCourseModuleHandlerData = { @@ -137,9 +137,9 @@ export class AddonModLtiModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModLtiIndexComponent; diff --git a/src/addon/mod/page/components/index/index.ts b/src/addon/mod/page/components/index/index.ts index 254bc0f38..bc6b76671 100644 --- a/src/addon/mod/page/components/index/index.ts +++ b/src/addon/mod/page/components/index/index.ts @@ -64,7 +64,7 @@ export class AddonModPageIndexComponent extends CoreCourseModuleMainResourceComp /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { return this.pageProvider.invalidateContent(this.module.id, this.courseId); @@ -73,8 +73,8 @@ export class AddonModPageIndexComponent extends CoreCourseModuleMainResourceComp /** * Download page contents. * - * @param {boolean} [refresh] Whether we're refreshing data. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @return Promise resolved when done. */ protected fetchContent(refresh?: boolean): Promise { let downloadFailed = false; diff --git a/src/addon/mod/page/pages/index/index.ts b/src/addon/mod/page/pages/index/index.ts index 089c14afb..8b224d3df 100644 --- a/src/addon/mod/page/pages/index/index.ts +++ b/src/addon/mod/page/pages/index/index.ts @@ -40,7 +40,7 @@ export class AddonModPageIndexPage { /** * Update some data based on the page instance. * - * @param {any} page Page instance. + * @param page Page instance. */ updateData(page: any): void { this.title = page.name || this.title; diff --git a/src/addon/mod/page/providers/helper.ts b/src/addon/mod/page/providers/helper.ts index 0c15ecdff..13f7209a4 100644 --- a/src/addon/mod/page/providers/helper.ts +++ b/src/addon/mod/page/providers/helper.ts @@ -39,9 +39,9 @@ export class AddonModPageHelperProvider { /** * Gets the page HTML. * - * @param {any} contents The module contents. - * @param {number} moduleId The module ID. - * @return {Promise} The HTML of the page. + * @param contents The module contents. + * @param moduleId The module ID. + * @return The HTML of the page. */ getPageHtml(contents: any, moduleId: number): Promise { let indexUrl, @@ -100,8 +100,8 @@ export class AddonModPageHelperProvider { /** * Returns whether the file is the main page of the module. * - * @param {any} file An object returned from WS containing file info. - * @return {boolean} Whether the file is the main page or not. + * @param file An object returned from WS containing file info. + * @return Whether the file is the main page or not. */ protected isMainPage(file: any): boolean { const filename = file.filename || '', diff --git a/src/addon/mod/page/providers/list-link-handler.ts b/src/addon/mod/page/providers/list-link-handler.ts index 67358bb95..d56ba9d85 100644 --- a/src/addon/mod/page/providers/list-link-handler.ts +++ b/src/addon/mod/page/providers/list-link-handler.ts @@ -33,7 +33,7 @@ export class AddonModPageListLinkHandler extends CoreContentLinksModuleListHandl /** * Check if the handler is enabled on a site level. * - * @return {boolean|Promise} 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 { return this.pageProvider.isPluginEnabled(); diff --git a/src/addon/mod/page/providers/module-handler.ts b/src/addon/mod/page/providers/module-handler.ts index 34b827807..f54293b51 100644 --- a/src/addon/mod/page/providers/module-handler.ts +++ b/src/addon/mod/page/providers/module-handler.ts @@ -45,7 +45,7 @@ export class AddonModPageModuleHandler implements CoreCourseModuleHandler { /** * Check if the handler is enabled on a site level. * - * @return {boolean|Promise} 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 { return this.pageProvider.isPluginEnabled(); @@ -54,10 +54,10 @@ export class AddonModPageModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { return { @@ -79,9 +79,9 @@ export class AddonModPageModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModPageIndexComponent; diff --git a/src/addon/mod/page/providers/page.ts b/src/addon/mod/page/providers/page.ts index 95ac2f311..ba42a2412 100644 --- a/src/addon/mod/page/providers/page.ts +++ b/src/addon/mod/page/providers/page.ts @@ -40,10 +40,10 @@ export class AddonModPageProvider { /** * Get a page by course module ID. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the book is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the book is retrieved. */ getPageData(courseId: number, cmId: number, siteId?: string): Promise { return this.getPageByKey(courseId, 'coursemodule', cmId, siteId); @@ -52,11 +52,11 @@ export class AddonModPageProvider { /** * Get a page. * - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the book is retrieved. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the book is retrieved. */ protected getPageByKey(courseId: number, key: string, value: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -86,8 +86,8 @@ export class AddonModPageProvider { /** * Get cache key for page data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getPageCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'page:' + courseId; @@ -96,10 +96,9 @@ export class AddonModPageProvider { /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID of the module. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} + * @param moduleId The module ID. + * @param courseId Course ID of the module. + * @param siteId Site ID. If not defined, current site. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { const promises = []; @@ -114,9 +113,9 @@ export class AddonModPageProvider { /** * Invalidates page data. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidatePageData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -127,7 +126,7 @@ export class AddonModPageProvider { /** * Returns whether or not getPage WS available or not. * - * @return {boolean} If WS is avalaible. + * @return If WS is avalaible. * @since 3.3 */ isGetPageWSAvailable(): boolean { @@ -137,8 +136,8 @@ export class AddonModPageProvider { /** * Return whether or not the plugin is enabled. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ isPluginEnabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -149,10 +148,10 @@ export class AddonModPageProvider { /** * Report a page as being viewed. * - * @param {number} id Module ID. - * @param {string} [name] Name of the page. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Module ID. + * @param name Name of the page. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params = { diff --git a/src/addon/mod/page/providers/pluginfile-handler.ts b/src/addon/mod/page/providers/pluginfile-handler.ts index 4fa49fcdc..dd7e928af 100644 --- a/src/addon/mod/page/providers/pluginfile-handler.ts +++ b/src/addon/mod/page/providers/pluginfile-handler.ts @@ -26,8 +26,8 @@ export class AddonModPagePluginFileHandler implements CorePluginFileHandler { /** * Return the RegExp to match the revision on pluginfile URLs. * - * @param {string[]} args Arguments of the pluginfile URL defining component and filearea at least. - * @return {RegExp} RegExp to match the revision on pluginfile URLs. + * @param args Arguments of the pluginfile URL defining component and filearea at least. + * @return RegExp to match the revision on pluginfile URLs. */ getComponentRevisionRegExp(args: string[]): RegExp { // Check filearea. @@ -40,8 +40,8 @@ export class AddonModPagePluginFileHandler implements CorePluginFileHandler { /** * Should return the string to remove the revision on pluginfile url. * - * @param {string[]} args Arguments of the pluginfile URL defining component and filearea at least. - * @return {string} String to remove the revision on pluginfile url. + * @param args Arguments of the pluginfile URL defining component and filearea at least. + * @return String to remove the revision on pluginfile url. */ getComponentRevisionReplace(args: string[]): string { // Component + Filearea + Revision diff --git a/src/addon/mod/page/providers/prefetch-handler.ts b/src/addon/mod/page/providers/prefetch-handler.ts index 87000313c..69043da50 100644 --- a/src/addon/mod/page/providers/prefetch-handler.ts +++ b/src/addon/mod/page/providers/prefetch-handler.ts @@ -45,13 +45,13 @@ export class AddonModPagePrefetchHandler extends CoreCourseResourcePrefetchHandl /** * Download or prefetch the content. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {boolean} [prefetch] True to prefetch, false to download right away. - * @param {string} [dirPath] Path of the directory where to store all the content files. This is to keep the files - * relative paths and make the package work in an iframe. Undefined to download the files - * in the filepool root page. - * @return {Promise} Promise resolved when all content is downloaded. Data returned is not reliable. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param prefetch True to prefetch, false to download right away. + * @param dirPath Path of the directory where to store all the content files. This is to keep the files + * relative paths and make the package work in an iframe. Undefined to download the files + * in the filepool root page. + * @return Promise resolved when all content is downloaded. Data returned is not reliable. */ downloadOrPrefetch(module: any, courseId: number, prefetch?: boolean, dirPath?: string): Promise { const promises = []; @@ -68,9 +68,9 @@ export class AddonModPagePrefetchHandler extends CoreCourseResourcePrefetchHandl /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.pageProvider.invalidateContent(moduleId, courseId); @@ -79,9 +79,9 @@ export class AddonModPagePrefetchHandler extends CoreCourseResourcePrefetchHandl /** * Invalidate WS calls needed to determine module status. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule(module: any, courseId: number): Promise { const promises = []; diff --git a/src/addon/mod/quiz/accessrules/delaybetweenattempts/providers/handler.ts b/src/addon/mod/quiz/accessrules/delaybetweenattempts/providers/handler.ts index d102e9c52..518904872 100644 --- a/src/addon/mod/quiz/accessrules/delaybetweenattempts/providers/handler.ts +++ b/src/addon/mod/quiz/accessrules/delaybetweenattempts/providers/handler.ts @@ -31,7 +31,7 @@ export class AddonModQuizAccessDelayBetweenAttemptsHandler implements AddonModQu /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -40,11 +40,11 @@ export class AddonModQuizAccessDelayBetweenAttemptsHandler implements AddonModQu /** * Whether the rule requires a preflight check when prefetch/start/continue an attempt. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean|Promise} Whether the rule requires a preflight check. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Whether the rule requires a preflight check. */ isPreflightCheckRequired(quiz: any, attempt?: any, prefetch?: boolean, siteId?: string): boolean | Promise { return false; diff --git a/src/addon/mod/quiz/accessrules/ipaddress/providers/handler.ts b/src/addon/mod/quiz/accessrules/ipaddress/providers/handler.ts index ca2d1f3d0..e8d4616f0 100644 --- a/src/addon/mod/quiz/accessrules/ipaddress/providers/handler.ts +++ b/src/addon/mod/quiz/accessrules/ipaddress/providers/handler.ts @@ -31,7 +31,7 @@ export class AddonModQuizAccessIpAddressHandler implements AddonModQuizAccessRul /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -40,11 +40,11 @@ export class AddonModQuizAccessIpAddressHandler implements AddonModQuizAccessRul /** * Whether the rule requires a preflight check when prefetch/start/continue an attempt. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean|Promise} Whether the rule requires a preflight check. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Whether the rule requires a preflight check. */ isPreflightCheckRequired(quiz: any, attempt?: any, prefetch?: boolean, siteId?: string): boolean | Promise { return false; diff --git a/src/addon/mod/quiz/accessrules/numattempts/providers/handler.ts b/src/addon/mod/quiz/accessrules/numattempts/providers/handler.ts index 125bb2e8c..e2027019d 100644 --- a/src/addon/mod/quiz/accessrules/numattempts/providers/handler.ts +++ b/src/addon/mod/quiz/accessrules/numattempts/providers/handler.ts @@ -31,7 +31,7 @@ export class AddonModQuizAccessNumAttemptsHandler implements AddonModQuizAccessR /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -40,11 +40,11 @@ export class AddonModQuizAccessNumAttemptsHandler implements AddonModQuizAccessR /** * Whether the rule requires a preflight check when prefetch/start/continue an attempt. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean|Promise} Whether the rule requires a preflight check. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Whether the rule requires a preflight check. */ isPreflightCheckRequired(quiz: any, attempt?: any, prefetch?: boolean, siteId?: string): boolean | Promise { return false; diff --git a/src/addon/mod/quiz/accessrules/offlineattempts/providers/handler.ts b/src/addon/mod/quiz/accessrules/offlineattempts/providers/handler.ts index 5b7988b06..b5b84382a 100644 --- a/src/addon/mod/quiz/accessrules/offlineattempts/providers/handler.ts +++ b/src/addon/mod/quiz/accessrules/offlineattempts/providers/handler.ts @@ -33,12 +33,12 @@ export class AddonModQuizAccessOfflineAttemptsHandler implements AddonModQuizAcc /** * Add preflight data that doesn't require user interaction. The data should be added to the preflightData param. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} preflightData Object where to add the preflight data. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} Promise resolved when done if async, void if it's synchronous. + * @param quiz The quiz the rule belongs to. + * @param preflightData Object where to add the preflight data. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done if async, void if it's synchronous. */ getFixedPreflightData(quiz: any, preflightData: any, attempt?: any, prefetch?: boolean, siteId?: string): void | Promise { preflightData.confirmdatasaved = 1; @@ -49,8 +49,8 @@ export class AddonModQuizAccessOfflineAttemptsHandler implements AddonModQuizAcc * Implement this if your access rule requires a preflight check with user interaction. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getPreflightComponent(injector: Injector): any | Promise { return AddonModQuizAccessOfflineAttemptsComponent; @@ -59,7 +59,7 @@ export class AddonModQuizAccessOfflineAttemptsHandler implements AddonModQuizAcc /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -68,11 +68,11 @@ export class AddonModQuizAccessOfflineAttemptsHandler implements AddonModQuizAcc /** * Whether the rule requires a preflight check when prefetch/start/continue an attempt. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean|Promise} Whether the rule requires a preflight check. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Whether the rule requires a preflight check. */ isPreflightCheckRequired(quiz: any, attempt?: any, prefetch?: boolean, siteId?: string): boolean | Promise { if (prefetch) { diff --git a/src/addon/mod/quiz/accessrules/openclosedate/providers/handler.ts b/src/addon/mod/quiz/accessrules/openclosedate/providers/handler.ts index b801b0e24..09c5d8af2 100644 --- a/src/addon/mod/quiz/accessrules/openclosedate/providers/handler.ts +++ b/src/addon/mod/quiz/accessrules/openclosedate/providers/handler.ts @@ -32,7 +32,7 @@ export class AddonModQuizAccessOpenCloseDateHandler implements AddonModQuizAcces /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -41,11 +41,11 @@ export class AddonModQuizAccessOpenCloseDateHandler implements AddonModQuizAcces /** * Whether the rule requires a preflight check when prefetch/start/continue an attempt. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean|Promise} Whether the rule requires a preflight check. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Whether the rule requires a preflight check. */ isPreflightCheckRequired(quiz: any, attempt?: any, prefetch?: boolean, siteId?: string): boolean | Promise { return false; @@ -54,10 +54,10 @@ export class AddonModQuizAccessOpenCloseDateHandler implements AddonModQuizAcces /** * Whether or not the time left of an attempt should be displayed. * - * @param {any} attempt The attempt. - * @param {number} endTime The attempt end time (in seconds). - * @param {number} timeNow The current time in seconds. - * @return {boolean} Whether it should be displayed. + * @param attempt The attempt. + * @param endTime The attempt end time (in seconds). + * @param timeNow The current time in seconds. + * @return Whether it should be displayed. */ shouldShowTimeLeft(attempt: any, endTime: number, timeNow: number): boolean { // If this is a teacher preview after the close date, do not show the time. diff --git a/src/addon/mod/quiz/accessrules/password/providers/handler.ts b/src/addon/mod/quiz/accessrules/password/providers/handler.ts index be42e7591..ac3c7a970 100644 --- a/src/addon/mod/quiz/accessrules/password/providers/handler.ts +++ b/src/addon/mod/quiz/accessrules/password/providers/handler.ts @@ -60,12 +60,12 @@ export class AddonModQuizAccessPasswordHandler implements AddonModQuizAccessRule /** * Add preflight data that doesn't require user interaction. The data should be added to the preflightData param. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} preflightData Object where to add the preflight data. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} Promise resolved when done if async, void if it's synchronous. + * @param quiz The quiz the rule belongs to. + * @param preflightData Object where to add the preflight data. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done if async, void if it's synchronous. */ getFixedPreflightData(quiz: any, preflightData: any, attempt?: any, prefetch?: boolean, siteId?: string): void | Promise { if (quiz && quiz.id && typeof preflightData.quizpassword == 'undefined') { @@ -81,9 +81,9 @@ export class AddonModQuizAccessPasswordHandler implements AddonModQuizAccessRule /** * Get a password stored in DB. * - * @param {number} quizId Quiz ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the DB entry on success. + * @param quizId Quiz ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the DB entry on success. */ protected getPasswordEntry(quizId: number, siteId?: string): Promise { @@ -97,8 +97,8 @@ export class AddonModQuizAccessPasswordHandler implements AddonModQuizAccessRule * Implement this if your access rule requires a preflight check with user interaction. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getPreflightComponent(injector: Injector): any | Promise { return AddonModQuizAccessPasswordComponent; @@ -107,7 +107,7 @@ export class AddonModQuizAccessPasswordHandler implements AddonModQuizAccessRule /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -116,11 +116,11 @@ export class AddonModQuizAccessPasswordHandler implements AddonModQuizAccessRule /** * Whether the rule requires a preflight check when prefetch/start/continue an attempt. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean|Promise} Whether the rule requires a preflight check. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Whether the rule requires a preflight check. */ isPreflightCheckRequired(quiz: any, attempt?: any, prefetch?: boolean, siteId?: string): boolean | Promise { // If there's a password stored don't require the preflight since we'll use the stored one. @@ -135,12 +135,12 @@ export class AddonModQuizAccessPasswordHandler implements AddonModQuizAccessRule /** * Function called when the preflight check has passed. This is a chance to record that fact in some way. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} attempt The attempt started/continued. - * @param {any} preflightData Preflight data gathered. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} Promise resolved when done if async, void if it's synchronous. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. + * @param preflightData Preflight data gathered. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done if async, void if it's synchronous. */ notifyPreflightCheckPassed(quiz: any, attempt: any, preflightData: any, prefetch?: boolean, siteId?: string) : void | Promise { @@ -154,12 +154,12 @@ export class AddonModQuizAccessPasswordHandler implements AddonModQuizAccessRule /** * Function called when the preflight check fails. This is a chance to record that fact in some way. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} attempt The attempt started/continued. - * @param {any} preflightData Preflight data gathered. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} Promise resolved when done if async, void if it's synchronous. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. + * @param preflightData Preflight data gathered. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done if async, void if it's synchronous. */ notifyPreflightCheckFailed?(quiz: any, attempt: any, preflightData: any, prefetch?: boolean, siteId?: string) : void | Promise { @@ -173,9 +173,9 @@ export class AddonModQuizAccessPasswordHandler implements AddonModQuizAccessRule /** * Remove a password from DB. * - * @param {number} quizId Quiz ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param quizId Quiz ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ protected removePassword(quizId: number, siteId?: string): Promise { @@ -187,10 +187,10 @@ export class AddonModQuizAccessPasswordHandler implements AddonModQuizAccessRule /** * Store a password in DB. * - * @param {number} quizId Quiz ID. - * @param {string} password Password. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param quizId Quiz ID. + * @param password Password. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ protected storePassword(quizId: number, password: string, siteId?: string): Promise { diff --git a/src/addon/mod/quiz/accessrules/safebrowser/providers/handler.ts b/src/addon/mod/quiz/accessrules/safebrowser/providers/handler.ts index b5ec88157..b17e263ea 100644 --- a/src/addon/mod/quiz/accessrules/safebrowser/providers/handler.ts +++ b/src/addon/mod/quiz/accessrules/safebrowser/providers/handler.ts @@ -31,7 +31,7 @@ export class AddonModQuizAccessSafeBrowserHandler implements AddonModQuizAccessR /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -40,11 +40,11 @@ export class AddonModQuizAccessSafeBrowserHandler implements AddonModQuizAccessR /** * Whether the rule requires a preflight check when prefetch/start/continue an attempt. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean|Promise} Whether the rule requires a preflight check. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Whether the rule requires a preflight check. */ isPreflightCheckRequired(quiz: any, attempt?: any, prefetch?: boolean, siteId?: string): boolean | Promise { return false; diff --git a/src/addon/mod/quiz/accessrules/securewindow/providers/handler.ts b/src/addon/mod/quiz/accessrules/securewindow/providers/handler.ts index d5bb5334b..218061e1f 100644 --- a/src/addon/mod/quiz/accessrules/securewindow/providers/handler.ts +++ b/src/addon/mod/quiz/accessrules/securewindow/providers/handler.ts @@ -31,7 +31,7 @@ export class AddonModQuizAccessSecureWindowHandler implements AddonModQuizAccess /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -40,11 +40,11 @@ export class AddonModQuizAccessSecureWindowHandler implements AddonModQuizAccess /** * Whether the rule requires a preflight check when prefetch/start/continue an attempt. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean|Promise} Whether the rule requires a preflight check. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Whether the rule requires a preflight check. */ isPreflightCheckRequired(quiz: any, attempt?: any, prefetch?: boolean, siteId?: string): boolean | Promise { return false; diff --git a/src/addon/mod/quiz/accessrules/timelimit/providers/handler.ts b/src/addon/mod/quiz/accessrules/timelimit/providers/handler.ts index 8ddc8083d..41a23fe40 100644 --- a/src/addon/mod/quiz/accessrules/timelimit/providers/handler.ts +++ b/src/addon/mod/quiz/accessrules/timelimit/providers/handler.ts @@ -34,8 +34,8 @@ export class AddonModQuizAccessTimeLimitHandler implements AddonModQuizAccessRul * Implement this if your access rule requires a preflight check with user interaction. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getPreflightComponent(injector: Injector): any | Promise { return AddonModQuizAccessTimeLimitComponent; @@ -44,7 +44,7 @@ export class AddonModQuizAccessTimeLimitHandler implements AddonModQuizAccessRul /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -53,11 +53,11 @@ export class AddonModQuizAccessTimeLimitHandler implements AddonModQuizAccessRul /** * Whether the rule requires a preflight check when prefetch/start/continue an attempt. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean|Promise} Whether the rule requires a preflight check. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Whether the rule requires a preflight check. */ isPreflightCheckRequired(quiz: any, attempt?: any, prefetch?: boolean, siteId?: string): boolean | Promise { // Warning only required if the attempt is not already started. @@ -67,10 +67,10 @@ export class AddonModQuizAccessTimeLimitHandler implements AddonModQuizAccessRul /** * Whether or not the time left of an attempt should be displayed. * - * @param {any} attempt The attempt. - * @param {number} endTime The attempt end time (in seconds). - * @param {number} timeNow The current time in seconds. - * @return {boolean} Whether it should be displayed. + * @param attempt The attempt. + * @param endTime The attempt end time (in seconds). + * @param timeNow The current time in seconds. + * @return Whether it should be displayed. */ shouldShowTimeLeft(attempt: any, endTime: number, timeNow: number): boolean { // If this is a teacher preview after the time limit expires, don't show the time left. diff --git a/src/addon/mod/quiz/classes/auto-save.ts b/src/addon/mod/quiz/classes/auto-save.ts index 9d31a9ab3..8a7be1f77 100644 --- a/src/addon/mod/quiz/classes/auto-save.ts +++ b/src/addon/mod/quiz/classes/auto-save.ts @@ -38,12 +38,12 @@ export class AddonModQuizAutoSave { /** * Constructor. * - * @param {string} formName Name of the form where the answers are stored. - * @param {string} buttonSelector Selector to find the button to show the connection error. - * @param {CoreLoggerProvider} loggerProvider CoreLoggerProvider instance. - * @param {PopoverController} popoverCtrl PopoverController instance. - * @param {CoreQuestionHelperProvider} questionHelper CoreQuestionHelperProvider instance. - * @param {AddonModQuizProvider} quizProvider AddonModQuizProvider instance. + * @param formName Name of the form where the answers are stored. + * @param buttonSelector Selector to find the button to show the connection error. + * @param loggerProvider CoreLoggerProvider instance. + * @param popoverCtrl PopoverController instance. + * @param questionHelper CoreQuestionHelperProvider instance. + * @param quizProvider AddonModQuizProvider instance. */ constructor(protected formName: string, protected buttonSelector: string, loggerProvider: CoreLoggerProvider, protected popoverCtrl: PopoverController, protected questionHelper: CoreQuestionHelperProvider, @@ -72,10 +72,10 @@ export class AddonModQuizAutoSave { /** * Check if the answers have changed in a page. * - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @param {any} preflightData Preflight data. - * @param {boolean} [offline] Whether the quiz is being attempted in offline mode. + * @param quiz Quiz. + * @param attempt Attempt. + * @param preflightData Preflight data. + * @param offline Whether the quiz is being attempted in offline mode. */ checkChanges(quiz: any, attempt: any, preflightData: any, offline?: boolean): void { if (this.autoSaveTimeout) { @@ -110,7 +110,7 @@ export class AddonModQuizAutoSave { /** * Get answers from a form. * - * @return {any} Answers. + * @return Answers. */ protected getAnswers(): any { return this.questionHelper.getAnswersFromForm(document.forms[this.formName]); @@ -128,7 +128,7 @@ export class AddonModQuizAutoSave { * Returns an observable that will notify when an error happens or stops. * It will send true when there's an error, and false when the error has been ammended. * - * @return {BehaviorSubject} Observable. + * @return Observable. */ onError(): BehaviorSubject { return this.errorObservable; @@ -137,10 +137,10 @@ export class AddonModQuizAutoSave { /** * Schedule an auto save process if it's not scheduled already. * - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @param {any} preflightData Preflight data. - * @param {boolean} [offline] Whether the quiz is being attempted in offline mode. + * @param quiz Quiz. + * @param attempt Attempt. + * @param preflightData Preflight data. + * @param offline Whether the quiz is being attempted in offline mode. */ setAutoSaveTimer(quiz: any, attempt: any, preflightData: any, offline?: boolean): void { // Don't schedule if already shceduled or quiz is almost closed. @@ -190,10 +190,10 @@ export class AddonModQuizAutoSave { /** * Start a process to periodically check changes in answers. * - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @param {any} preflightData Preflight data. - * @param {boolean} [offline] Whether the quiz is being attempted in offline mode. + * @param quiz Quiz. + * @param attempt Attempt. + * @param preflightData Preflight data. + * @param offline Whether the quiz is being attempted in offline mode. */ startCheckChangesProcess(quiz: any, attempt: any, preflightData: any, offline?: boolean): void { if (this.checkChangesInterval || !quiz.autosaveperiod) { diff --git a/src/addon/mod/quiz/components/index/index.ts b/src/addon/mod/quiz/components/index/index.ts index cabdb8406..5aae59e52 100644 --- a/src/addon/mod/quiz/components/index/index.ts +++ b/src/addon/mod/quiz/components/index/index.ts @@ -148,10 +148,10 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Get the quiz data. * - * @param {boolean} [refresh=false] If it's refreshing content. - * @param {boolean} [sync=false] If it should try to sync. - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved when done. + * @param refresh If it's refreshing content. + * @param sync If it should try to sync. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved when done. */ protected fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { @@ -235,7 +235,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Get the user attempts in the quiz and the result info. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected getAttempts(): Promise { @@ -314,7 +314,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Get result info to show. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected getResultInfo(): Promise { @@ -370,7 +370,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Go to review an attempt that has just been finished. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected goToAutoReview(): Promise { // If we go to auto review it means an attempt was finished. Check completion status. @@ -393,8 +393,8 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Checks if sync has succeed from result sync data. * - * @param {any} result Data returned on the sync function. - * @return {boolean} If suceed or not. + * @param result Data returned on the sync function. + * @return If suceed or not. */ protected hasSyncSucceed(result: any): boolean { if (result.attemptFinished) { @@ -459,7 +459,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -482,8 +482,8 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Compares sync event data with current data to check if refresh content is needed. * - * @param {any} syncEventData Data receiven on sync observer. - * @return {boolean} True if refresh is needed, false otherwise. + * @param syncEventData Data receiven on sync observer. + * @return True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: any): boolean { if (syncEventData.attemptFinished) { @@ -510,8 +510,8 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Displays some data based on the current status. * - * @param {string} status The current status. - * @param {string} [previousStatus] The previous status. If not defined, there is no previous status. + * @param status The current status. + * @param previousStatus The previous status. If not defined, there is no previous status. */ protected showStatus(status: string, previousStatus?: string): void { this.showStatusSpinner = status == CoreConstants.DOWNLOADING; @@ -526,7 +526,7 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Performs the sync of the activity. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected sync(): Promise { return this.quizSync.syncQuiz(this.quizData, true); @@ -535,8 +535,8 @@ export class AddonModQuizIndexComponent extends CoreCourseModuleMainActivityComp /** * Treat user attempts. * - * @param {any} attempts The attempts to treat. - * @return {Promise} Promise resolved when done. + * @param attempts The attempts to treat. + * @return Promise resolved when done. */ protected treatAttempts(attempts: any): Promise { if (!attempts || !attempts.length) { diff --git a/src/addon/mod/quiz/pages/attempt/attempt.ts b/src/addon/mod/quiz/pages/attempt/attempt.ts index 8119dbea7..ea7befc58 100644 --- a/src/addon/mod/quiz/pages/attempt/attempt.ts +++ b/src/addon/mod/quiz/pages/attempt/attempt.ts @@ -57,7 +57,7 @@ export class AddonModQuizAttemptPage implements OnInit { /** * Refresh the data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ doRefresh(refresher: any): void { this.refreshData().finally(() => { @@ -68,7 +68,7 @@ export class AddonModQuizAttemptPage implements OnInit { /** * Get quiz data and attempt data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchQuizData(): Promise { return this.quizProvider.getQuizById(this.courseId, this.quizId).then((quizData) => { @@ -84,7 +84,7 @@ export class AddonModQuizAttemptPage implements OnInit { /** * Get the attempt data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchAttempt(): Promise { const promises = []; @@ -158,7 +158,7 @@ export class AddonModQuizAttemptPage implements OnInit { /** * Refresh the data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected refreshData(): Promise { const promises = []; diff --git a/src/addon/mod/quiz/pages/index/index.ts b/src/addon/mod/quiz/pages/index/index.ts index be398552e..2ad9ec51d 100644 --- a/src/addon/mod/quiz/pages/index/index.ts +++ b/src/addon/mod/quiz/pages/index/index.ts @@ -40,7 +40,7 @@ export class AddonModQuizIndexPage { /** * Update some data based on the quiz instance. * - * @param {any} quiz Quiz instance. + * @param quiz Quiz instance. */ updateData(quiz: any): void { this.title = quiz.name || this.title; diff --git a/src/addon/mod/quiz/pages/navigation-modal/navigation-modal.ts b/src/addon/mod/quiz/pages/navigation-modal/navigation-modal.ts index a01013fed..298153a42 100644 --- a/src/addon/mod/quiz/pages/navigation-modal/navigation-modal.ts +++ b/src/addon/mod/quiz/pages/navigation-modal/navigation-modal.ts @@ -30,7 +30,6 @@ export class AddonModQuizNavigationModalPage { * - Some attributes can change dynamically, and we don't want to create the modal everytime the user opens it. * - The onDidDismiss function takes a while to be called, making the app seem slow. This way we can directly call * the functions we need without having to wait for the modal to be dismissed. - * @type {any} */ pageInstance: any; @@ -51,8 +50,8 @@ export class AddonModQuizNavigationModalPage { /** * Load a certain page. * - * @param {number} page The page to load. - * @param {number} [slot] Slot of the question to scroll to. + * @param page The page to load. + * @param slot Slot of the question to scroll to. */ loadPage(page: number, slot: number): void { this.pageInstance.changePage && this.pageInstance.changePage(page, true, slot); diff --git a/src/addon/mod/quiz/pages/player/player.ts b/src/addon/mod/quiz/pages/player/player.ts index af65f378a..dc4a38a64 100644 --- a/src/addon/mod/quiz/pages/player/player.ts +++ b/src/addon/mod/quiz/pages/player/player.ts @@ -134,7 +134,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy { /** * Check if we can leave the page or not. * - * @return {boolean|Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { if (this.forceLeave) { @@ -175,7 +175,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy { /** * A behaviour button in a question was clicked (Check, Redo, ...). * - * @param {any} button Clicked button. + * @param button Clicked button. */ behaviourButtonClicked(button: any): void { // Confirm that the user really wants to do it. @@ -216,9 +216,9 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy { /** * Change the current page. If slot is supplied, try to scroll to that question. * - * @param {number} page Page to load. -1 means summary. - * @param {boolean} [fromModal] Whether the page was selected using the navigation modal. - * @param {number} [slot] Slot of the question to scroll to. + * @param page Page to load. -1 means summary. + * @param fromModal Whether the page was selected using the navigation modal. + * @param slot Slot of the question to scroll to. */ changePage(page: number, fromModal?: boolean, slot?: number): void { if (page != -1 && (this.attempt.state == AddonModQuizProvider.ATTEMPT_OVERDUE || this.attempt.finishedOffline)) { @@ -285,7 +285,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy { /** * Convenience function to get the quiz data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchData(): Promise { // Wait for any ongoing sync to finish. We won't sync a quiz while it's being played. @@ -348,9 +348,9 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy { /** * Finish an attempt, either by timeup or because the user clicked to finish it. * - * @param {boolean} [userFinish] Whether the user clicked to finish the attempt. - * @param {boolean} [timeUp] Whether the quiz time is up. - * @return {Promise} Promise resolved when done. + * @param userFinish Whether the user clicked to finish the attempt. + * @param timeUp Whether the quiz time is up. + * @return Promise resolved when done. */ finishAttempt(userFinish?: boolean, timeUp?: boolean): Promise { let promise; @@ -387,7 +387,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy { /** * Fix sequence checks of current page. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fixSequenceChecks(): Promise { // Get current page data again to get the latest sequencechecks. @@ -410,7 +410,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy { /** * Get the input answers. * - * @return {any} Object with the answers. + * @return Object with the answers. */ protected getAnswers(): any { return this.questionHelper.getAnswersFromForm(document.forms['addon-mod_quiz-player-form']); @@ -434,8 +434,8 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy { /** * Load a page questions. * - * @param {number} page The page to load. - * @return {Promise} Promise resolved when done. + * @param page The page to load. + * @return Promise resolved when done. */ protected loadPage(page: number): Promise { return this.quizProvider.getAttemptData(this.attempt.id, page, this.preflightData, this.offline, true).then((data) => { @@ -477,7 +477,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy { /** * Load attempt summary. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected loadSummary(): Promise { this.summaryQuestions = []; @@ -502,7 +502,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy { /** * Load data to navigate the questions using the navigation modal. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected loadNavigation(): Promise { // We use the attempt summary to build the navigation because it contains all the questions. @@ -520,7 +520,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy { /** * Open the navigation modal. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ openNavigation(): Promise { let promise; @@ -552,10 +552,10 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy { /** * Process attempt. * - * @param {boolean} [userFinish] Whether the user clicked to finish the attempt. - * @param {boolean} [timeUp] Whether the quiz time is up. - * @return {Promise} Promise resolved when done. - * @param {boolean} [retrying] Whether we're retrying the change. + * @param userFinish Whether the user clicked to finish the attempt. + * @param timeUp Whether the quiz time is up. + * @return Promise resolved when done. + * @param retrying Whether we're retrying the change. */ protected processAttempt(userFinish?: boolean, timeUp?: boolean, retrying?: boolean): Promise { // Get the answers to send. @@ -591,7 +591,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy { /** * Scroll to a certain question. * - * @param {number} slot Slot of the question to scroll to. + * @param slot Slot of the question to scroll to. */ protected scrollToQuestion(slot: number): void { this.domUtils.scrollToElementBySelector(this.content, '#addon-mod_quiz-question-' + slot); @@ -600,7 +600,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy { /** * Show connection error. * - * @param {Event} ev Click event. + * @param ev Click event. */ showConnectionError(ev: Event): void { this.autoSave.showAutoSaveError(ev); @@ -633,7 +633,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy { /** * Start or continue an attempt. * - * @return {Promise} [description] + * @return [description] */ protected startOrContinueAttempt(): Promise { const attempt = this.newAttempt ? undefined : this.lastAttempt; diff --git a/src/addon/mod/quiz/pages/preflight-modal/preflight-modal.ts b/src/addon/mod/quiz/pages/preflight-modal/preflight-modal.ts index 7317b528d..f832b208e 100644 --- a/src/addon/mod/quiz/pages/preflight-modal/preflight-modal.ts +++ b/src/addon/mod/quiz/pages/preflight-modal/preflight-modal.ts @@ -99,7 +99,7 @@ export class AddonModQuizPreflightModalPage implements OnInit { /** * Check that the data is valid and send it back. * - * @param {Event} e Event. + * @param e Event. */ sendData(e: Event): void { e.preventDefault(); diff --git a/src/addon/mod/quiz/pages/review/review.ts b/src/addon/mod/quiz/pages/review/review.ts index 218d7cd60..fead003f9 100644 --- a/src/addon/mod/quiz/pages/review/review.ts +++ b/src/addon/mod/quiz/pages/review/review.ts @@ -92,9 +92,9 @@ export class AddonModQuizReviewPage implements OnInit { /** * Change the current page. If slot is supplied, try to scroll to that question. * - * @param {number} page Page to load. -1 means all questions in same page. - * @param {boolean} [fromModal] Whether the page was selected using the navigation modal. - * @param {number} [slot] Slot of the question to scroll to. + * @param page Page to load. -1 means all questions in same page. + * @param fromModal Whether the page was selected using the navigation modal. + * @param slot Slot of the question to scroll to. */ changePage(page: number, fromModal?: boolean, slot?: number): void { if (typeof slot != 'undefined' && (this.attempt.currentpage == -1 || page == this.currentPage)) { @@ -127,7 +127,7 @@ export class AddonModQuizReviewPage implements OnInit { /** * Convenience function to get the quiz data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchData(): Promise { return this.quizProvider.getQuizById(this.courseId, this.quizId).then((quizData) => { @@ -151,8 +151,8 @@ export class AddonModQuizReviewPage implements OnInit { /** * Load a page questions. * - * @param {number} page The page to load. - * @return {Promise} Promise resolved when done. + * @param page The page to load. + * @return Promise resolved when done. */ protected loadPage(page: number): Promise { return this.quizProvider.getAttemptReview(this.attemptId, page).then((data) => { @@ -183,7 +183,7 @@ export class AddonModQuizReviewPage implements OnInit { /** * Load data to navigate the questions using the navigation modal. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected loadNavigation(): Promise { // Get all questions in single page to retrieve all the questions. @@ -202,7 +202,7 @@ export class AddonModQuizReviewPage implements OnInit { /** * Refreshes data. * - * @param {any} refresher Refresher + * @param refresher Refresher */ refreshData(refresher: any): void { const promises = []; @@ -221,7 +221,7 @@ export class AddonModQuizReviewPage implements OnInit { /** * Scroll to a certain question. * - * @param {number} slot Slot of the question to scroll to. + * @param slot Slot of the question to scroll to. */ protected scrollToQuestion(slot: number): void { this.domUtils.scrollToElementBySelector(this.content, '#addon-mod_quiz-question-' + slot); @@ -230,7 +230,7 @@ export class AddonModQuizReviewPage implements OnInit { /** * Calculate review summary data. * - * @param {any} data Result of getAttemptReview. + * @param data Result of getAttemptReview. */ protected setSummaryCalculatedData(data: any): void { diff --git a/src/addon/mod/quiz/providers/access-rules-delegate.ts b/src/addon/mod/quiz/providers/access-rules-delegate.ts index ace7c6c69..788f2a191 100644 --- a/src/addon/mod/quiz/providers/access-rules-delegate.ts +++ b/src/addon/mod/quiz/providers/access-rules-delegate.ts @@ -26,30 +26,29 @@ export interface AddonModQuizAccessRuleHandler extends CoreDelegateHandler { /** * Name of the rule the handler supports. E.g. 'password'. - * @type {string} */ ruleName: string; /** * Whether the rule requires a preflight check when prefetch/start/continue an attempt. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean|Promise} Whether the rule requires a preflight check. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Whether the rule requires a preflight check. */ isPreflightCheckRequired(quiz: any, attempt?: any, prefetch?: boolean, siteId?: string): boolean | Promise; /** * Add preflight data that doesn't require user interaction. The data should be added to the preflightData param. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} preflightData Object where to add the preflight data. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} Promise resolved when done if async, void if it's synchronous. + * @param quiz The quiz the rule belongs to. + * @param preflightData Object where to add the preflight data. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done if async, void if it's synchronous. */ getFixedPreflightData?(quiz: any, preflightData: any, attempt?: any, prefetch?: boolean, siteId?: string): void | Promise; @@ -58,20 +57,20 @@ export interface AddonModQuizAccessRuleHandler extends CoreDelegateHandler { * Implement this if your access rule requires a preflight check with user interaction. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getPreflightComponent?(injector: Injector): any | Promise; /** * Function called when the preflight check has passed. This is a chance to record that fact in some way. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} attempt The attempt started/continued. - * @param {any} preflightData Preflight data gathered. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} Promise resolved when done if async, void if it's synchronous. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. + * @param preflightData Preflight data gathered. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done if async, void if it's synchronous. */ notifyPreflightCheckPassed?(quiz: any, attempt: any, preflightData: any, prefetch?: boolean, siteId?: string) : void | Promise; @@ -79,12 +78,12 @@ export interface AddonModQuizAccessRuleHandler extends CoreDelegateHandler { /** * Function called when the preflight check fails. This is a chance to record that fact in some way. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} attempt The attempt started/continued. - * @param {any} preflightData Preflight data gathered. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} Promise resolved when done if async, void if it's synchronous. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. + * @param preflightData Preflight data gathered. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done if async, void if it's synchronous. */ notifyPreflightCheckFailed?(quiz: any, attempt: any, preflightData: any, prefetch?: boolean, siteId?: string) : void | Promise; @@ -92,10 +91,10 @@ export interface AddonModQuizAccessRuleHandler extends CoreDelegateHandler { /** * Whether or not the time left of an attempt should be displayed. * - * @param {any} attempt The attempt. - * @param {number} endTime The attempt end time (in seconds). - * @param {number} timeNow The current time in seconds. - * @return {boolean} Whether it should be displayed. + * @param attempt The attempt. + * @param endTime The attempt end time (in seconds). + * @param timeNow The current time in seconds. + * @return Whether it should be displayed. */ shouldShowTimeLeft?(attempt: any, endTime: number, timeNow: number): boolean; } @@ -116,8 +115,8 @@ export class AddonModQuizAccessRuleDelegate extends CoreDelegate { /** * Get the handler for a certain rule. * - * @param {string} ruleName Name of the access rule. - * @return {AddonModQuizAccessRuleHandler} Handler. Undefined if no handler found for the rule. + * @param ruleName Name of the access rule. + * @return Handler. Undefined if no handler found for the rule. */ getAccessRuleHandler(ruleName: string): AddonModQuizAccessRuleHandler { return this.getHandler(ruleName, true); @@ -126,13 +125,13 @@ export class AddonModQuizAccessRuleDelegate extends CoreDelegate { /** * Given a list of rules, get some fixed preflight data (data that doesn't require user interaction). * - * @param {string[]} rules List of active rules names. - * @param {any} quiz Quiz. - * @param {any} preflightData Object where to store the preflight data. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when all the data has been gathered. + * @param rules List of active rules names. + * @param quiz Quiz. + * @param preflightData Object where to store the preflight data. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when all the data has been gathered. */ getFixedPreflightData(rules: string[], quiz: any, preflightData: any, attempt?: any, prefetch?: boolean, siteId?: string) : Promise { @@ -153,8 +152,8 @@ export class AddonModQuizAccessRuleDelegate extends CoreDelegate { /** * Get the Component to use to display the access rule preflight. * - * @param {Injector} injector Injector. - * @return {Promise} Promise resolved with the component to use, undefined if not found. + * @param injector Injector. + * @return Promise resolved with the component to use, undefined if not found. */ getPreflightComponent(rule: string, injector: Injector): Promise { return Promise.resolve(this.executeFunctionOnEnabled(rule, 'getPreflightComponent', [injector])); @@ -163,8 +162,8 @@ export class AddonModQuizAccessRuleDelegate extends CoreDelegate { /** * Check if an access rule is supported. * - * @param {string} ruleName Name of the rule. - * @return {boolean} Whether it's supported. + * @param ruleName Name of the rule. + * @return Whether it's supported. */ isAccessRuleSupported(ruleName: string): boolean { return this.hasHandler(ruleName, true); @@ -173,12 +172,12 @@ export class AddonModQuizAccessRuleDelegate extends CoreDelegate { /** * Given a list of rules, check if preflight check is required. * - * @param {string[]} rules List of active rules names. - * @param {any} quiz Quiz. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether it's required. + * @param rules List of active rules names. + * @param quiz Quiz. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether it's required. */ isPreflightCheckRequired(rules: string[], quiz: any, attempt: any, prefetch?: boolean, siteId?: string): Promise { rules = rules || []; @@ -205,12 +204,12 @@ export class AddonModQuizAccessRuleDelegate extends CoreDelegate { /** * Check if preflight check is required for a certain rule. * - * @param {string} rule Rule name. - * @param {any} quiz Quiz. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether it's required. + * @param rule Rule name. + * @param quiz Quiz. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether it's required. */ isPreflightCheckRequiredForRule(rule: string, quiz: any, attempt: any, prefetch?: boolean, siteId?: string): Promise { return Promise.resolve(this.executeFunctionOnEnabled(rule, 'isPreflightCheckRequired', [quiz, attempt, prefetch, siteId])); @@ -219,13 +218,13 @@ export class AddonModQuizAccessRuleDelegate extends CoreDelegate { /** * Notify all rules that the preflight check has passed. * - * @param {string[]} rules List of active rules names. - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @param {any} preflightData Preflight data gathered. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param rules List of active rules names. + * @param quiz Quiz. + * @param attempt Attempt. + * @param preflightData Preflight data gathered. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ notifyPreflightCheckPassed(rules: string[], quiz: any, attempt: any, preflightData: any, prefetch?: boolean, siteId?: string) : Promise { @@ -246,13 +245,13 @@ export class AddonModQuizAccessRuleDelegate extends CoreDelegate { /** * Notify all rules that the preflight check has failed. * - * @param {string[]} rules List of active rules names. - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @param {any} preflightData Preflight data gathered. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param rules List of active rules names. + * @param quiz Quiz. + * @param attempt Attempt. + * @param preflightData Preflight data gathered. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ notifyPreflightCheckFailed(rules: string[], quiz: any, attempt: any, preflightData: any, prefetch?: boolean, siteId?: string) : Promise { @@ -273,11 +272,11 @@ export class AddonModQuizAccessRuleDelegate extends CoreDelegate { /** * Whether or not the time left of an attempt should be displayed. * - * @param {string[]} rules List of active rules names. - * @param {any} attempt The attempt. - * @param {number} endTime The attempt end time (in seconds). - * @param {number} timeNow The current time in seconds. - * @return {boolean} Whether it should be displayed. + * @param rules List of active rules names. + * @param attempt The attempt. + * @param endTime The attempt end time (in seconds). + * @param timeNow The current time in seconds. + * @return Whether it should be displayed. */ shouldShowTimeLeft(rules: string[], attempt: any, endTime: number, timeNow: number): boolean { rules = rules || []; diff --git a/src/addon/mod/quiz/providers/grade-link-handler.ts b/src/addon/mod/quiz/providers/grade-link-handler.ts index 1cb006b8c..1775139e2 100644 --- a/src/addon/mod/quiz/providers/grade-link-handler.ts +++ b/src/addon/mod/quiz/providers/grade-link-handler.ts @@ -36,11 +36,11 @@ export class AddonModQuizGradeLinkHandler extends CoreContentLinksModuleGradeHan * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return this.quizProvider.isPluginEnabled(); diff --git a/src/addon/mod/quiz/providers/helper.ts b/src/addon/mod/quiz/providers/helper.ts index 71897ff50..96683ce00 100644 --- a/src/addon/mod/quiz/providers/helper.ts +++ b/src/addon/mod/quiz/providers/helper.ts @@ -40,16 +40,16 @@ export class AddonModQuizHelperProvider { * Validate a preflight data or show a modal to input the preflight data if required. * It calls AddonModQuizProvider.startAttempt if a new attempt is needed. * - * @param {any} quiz Quiz. - * @param {any} accessInfo Quiz access info returned by AddonModQuizProvider.getQuizAccessInformation. - * @param {any} preflightData Object where to store the preflight data. - * @param {any} [attempt] Attempt to continue. Don't pass any value if the user needs to start a new attempt. - * @param {boolean} [offline] Whether the attempt is offline. - * @param {boolean} [prefetch] Whether user is prefetching. - * @param {string} [title] The title to display in the modal and in the submit button. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [retrying] Whether we're retrying after a failure. - * @return {Promise} Promise resolved when the preflight data is validated. The resolve param is the attempt. + * @param quiz Quiz. + * @param accessInfo Quiz access info returned by AddonModQuizProvider.getQuizAccessInformation. + * @param preflightData Object where to store the preflight data. + * @param attempt Attempt to continue. Don't pass any value if the user needs to start a new attempt. + * @param offline Whether the attempt is offline. + * @param prefetch Whether user is prefetching. + * @param title The title to display in the modal and in the submit button. + * @param siteId Site ID. If not defined, current site. + * @param retrying Whether we're retrying after a failure. + * @return Promise resolved when the preflight data is validated. The resolve param is the attempt. */ getAndCheckPreflightData(quiz: any, accessInfo: any, preflightData: any, attempt: any, offline?: boolean, prefetch?: boolean, title?: string, siteId?: string, retrying?: boolean): Promise { @@ -101,13 +101,13 @@ export class AddonModQuizHelperProvider { /** * Get the preflight data from the user using a modal. * - * @param {any} quiz Quiz. - * @param {any} accessInfo Quiz access info returned by AddonModQuizProvider.getQuizAccessInformation. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [title] The title to display in the modal and in the submit button. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the preflight data. Rejected if user cancels. + * @param quiz Quiz. + * @param accessInfo Quiz access info returned by AddonModQuizProvider.getQuizAccessInformation. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param title The title to display in the modal and in the submit button. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the preflight data. Rejected if user cancels. */ getPreflightData(quiz: any, accessInfo: any, attempt: any, prefetch?: boolean, title?: string, siteId?: string): Promise { const notSupported: string[] = []; @@ -152,8 +152,8 @@ export class AddonModQuizHelperProvider { * Gets the mark string from a question HTML. * Example result: "Marked out of 1.00". * - * @param {string} html Question's HTML. - * @return {string} Question's mark. + * @param html Question's HTML. + * @return Question's mark. */ getQuestionMarkFromHtml(html: string): string { const element = this.domUtils.convertToElement(html); @@ -164,9 +164,9 @@ export class AddonModQuizHelperProvider { /** * Get a quiz ID by attempt ID. * - * @param {number} attemptId Attempt ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the quiz ID. + * @param attemptId Attempt ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the quiz ID. */ getQuizIdByAttemptId(attemptId: number, siteId?: string): Promise { // Use getAttemptReview to retrieve the quiz ID. @@ -182,13 +182,13 @@ export class AddonModQuizHelperProvider { /** * Handle a review link. * - * @param {NavController} navCtrl Nav controller, can be undefined/null. - * @param {number} attemptId Attempt ID. - * @param {number} [page] Page to load, -1 to all questions in same page. - * @param {number} [courseId] Course ID. - * @param {number} [quizId] Quiz ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param navCtrl Nav controller, can be undefined/null. + * @param attemptId Attempt ID. + * @param page Page to load, -1 to all questions in same page. + * @param courseId Course ID. + * @param quizId Quiz ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ handleReviewLink(navCtrl: NavController, attemptId: number, page?: number, courseId?: number, quizId?: number, siteId?: string): Promise { @@ -234,10 +234,10 @@ export class AddonModQuizHelperProvider { /** * Add some calculated data to the attempt. * - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @param {boolean} highlight Whether we should check if attempt should be highlighted. - * @param {number} [bestGrade] Quiz's best grade (formatted). Required if highlight=true. + * @param quiz Quiz. + * @param attempt Attempt. + * @param highlight Whether we should check if attempt should be highlighted. + * @param bestGrade Quiz's best grade (formatted). Required if highlight=true. */ setAttemptCalculatedData(quiz: any, attempt: any, highlight?: boolean, bestGrade?: string): void { @@ -265,8 +265,8 @@ export class AddonModQuizHelperProvider { /** * Add some calculated data to the quiz. * - * @param {any} quiz Quiz. - * @param {any} options Options returned by AddonModQuizProvider.getCombinedReviewOptions. + * @param quiz Quiz. + * @param options Options returned by AddonModQuizProvider.getCombinedReviewOptions. */ setQuizCalculatedData(quiz: any, options: any): void { quiz.sumGradesFormatted = this.quizProvider.formatGrade(quiz.sumgrades, quiz.decimalpoints); @@ -282,16 +282,16 @@ export class AddonModQuizHelperProvider { /** * Validate the preflight data. It calls AddonModQuizProvider.startAttempt if a new attempt is needed. * - * @param {any} quiz Quiz. - * @param {any} accessInfo Quiz access info returned by AddonModQuizProvider.getQuizAccessInformation. - * @param {any} preflightData Object where to store the preflight data. - * @param {any} [attempt] Attempt to continue. Don't pass any value if the user needs to start a new attempt. - * @param {boolean} [offline] Whether the attempt is offline. - * @param {boolean} [sent] Whether preflight data has been entered by the user. - * @param {boolean} [prefetch] Whether user is prefetching. - * @param {string} [title] The title to display in the modal and in the submit button. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the preflight data is validated. + * @param quiz Quiz. + * @param accessInfo Quiz access info returned by AddonModQuizProvider.getQuizAccessInformation. + * @param preflightData Object where to store the preflight data. + * @param attempt Attempt to continue. Don't pass any value if the user needs to start a new attempt. + * @param offline Whether the attempt is offline. + * @param sent Whether preflight data has been entered by the user. + * @param prefetch Whether user is prefetching. + * @param title The title to display in the modal and in the submit button. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the preflight data is validated. */ validatePreflightData(quiz: any, accessInfo: any, preflightData: any, attempt: any, offline?: boolean, prefetch?: boolean, siteId?: string): Promise { diff --git a/src/addon/mod/quiz/providers/index-link-handler.ts b/src/addon/mod/quiz/providers/index-link-handler.ts index e3181f2b8..cb39371ad 100644 --- a/src/addon/mod/quiz/providers/index-link-handler.ts +++ b/src/addon/mod/quiz/providers/index-link-handler.ts @@ -32,11 +32,11 @@ export class AddonModQuizIndexLinkHandler extends CoreContentLinksModuleIndexHan * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return this.quizProvider.isPluginEnabled(); diff --git a/src/addon/mod/quiz/providers/module-handler.ts b/src/addon/mod/quiz/providers/module-handler.ts index f3b484ce9..cf8ea190f 100644 --- a/src/addon/mod/quiz/providers/module-handler.ts +++ b/src/addon/mod/quiz/providers/module-handler.ts @@ -46,7 +46,7 @@ export class AddonModQuizModuleHandler implements CoreCourseModuleHandler { /** * 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 { return true; @@ -55,10 +55,10 @@ export class AddonModQuizModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { return { @@ -80,9 +80,9 @@ export class AddonModQuizModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModQuizIndexComponent; diff --git a/src/addon/mod/quiz/providers/prefetch-handler.ts b/src/addon/mod/quiz/providers/prefetch-handler.ts index 132dd3f09..a06d15541 100644 --- a/src/addon/mod/quiz/providers/prefetch-handler.ts +++ b/src/addon/mod/quiz/providers/prefetch-handler.ts @@ -53,12 +53,12 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Download the module. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {boolean} [canStart=true] If true, start a new attempt if needed. - * @return {Promise} Promise resolved when all content is downloaded. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param dirPath Path of the directory where to store all the content files. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param canStart If true, start a new attempt if needed. + * @return Promise resolved when all content is downloaded. */ download(module: any, courseId: number, dirPath?: string, single?: boolean, canStart: boolean = true): Promise { // Same implementation for download and prefetch. @@ -68,10 +68,10 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Get list of files. If not defined, we'll assume they're in module.contents. * - * @param {any} module Module. - * @param {Number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise} Promise resolved with the list of files. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved with the list of files. */ getFiles(module: any, courseId: number, single?: boolean): Promise { return this.quizProvider.getQuiz(courseId, module.id).then((quiz) => { @@ -91,9 +91,9 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Get the list of downloadable files on feedback attemptss. * - * @param {any} quiz Quiz. - * @param {any[]} attempts Quiz user attempts. - * @return {Promise} List of Files. + * @param quiz Quiz. + * @param attempts Quiz user attempts. + * @return List of Files. */ protected getAttemptsFeedbackFiles(quiz: any, attempts: any[]): Promise { // We have quiz data, now we'll get specific data for each attempt. @@ -128,13 +128,13 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Gather some preflight data for an attempt. This function will start a new attempt if needed. * - * @param {any} quiz Quiz. - * @param {any} accessInfo Quiz access info returned by AddonModQuizProvider.getQuizAccessInformation. - * @param {any} [attempt] Attempt to continue. Don't pass any value if the user needs to start a new attempt. - * @param {boolean} [askPreflight] Whether it should ask for preflight data if needed. - * @param {string} [modalTitle] Lang key of the title to set to preflight modal (e.g. 'addon.mod_quiz.startattempt'). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the preflight data. + * @param quiz Quiz. + * @param accessInfo Quiz access info returned by AddonModQuizProvider.getQuizAccessInformation. + * @param attempt Attempt to continue. Don't pass any value if the user needs to start a new attempt. + * @param askPreflight Whether it should ask for preflight data if needed. + * @param modalTitle Lang key of the title to set to preflight modal (e.g. 'addon.mod_quiz.startattempt'). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the preflight data. */ getPreflightData(quiz: any, accessInfo: any, attempt?: any, askPreflight?: boolean, title?: string, siteId?: string) : Promise { @@ -165,9 +165,9 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId The course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId The course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.quizProvider.invalidateContent(moduleId, courseId); @@ -176,9 +176,9 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Invalidate WS calls needed to determine module status. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule(module: any, courseId: number): Promise { // Invalidate the calls required to check if a quiz is downloadable. @@ -193,9 +193,9 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Check if a module can be downloaded. If the function is not defined, we assume that all modules are downloadable. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {boolean|Promise} Whether the module can be downloaded. The promise should never be rejected. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Whether the module can be downloaded. The promise should never be rejected. */ isDownloadable(module: any, courseId: number): boolean | Promise { if (this.sitesProvider.getCurrentSite().isOfflineDisabled()) { @@ -222,7 +222,7 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ isEnabled(): boolean | Promise { return this.quizProvider.isPluginEnabled(); @@ -231,12 +231,12 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @param {boolean} [canStart=true] If true, start a new attempt if needed. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @param canStart If true, start a new attempt if needed. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string, canStart: boolean = true): Promise { if (module.attemptFinished) { @@ -254,12 +254,12 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Prefetch a quiz. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} single True if we're downloading a single module, false if we're downloading a whole section. - * @param {String} siteId Site ID. - * @param {boolean} canStart If true, start a new attempt if needed. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. + * @param canStart If true, start a new attempt if needed. + * @return Promise resolved when done. */ protected prefetchQuiz(module: any, courseId: number, single: boolean, siteId: string, canStart: boolean): Promise { let attempts: any[], @@ -385,11 +385,11 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Prefetch all WS data for an attempt. * - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @param {any} preflightData Preflight required data (like password). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the prefetch is finished. Data returned is not reliable. + * @param quiz Quiz. + * @param attempt Attempt. + * @param preflightData Preflight required data (like password). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the prefetch is finished. Data returned is not reliable. */ prefetchAttempt(quiz: any, attempt: any, preflightData: any, siteId?: string): Promise { const pages = this.quizProvider.getPagesFromLayout(attempt.layout), @@ -462,10 +462,10 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl * Prefetches some data for a quiz and its last attempt. * This function will NOT start a new attempt, it only reads data for the quiz and the last attempt. * - * @param {any} quiz Quiz. - * @param {boolean} [askPreflight] Whether it should ask for preflight data if needed. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param quiz Quiz. + * @param askPreflight Whether it should ask for preflight data if needed. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ prefetchQuizAndLastAttempt(quiz: any, askPreflight?: boolean, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -523,13 +523,13 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl * Set the right status to a quiz after prefetching. * If the last attempt is finished or there isn't one, set it as not downloaded to show download icon. * - * @param {any} quiz Quiz. - * @param {any[]} [attempts] List of attempts. If not provided, they will be calculated. - * @param {boolean} [forceCache] Whether it should always return cached data. Only if attempts is undefined. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). Only if - * attempts is undefined. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param quiz Quiz. + * @param attempts List of attempts. If not provided, they will be calculated. + * @param forceCache Whether it should always return cached data. Only if attempts is undefined. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). Only if + * attempts is undefined. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ setStatusAfterPrefetch(quiz: any, attempts?: any[], forceCache?: boolean, ignoreCache?: boolean, siteId?: string) : Promise { @@ -567,10 +567,10 @@ export class AddonModQuizPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Sync a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ sync(module: any, courseId: number, siteId?: any): Promise { if (!this.syncProvider) { diff --git a/src/addon/mod/quiz/providers/push-click-handler.ts b/src/addon/mod/quiz/providers/push-click-handler.ts index 43397a59b..05958945f 100644 --- a/src/addon/mod/quiz/providers/push-click-handler.ts +++ b/src/addon/mod/quiz/providers/push-click-handler.ts @@ -38,8 +38,8 @@ export class AddonModQuizPushClickHandler implements CorePushNotificationsClickH /** * Check if a notification click is handled by this handler. * - * @param {any} notification The notification to check. - * @return {boolean} Whether the notification click is handled by this handler + * @param notification The notification to check. + * @return Whether the notification click is handled by this handler */ handles(notification: any): boolean | Promise { return this.utils.isTrueOrOne(notification.notif) && notification.moodlecomponent == 'mod_quiz' && @@ -49,8 +49,8 @@ export class AddonModQuizPushClickHandler implements CorePushNotificationsClickH /** * Handle the notification click. * - * @param {any} notification The notification to check. - * @return {Promise} Promise resolved when done. + * @param notification The notification to check. + * @return Promise resolved when done. */ handleClick(notification: any): Promise { const contextUrlParams = this.urlUtils.extractUrlParams(notification.contexturl), diff --git a/src/addon/mod/quiz/providers/quiz-offline.ts b/src/addon/mod/quiz/providers/quiz-offline.ts index b7fe048d2..e52cc1da6 100644 --- a/src/addon/mod/quiz/providers/quiz-offline.ts +++ b/src/addon/mod/quiz/providers/quiz-offline.ts @@ -93,8 +93,8 @@ export class AddonModQuizOfflineProvider { /** * Classify the answers in questions. * - * @param {any} answers List of answers. - * @return {any} Object with the questions, the keys are the slot. Each question contains its answers. + * @param answers List of answers. + * @return Object with the questions, the keys are the slot. Each question contains its answers. */ classifyAnswersInQuestions(answers: any): any { const questionsWithAnswers = {}; @@ -120,8 +120,8 @@ export class AddonModQuizOfflineProvider { * Given a list of questions with answers classified in it (@see AddonModQuizOfflineProvider.classifyAnswersInQuestions), * returns a list of answers (including prefix in the name). * - * @param {any} questions Questions. - * @return {any} Answers. + * @param questions Questions. + * @return Answers. */ extractAnswersFromQuestions(questions: any): any { const answers = {}; @@ -140,8 +140,8 @@ export class AddonModQuizOfflineProvider { /** * Get all the offline attempts in a certain site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the offline attempts. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the offline attempts. */ getAllAttempts(siteId?: string): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -152,9 +152,9 @@ export class AddonModQuizOfflineProvider { /** * Retrieve an attempt answers from site DB. * - * @param {number} attemptId Attempt ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the answers. + * @param attemptId Attempt ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the answers. */ getAttemptAnswers(attemptId: number, siteId?: string): Promise { return this.questionProvider.getAttemptAnswers(AddonModQuizProvider.COMPONENT, attemptId, siteId); @@ -163,9 +163,9 @@ export class AddonModQuizOfflineProvider { /** * Retrieve an attempt from site DB. * - * @param {number} attemptId Attempt ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the attempt. + * @param attemptId Attempt ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the attempt. */ getAttemptById(attemptId: number, siteId?: string): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -176,10 +176,10 @@ export class AddonModQuizOfflineProvider { /** * Retrieve an attempt from site DB. * - * @param {number} attemptId Attempt ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, user current site's user. - * @return {Promise} Promise resolved with the attempts. + * @param attemptId Attempt ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, user current site's user. + * @return Promise resolved with the attempts. */ getQuizAttempts(quizId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -192,10 +192,10 @@ export class AddonModQuizOfflineProvider { /** * Load local state in the questions. * - * @param {number} attemptId Attempt ID. - * @param {any[]} questions List of questions. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param attemptId Attempt ID. + * @param questions List of questions. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ loadQuestionsLocalStates(attemptId: number, questions: any[], siteId?: string): Promise { const promises = []; @@ -220,13 +220,13 @@ export class AddonModQuizOfflineProvider { /** * Process an attempt, saving its data. * - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @param {any} questions Object with the questions of the quiz. The keys should be the question slot. - * @param {any} data Data to save. - * @param {boolean} [finish] Whether to finish the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success, rejected otherwise. + * @param quiz Quiz. + * @param attempt Attempt. + * @param questions Object with the questions of the quiz. The keys should be the question slot. + * @param data Data to save. + * @param finish Whether to finish the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success, rejected otherwise. */ processAttempt(quiz: any, attempt: any, questions: any, data: any, finish?: boolean, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -265,9 +265,9 @@ export class AddonModQuizOfflineProvider { /** * Remove an attempt and its answers from local DB. * - * @param {number} attemptId Attempt ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param attemptId Attempt ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ removeAttemptAndAnswers(attemptId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -289,10 +289,10 @@ export class AddonModQuizOfflineProvider { /** * Remove a question and its answers from local DB. * - * @param {number} attemptId Attempt ID. - * @param {number} slot Question slot. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when finished. + * @param attemptId Attempt ID. + * @param slot Question slot. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when finished. */ removeQuestionAndAnswers(attemptId: number, slot: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -308,13 +308,13 @@ export class AddonModQuizOfflineProvider { /** * Save an attempt's answers and calculate state for questions modified. * - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @param {any} questions Object with the questions of the quiz. The keys should be the question slot. - * @param {any} answers Answers to save. - * @param {number} [timeMod] Time modified to set in the answers. If not defined, current time. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param quiz Quiz. + * @param attempt Attempt. + * @param questions Object with the questions of the quiz. The keys should be the question slot. + * @param answers Answers to save. + * @param timeMod Time modified to set in the answers. If not defined, current time. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ saveAnswers(quiz: any, attempt: any, questions: any, answers: any, timeMod?: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -376,10 +376,10 @@ export class AddonModQuizOfflineProvider { /** * Set attempt's current page. * - * @param {number} attemptId Attempt ID. - * @param {number} page Page to set. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success, rejected otherwise. + * @param attemptId Attempt ID. + * @param page Page to set. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success, rejected otherwise. */ setAttemptCurrentPage(attemptId: number, page: number, siteId?: string): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { diff --git a/src/addon/mod/quiz/providers/quiz-sync.ts b/src/addon/mod/quiz/providers/quiz-sync.ts index 9f7226e9d..881cb4f81 100644 --- a/src/addon/mod/quiz/providers/quiz-sync.ts +++ b/src/addon/mod/quiz/providers/quiz-sync.ts @@ -37,13 +37,11 @@ import { AddonModQuizPrefetchHandler } from './prefetch-handler'; export interface AddonModQuizSyncResult { /** * List of warnings. - * @type {string[]} */ warnings: string[]; /** * Whether an attempt was finished in the site due to the sync, - * @type {boolean} */ attemptFinished: boolean; } @@ -75,16 +73,16 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider /** * Finish a sync process: remove offline data if needed, prefetch quiz data, set sync time and return the result. * - * @param {string} siteId Site ID. - * @param {any} quiz Quiz. - * @param {number} courseId Course ID. - * @param {string[]} warnings List of warnings generated by the sync. - * @param {number} [attemptId] Last attempt ID. - * @param {any} [offlineAttempt] Offline attempt synchronized, if any. - * @param {any} [onlineAttempt] Online data for the offline attempt. - * @param {boolean} [removeAttempt] Whether the offline data should be removed. - * @param {boolean} [updated] Whether some data was sent to the site. - * @return {Promise} Promise resolved on success. + * @param siteId Site ID. + * @param quiz Quiz. + * @param courseId Course ID. + * @param warnings List of warnings generated by the sync. + * @param attemptId Last attempt ID. + * @param offlineAttempt Offline attempt synchronized, if any. + * @param onlineAttempt Online data for the offline attempt. + * @param removeAttempt Whether the offline data should be removed. + * @param updated Whether some data was sent to the site. + * @return Promise resolved on success. */ protected finishSync(siteId: string, quiz: any, courseId: number, warnings: string[], attemptId?: number, offlineAttempt?: any, onlineAttempt?: any, removeAttempt?: boolean, updated?: boolean): Promise { @@ -139,9 +137,9 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider /** * Check if a quiz has data to synchronize. * - * @param {number} quizId Quiz ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether it has data to sync. + * @param quizId Quiz ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether it has data to sync. */ hasDataToSync(quizId: number, siteId?: string): Promise { return this.quizOfflineProvider.getQuizAttempts(quizId, siteId).then((attempts) => { @@ -154,12 +152,12 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider /** * Conveniece function to prefetch data after an update. * - * @param {any} module Module. - * @param {any} quiz Quiz. - * @param {number} courseId Course ID. - * @param {RegExp} [regex] If regex matches, don't download the data. Defaults to check files. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param quiz Quiz. + * @param courseId Course ID. + * @param regex If regex matches, don't download the data. Defaults to check files. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ prefetchAfterUpdateQuiz(module: any, quiz: any, courseId: number, regex?: RegExp, siteId?: string): Promise { regex = regex || /^.*files$/; @@ -189,9 +187,9 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider /** * Try to synchronize all the quizzes in a certain site or in all sites. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncAllQuizzes(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all quizzes', this.syncAllQuizzesFunc.bind(this), [force], siteId); @@ -200,9 +198,9 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider /** * Sync all quizzes on a site. * - * @param {string} siteId Site ID to sync. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @param {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. + * @param force Wether to force sync not depending on last execution. + * @param Promise resolved if sync is successful, rejected if sync fails. */ protected syncAllQuizzesFunc(siteId?: string, force?: boolean): Promise { // Get all offline attempts. @@ -261,10 +259,10 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider /** * Sync a quiz only if a certain time has passed since the last time. * - * @param {any} quiz Quiz. - * @param {boolean} [askPreflight] Whether we should ask for preflight data if needed. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the quiz is synced or if it doesn't need to be synced. + * @param quiz Quiz. + * @param askPreflight Whether we should ask for preflight data if needed. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the quiz is synced or if it doesn't need to be synced. */ syncQuizIfNeeded(quiz: any, askPreflight?: boolean, siteId?: string): Promise { return this.isSyncNeeded(quiz.id, siteId).then((needed) => { @@ -278,10 +276,10 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider * Try to synchronize a quiz. * The promise returned will be resolved with an array with warnings if the synchronization is successful. * - * @param {any} quiz Quiz. - * @param {boolean} [askPreflight] Whether we should ask for preflight data if needed. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success. + * @param quiz Quiz. + * @param askPreflight Whether we should ask for preflight data if needed. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success. */ syncQuiz(quiz: any, askPreflight?: boolean, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -414,11 +412,11 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider /** * Validate questions, discarding the offline answers that can't be synchronized. * - * @param {number} attemptId Attempt ID. - * @param {any} onlineQuestions Online questions - * @param {any} offlineQuestions Offline questions. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if some offline data was discarded, false otherwise. + * @param attemptId Attempt ID. + * @param onlineQuestions Online questions + * @param offlineQuestions Offline questions. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if some offline data was discarded, false otherwise. */ validateQuestions(attemptId: number, onlineQuestions: any, offlineQuestions: any, siteId?: string): Promise { const promises = []; diff --git a/src/addon/mod/quiz/providers/quiz.ts b/src/addon/mod/quiz/providers/quiz.ts index 114963f9e..b13182ef8 100644 --- a/src/addon/mod/quiz/providers/quiz.ts +++ b/src/addon/mod/quiz/providers/quiz.ts @@ -72,9 +72,9 @@ export class AddonModQuizProvider { /** * Formats a grade to be displayed. * - * @param {number} grade Grade. - * @param {number} decimals Decimals to use. - * @return {string} Grade to display. + * @param grade Grade. + * @param decimals Decimals to use. + * @return Grade to display. */ formatGrade(grade: number, decimals: number): string { if (typeof grade == 'undefined' || grade == -1 || grade === null) { @@ -87,14 +87,14 @@ export class AddonModQuizProvider { /** * Get attempt questions. Returns all of them or just the ones in certain pages. * - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @param {any} preflightData Preflight required data (like password). - * @param {number[]} [pages] List of pages to get. If not defined, all pages. - * @param {boolean} [offline] Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the questions. + * @param quiz Quiz. + * @param attempt Attempt. + * @param preflightData Preflight required data (like password). + * @param pages List of pages to get. If not defined, all pages. + * @param offline Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the questions. */ getAllQuestionsData(quiz: any, attempt: any, preflightData: any, pages?: number[], offline?: boolean, ignoreCache?: boolean, siteId?: string): Promise { @@ -130,9 +130,9 @@ export class AddonModQuizProvider { /** * Get cache key for get attempt access information WS calls. * - * @param {number} quizId Quiz ID. - * @param {number} attemptId Attempt ID. - * @return {string} Cache key. + * @param quizId Quiz ID. + * @param attemptId Attempt ID. + * @return Cache key. */ protected getAttemptAccessInformationCacheKey(quizId: number, attemptId: number): string { return this.getAttemptAccessInformationCommonCacheKey(quizId) + ':' + attemptId; @@ -141,8 +141,8 @@ export class AddonModQuizProvider { /** * Get common cache key for get attempt access information WS calls. * - * @param {number} quizId Quiz ID. - * @return {string} Cache key. + * @param quizId Quiz ID. + * @return Cache key. */ protected getAttemptAccessInformationCommonCacheKey(quizId: number): string { return this.ROOT_CACHE_KEY + 'attemptAccessInformation:' + quizId; @@ -151,12 +151,12 @@ export class AddonModQuizProvider { /** * Get access information for an attempt. * - * @param {number} quizId Quiz ID. - * @param {number} attemptId Attempt ID. 0 for user's last attempt. - * @param {boolean} offline Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the access information. + * @param quizId Quiz ID. + * @param attemptId Attempt ID. 0 for user's last attempt. + * @param offline Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the access information. */ getAttemptAccessInformation(quizId: number, attemptId: number, offline?: boolean, ignoreCache?: boolean, siteId?: string) : Promise { @@ -184,9 +184,9 @@ export class AddonModQuizProvider { /** * Get cache key for get attempt data WS calls. * - * @param {number} attemptId Attempt ID. - * @param {number} page Page. - * @return {string} Cache key. + * @param attemptId Attempt ID. + * @param page Page. + * @return Cache key. */ protected getAttemptDataCacheKey(attemptId: number, page: number): string { return this.getAttemptDataCommonCacheKey(attemptId) + ':' + page; @@ -195,8 +195,8 @@ export class AddonModQuizProvider { /** * Get common cache key for get attempt data WS calls. * - * @param {number} attemptId Attempt ID. - * @return {string} Cache key. + * @param attemptId Attempt ID. + * @return Cache key. */ protected getAttemptDataCommonCacheKey(attemptId: number): string { return this.ROOT_CACHE_KEY + 'attemptData:' + attemptId; @@ -205,13 +205,13 @@ export class AddonModQuizProvider { /** * Get an attempt's data. * - * @param {number} attemptId Attempt ID. - * @param {number} page Page number. - * @param {any} preflightData Preflight required data (like password). - * @param {boolean} [offline] Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the attempt data. + * @param attemptId Attempt ID. + * @param page Page number. + * @param preflightData Preflight required data (like password). + * @param offline Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the attempt data. */ getAttemptData(attemptId: number, page: number, preflightData: any, offline?: boolean, ignoreCache?: boolean, siteId?: string) : Promise { @@ -240,9 +240,9 @@ export class AddonModQuizProvider { /** * Get an attempt's due date. * - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @return {number} Attempt's due date, 0 if no due date or invalid data. + * @param quiz Quiz. + * @param attempt Attempt. + * @return Attempt's due date, 0 if no due date or invalid data. */ getAttemptDueDate(quiz: any, attempt: any): number { const deadlines = []; @@ -281,9 +281,9 @@ export class AddonModQuizProvider { /** * Get an attempt's warning because of due date. * - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @return {string} Attempt's warning, undefined if no due date. + * @param quiz Quiz. + * @param attempt Attempt. + * @return Attempt's warning, undefined if no due date. */ getAttemptDueDateWarning(quiz: any, attempt: any): string { const dueDate = this.getAttemptDueDate(quiz, attempt); @@ -298,9 +298,9 @@ export class AddonModQuizProvider { /** * Turn attempt's state into a readable state, including some extra data depending on the state. * - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @return {string[]} List of state sentences. + * @param quiz Quiz. + * @param attempt Attempt. + * @return List of state sentences. */ getAttemptReadableState(quiz: any, attempt: any): string[] { if (attempt.finishedOffline) { @@ -342,8 +342,8 @@ export class AddonModQuizProvider { /** * Turn attempt's state into a readable state name, without any more data. * - * @param {string} state State. - * @return {string} Readable state name. + * @param state State. + * @return Readable state name. */ getAttemptReadableStateName(state: string): string { switch (state) { @@ -367,9 +367,9 @@ export class AddonModQuizProvider { /** * Get cache key for get attempt review WS calls. * - * @param {number} attemptId Attempt ID. - * @param {number} page Page. - * @return {string} Cache key. + * @param attemptId Attempt ID. + * @param page Page. + * @return Cache key. */ protected getAttemptReviewCacheKey(attemptId: number, page: number): string { return this.getAttemptReviewCommonCacheKey(attemptId) + ':' + page; @@ -378,8 +378,8 @@ export class AddonModQuizProvider { /** * Get common cache key for get attempt review WS calls. * - * @param {number} attemptId Attempt ID. - * @return {string} Cache key. + * @param attemptId Attempt ID. + * @return Cache key. */ protected getAttemptReviewCommonCacheKey(attemptId: number): string { return this.ROOT_CACHE_KEY + 'attemptReview:' + attemptId; @@ -388,11 +388,11 @@ export class AddonModQuizProvider { /** * Get an attempt's review. * - * @param {number} attemptId Attempt ID. - * @param {number} [page] Page number. If not defined, return all the questions in all the pages. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the attempt review. + * @param attemptId Attempt ID. + * @param page Page number. If not defined, return all the questions in all the pages. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the attempt review. */ getAttemptReview(attemptId: number, page?: number, ignoreCache?: boolean, siteId?: string): Promise { if (typeof page == 'undefined') { @@ -421,8 +421,8 @@ export class AddonModQuizProvider { /** * Get cache key for get attempt summary WS calls. * - * @param {number} attemptId Attempt ID. - * @return {string} Cache key. + * @param attemptId Attempt ID. + * @return Cache key. */ protected getAttemptSummaryCacheKey(attemptId: number): string { return this.ROOT_CACHE_KEY + 'attemptSummary:' + attemptId; @@ -431,13 +431,13 @@ export class AddonModQuizProvider { /** * Get an attempt's summary. * - * @param {number} attemptId Attempt ID. - * @param {any} preflightData Preflight required data (like password). - * @param {boolean} [offline] Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {boolean} [loadLocal] Whether it should load local state for each question. Only applicable if offline=true. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the list of questions for the attempt summary. + * @param attemptId Attempt ID. + * @param preflightData Preflight required data (like password). + * @param offline Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param loadLocal Whether it should load local state for each question. Only applicable if offline=true. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of questions for the attempt summary. */ getAttemptSummary(attemptId: number, preflightData: any, offline?: boolean, ignoreCache?: boolean, loadLocal?: boolean, siteId?: string): Promise { @@ -475,9 +475,9 @@ export class AddonModQuizProvider { /** * Get cache key for get combined review options WS calls. * - * @param {number} quizId Quiz ID. - * @param {number} userId User ID. - * @return {string} Cache key. + * @param quizId Quiz ID. + * @param userId User ID. + * @return Cache key. */ protected getCombinedReviewOptionsCacheKey(quizId: number, userId: number): string { return this.getCombinedReviewOptionsCommonCacheKey(quizId) + ':' + userId; @@ -486,8 +486,8 @@ export class AddonModQuizProvider { /** * Get common cache key for get combined review options WS calls. * - * @param {number} quizId Quiz ID. - * @return {string} Cache key. + * @param quizId Quiz ID. + * @return Cache key. */ protected getCombinedReviewOptionsCommonCacheKey(quizId: number): string { return this.ROOT_CACHE_KEY + 'combinedReviewOptions:' + quizId; @@ -496,11 +496,11 @@ export class AddonModQuizProvider { /** * Get a quiz combined review options. * - * @param {number} quizId Quiz ID. - * @param {boolean} [ignoreCache] Whether 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 {number} [userId] User ID. If not defined use site's current user. - * @return {Promise}Promise resolved with the combined review options. + * @param quizId Quiz ID. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved with the combined review options. */ getCombinedReviewOptions(quizId: number, ignoreCache?: boolean, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -536,9 +536,9 @@ export class AddonModQuizProvider { /** * Get cache key for get feedback for grade WS calls. * - * @param {number} quizId Quiz ID. - * @param {number} grade Grade. - * @return {string} Cache key. + * @param quizId Quiz ID. + * @param grade Grade. + * @return Cache key. */ protected getFeedbackForGradeCacheKey(quizId: number, grade: number): string { return this.getFeedbackForGradeCommonCacheKey(quizId) + ':' + grade; @@ -547,8 +547,8 @@ export class AddonModQuizProvider { /** * Get common cache key for get feedback for grade WS calls. * - * @param {number} quizId Quiz ID. - * @return {string} Cache key. + * @param quizId Quiz ID. + * @return Cache key. */ protected getFeedbackForGradeCommonCacheKey(quizId: number): string { return this.ROOT_CACHE_KEY + 'feedbackForGrade:' + quizId; @@ -557,11 +557,11 @@ export class AddonModQuizProvider { /** * Get the feedback for a certain grade. * - * @param {number} quizId Quiz ID. - * @param {number} grade Grade. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the feedback. + * @param quizId Quiz ID. + * @param grade Grade. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the feedback. */ getFeedbackForGrade(quizId: number, grade: number, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -587,8 +587,8 @@ export class AddonModQuizProvider { * Determine the correct number of decimal places required to format a grade. * Based on Moodle's quiz_get_grade_format. * - * @param {any} quiz Quiz. - * @return {number} Number of decimals. + * @param quiz Quiz. + * @return Number of decimals. */ getGradeDecimals(quiz: any): number { if (typeof quiz.questiondecimalpoints == 'undefined') { @@ -605,12 +605,12 @@ export class AddonModQuizProvider { /** * Gets a quiz grade and feedback from the gradebook. * - * @param {number} courseId Course ID. - * @param {number} moduleId Quiz module ID. - * @param {boolean} [ignoreCache] Whether 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 {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved with an object containing the grade and the feedback. + * @param courseId Course ID. + * @param moduleId Quiz module ID. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved with an object containing the grade and the feedback. */ getGradeFromGradebook(courseId: number, moduleId: number, ignoreCache?: boolean, siteId?: string, userId?: number) : Promise { @@ -623,8 +623,8 @@ export class AddonModQuizProvider { /** * Given a list of attempts, returns the last finished attempt. * - * @param {any[]} attempts Attempts. - * @return {any} Last finished attempt. + * @param attempts Attempts. + * @return Last finished attempt. */ getLastFinishedAttemptFromList(attempts: any[]): any { if (attempts && attempts.length) { @@ -642,8 +642,8 @@ export class AddonModQuizProvider { * Given a list of questions, check if the quiz can be submitted. * Will return an array with the messages to prevent the submit. Empty array if quiz can be submitted. * - * @param {any[]} questions Questions. - * @return {string[]} List of prevent submit messages. Empty array if quiz can be submitted. + * @param questions Questions. + * @return List of prevent submit messages. Empty array if quiz can be submitted. */ getPreventSubmitMessages(questions: any[]): string[] { const messages = []; @@ -670,8 +670,8 @@ export class AddonModQuizProvider { /** * Get cache key for quiz data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getQuizDataCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'quiz:' + courseId; @@ -680,13 +680,13 @@ export class AddonModQuizProvider { /** * Get a Quiz with key=value. If more than one is found, only the first will be returned. * - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {boolean} [forceCache] Whether it should always return cached data. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the Quiz is retrieved. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param forceCache Whether it should always return cached data. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the Quiz is retrieved. */ protected getQuizByField(courseId: number, key: string, value: any, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise { @@ -726,12 +726,12 @@ export class AddonModQuizProvider { /** * Get a quiz by module ID. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {boolean} [forceCache] Whether it should always return cached data. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the quiz is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param forceCache Whether it should always return cached data. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the quiz is retrieved. */ getQuiz(courseId: number, cmId: number, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise { return this.getQuizByField(courseId, 'coursemodule', cmId, forceCache, ignoreCache, siteId); @@ -740,12 +740,12 @@ export class AddonModQuizProvider { /** * Get a quiz by quiz ID. * - * @param {number} courseId Course ID. - * @param {number} id Quiz ID. - * @param {boolean} [forceCache] Whether it should always return cached data. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the quiz is retrieved. + * @param courseId Course ID. + * @param id Quiz ID. + * @param forceCache Whether it should always return cached data. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the quiz is retrieved. */ getQuizById(courseId: number, id: number, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise { return this.getQuizByField(courseId, 'id', id, forceCache, ignoreCache, siteId); @@ -754,8 +754,8 @@ export class AddonModQuizProvider { /** * Get cache key for get quiz access information WS calls. * - * @param {number} quizId Quiz ID. - * @return {string} Cache key. + * @param quizId Quiz ID. + * @return Cache key. */ protected getQuizAccessInformationCacheKey(quizId: number): string { return this.ROOT_CACHE_KEY + 'quizAccessInformation:' + quizId; @@ -764,11 +764,11 @@ export class AddonModQuizProvider { /** * Get access information for an attempt. * - * @param {number} quizId Quiz ID. - * @param {boolean} [offline] Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the access information. + * @param quizId Quiz ID. + * @param offline Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the access information. */ getQuizAccessInformation(quizId: number, offline?: boolean, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -793,8 +793,8 @@ export class AddonModQuizProvider { /** * Get a readable Quiz grade method. * - * @param {number|string} method Grading method. - * @return {string} Readable grading method. + * @param method Grading method. + * @return Readable grading method. */ getQuizGradeMethod(method: number | string): string { if (typeof method == 'string') { @@ -818,8 +818,8 @@ export class AddonModQuizProvider { /** * Get cache key for get quiz required qtypes WS calls. * - * @param {number} quizId Quiz ID. - * @return {string} Cache key. + * @param quizId Quiz ID. + * @return Cache key. */ protected getQuizRequiredQtypesCacheKey(quizId: number): string { return this.ROOT_CACHE_KEY + 'quizRequiredQtypes:' + quizId; @@ -828,10 +828,10 @@ export class AddonModQuizProvider { /** * Get the potential question types that would be required for a given quiz. * - * @param {number} quizId Quiz ID. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the access information. + * @param quizId Quiz ID. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the access information. */ getQuizRequiredQtypes(quizId: number, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -861,8 +861,8 @@ export class AddonModQuizProvider { /** * Given an attempt's layout, return the list of pages. * - * @param {string} layout Attempt's layout. - * @return {number[]} Pages. + * @param layout Attempt's layout. + * @return Pages. * @description * An attempt's layout is a string with the question numbers separated by commas. A 0 indicates a change of page. * Example: 1,2,3,0,4,5,6,0 @@ -889,9 +889,9 @@ export class AddonModQuizProvider { * Given an attempt's layout and a list of questions identified by question slot, * return the list of pages that have at least 1 of the questions. * - * @param {string} layout Attempt's layout. - * @param {any} questions List of questions. It needs to be an object where the keys are question slot. - * @return {number[]} Pages. + * @param layout Attempt's layout. + * @param questions List of questions. It needs to be an object where the keys are question slot. + * @return Pages. * @description * An attempt's layout is a string with the question numbers separated by commas. A 0 indicates a change of page. * Example: 1,2,3,0,4,5,6,0 @@ -923,8 +923,8 @@ export class AddonModQuizProvider { /** * Given a list of question types, returns the types that aren't supported. * - * @param {string[]} questionTypes Question types to check. - * @return {string[]} Not supported question types. + * @param questionTypes Question types to check. + * @return Not supported question types. */ getUnsupportedQuestions(questionTypes: string[]): string[] { const notSupported = []; @@ -941,8 +941,8 @@ export class AddonModQuizProvider { /** * Given a list of access rules names, returns the rules that aren't supported. * - * @param {string[]} rulesNames Rules to check. - * @return {string[]} Not supported rules names. + * @param rulesNames Rules to check. + * @return Not supported rules names. */ getUnsupportedRules(rulesNames: string[]): string[] { const notSupported = []; @@ -959,9 +959,9 @@ export class AddonModQuizProvider { /** * Get cache key for get user attempts WS calls. * - * @param {number} quizId Quiz ID. - * @param {number} userId User ID. - * @return {string} Cache key. + * @param quizId Quiz ID. + * @param userId User ID. + * @return Cache key. */ protected getUserAttemptsCacheKey(quizId: number, userId: number): string { return this.getUserAttemptsCommonCacheKey(quizId) + ':' + userId; @@ -970,8 +970,8 @@ export class AddonModQuizProvider { /** * Get common cache key for get user attempts WS calls. * - * @param {number} quizId Quiz ID. - * @return {string} Cache key. + * @param quizId Quiz ID. + * @return Cache key. */ protected getUserAttemptsCommonCacheKey(quizId: number): string { return this.ROOT_CACHE_KEY + 'userAttempts:' + quizId; @@ -980,14 +980,14 @@ export class AddonModQuizProvider { /** * Get quiz attempts for a certain user. * - * @param {number} quizId Quiz ID. - * @param {number} [status=all] Status of the attempts to get. By default, 'all'. - * @param {boolean} [includePreviews=true] Whether to include previews. Defaults to true. - * @param {boolean} [offline] Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether 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 {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved with the attempts. + * @param quizId Quiz ID. + * @param status Status of the attempts to get. By default, 'all'. + * @param includePreviews Whether to include previews. Defaults to true. + * @param offline Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved with the attempts. */ getUserAttempts(quizId: number, status: string = 'all', includePreviews: boolean = true, offline?: boolean, ignoreCache?: boolean, siteId?: string, userId?: number): Promise { @@ -1026,9 +1026,9 @@ export class AddonModQuizProvider { /** * Get cache key for get user best grade WS calls. * - * @param {number} quizId Quiz ID. - * @param {number} userId User ID. - * @return {string} Cache key. + * @param quizId Quiz ID. + * @param userId User ID. + * @return Cache key. */ protected getUserBestGradeCacheKey(quizId: number, userId: number): string { return this.getUserBestGradeCommonCacheKey(quizId) + ':' + userId; @@ -1037,8 +1037,8 @@ export class AddonModQuizProvider { /** * Get common cache key for get user best grade WS calls. * - * @param {number} quizId Quiz ID. - * @return {string} Cache key. + * @param quizId Quiz ID. + * @return Cache key. */ protected getUserBestGradeCommonCacheKey(quizId: number): string { return this.ROOT_CACHE_KEY + 'userBestGrade:' + quizId; @@ -1047,11 +1047,11 @@ export class AddonModQuizProvider { /** * Get best grade in a quiz for a certain user. * - * @param {number} quizId Quiz ID. - * @param {boolean} [ignoreCache] Whether 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 {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved with the best grade data. + * @param quizId Quiz ID. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved with the best grade data. */ getUserBestGrade(quizId: number, ignoreCache?: boolean, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1077,12 +1077,12 @@ export class AddonModQuizProvider { /** * Invalidates all the data related to a certain quiz. * - * @param {number} quizId Quiz ID. - * @param {number} [courseId] Course ID. - * @param {number} [attemptId] Attempt ID to invalidate some WS calls. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when the data is invalidated. + * @param quizId Quiz ID. + * @param courseId Course ID. + * @param attemptId Attempt ID to invalidate some WS calls. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when the data is invalidated. */ invalidateAllQuizData(quizId: number, courseId?: number, attemptId?: number, siteId?: string, userId?: number): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -1113,9 +1113,9 @@ export class AddonModQuizProvider { /** * Invalidates attempt access information for all attempts in a quiz. * - * @param {number} quizId Quiz ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param quizId Quiz ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAttemptAccessInformation(quizId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1126,10 +1126,10 @@ export class AddonModQuizProvider { /** * Invalidates attempt access information for an attempt. * - * @param {number} quizId Quiz ID. - * @param {number} attemptId Attempt ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param quizId Quiz ID. + * @param attemptId Attempt ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAttemptAccessInformationForAttempt(quizId: number, attemptId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1140,9 +1140,9 @@ export class AddonModQuizProvider { /** * Invalidates attempt data for all pages. * - * @param {number} attemptId Attempt ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param attemptId Attempt ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAttemptData(attemptId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1153,10 +1153,10 @@ export class AddonModQuizProvider { /** * Invalidates attempt data for a certain page. * - * @param {number} attemptId Attempt ID. - * @param {number} page Page. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param attemptId Attempt ID. + * @param page Page. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAttemptDataForPage(attemptId: number, page: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1167,9 +1167,9 @@ export class AddonModQuizProvider { /** * Invalidates attempt review for all pages. * - * @param {number} attemptId Attempt ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param attemptId Attempt ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAttemptReview(attemptId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1180,10 +1180,10 @@ export class AddonModQuizProvider { /** * Invalidates attempt review for a certain page. * - * @param {number} attemptId Attempt ID. - * @param {number} page Page. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param attemptId Attempt ID. + * @param page Page. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAttemptReviewForPage(attemptId: number, page: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1194,9 +1194,9 @@ export class AddonModQuizProvider { /** * Invalidates attempt summary. * - * @param {number} attemptId Attempt ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param attemptId Attempt ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAttemptSummary(attemptId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1207,9 +1207,9 @@ export class AddonModQuizProvider { /** * Invalidates combined review options for all users. * - * @param {number} quizId Quiz ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param quizId Quiz ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateCombinedReviewOptions(quizId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1220,10 +1220,10 @@ export class AddonModQuizProvider { /** * Invalidates combined review options for a certain user. * - * @param {number} quizId Quiz ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when the data is invalidated. + * @param quizId Quiz ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when the data is invalidated. */ invalidateCombinedReviewOptionsForUser(quizId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1237,10 +1237,10 @@ export class AddonModQuizProvider { * Invalidate the prefetched content except files. * To invalidate files, use AddonModQuizProvider.invalidateFiles. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -1259,9 +1259,9 @@ export class AddonModQuizProvider { /** * Invalidates feedback for all grades of a quiz. * - * @param {number} quizId Quiz ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param quizId Quiz ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateFeedback(quizId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1272,10 +1272,10 @@ export class AddonModQuizProvider { /** * Invalidates feedback for a certain grade. * - * @param {number} quizId Quiz ID. - * @param {number} grade Grade. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param quizId Quiz ID. + * @param grade Grade. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateFeedbackForGrade(quizId: number, grade: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1286,8 +1286,8 @@ export class AddonModQuizProvider { /** * Invalidate the prefetched files. * - * @param {number} moduleId The module ID. - * @return {Promise} Promise resolved when the files are invalidated. + * @param moduleId The module ID. + * @return Promise resolved when the files are invalidated. */ invalidateFiles(moduleId: number): Promise { return this.filepoolProvider.invalidateFilesByComponent(this.sitesProvider.getCurrentSiteId(), @@ -1297,10 +1297,10 @@ export class AddonModQuizProvider { /** * Invalidates grade from gradebook for a certain user. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when the data is invalidated. */ invalidateGradeFromGradebook(courseId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1313,9 +1313,9 @@ export class AddonModQuizProvider { /** * Invalidates quiz access information for a quiz. * - * @param {number} quizId Quiz ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param quizId Quiz ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateQuizAccessInformation(quizId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1326,9 +1326,9 @@ export class AddonModQuizProvider { /** * Invalidates required qtypes for a quiz. * - * @param {number} quizId Quiz ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param quizId Quiz ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateQuizRequiredQtypes(quizId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1339,9 +1339,9 @@ export class AddonModQuizProvider { /** * Invalidates user attempts for all users. * - * @param {number} quizId Quiz ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param quizId Quiz ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateUserAttempts(quizId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1352,10 +1352,10 @@ export class AddonModQuizProvider { /** * Invalidates user attempts for a certain user. * - * @param {number} quizId Quiz ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when the data is invalidated. + * @param quizId Quiz ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when the data is invalidated. */ invalidateUserAttemptsForUser(quizId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1368,9 +1368,9 @@ export class AddonModQuizProvider { /** * Invalidates user best grade for all users. * - * @param {number} quizId Quiz ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param quizId Quiz ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateUserBestGrade(quizId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1381,10 +1381,10 @@ export class AddonModQuizProvider { /** * Invalidates user best grade for a certain user. * - * @param {number} quizId Quiz ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when the data is invalidated. + * @param quizId Quiz ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when the data is invalidated. */ invalidateUserBestGradeForUser(quizId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1397,9 +1397,9 @@ export class AddonModQuizProvider { /** * Invalidates quiz data. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateQuizData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1410,8 +1410,8 @@ export class AddonModQuizProvider { /** * Check if an attempt is finished based on its state. * - * @param {string} state Attempt's state. - * @return {boolean} Whether it's finished. + * @param state Attempt's state. + * @return Whether it's finished. */ isAttemptFinished(state: string): boolean { return state == AddonModQuizProvider.ATTEMPT_FINISHED || state == AddonModQuizProvider.ATTEMPT_ABANDONED; @@ -1420,9 +1420,9 @@ export class AddonModQuizProvider { /** * Check if an attempt is finished in offline but not synced. * - * @param {number} attemptId Attempt ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if finished in offline but not synced, false otherwise. + * @param attemptId Attempt ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if finished in offline but not synced, false otherwise. */ isAttemptFinishedOffline(attemptId: number, siteId?: string): Promise { return this.quizOfflineProvider.getAttemptById(attemptId, siteId).then((attempt) => { @@ -1438,9 +1438,9 @@ export class AddonModQuizProvider { * OR * - It finished before autosaveperiod passes. * - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @return {boolean} Whether it's nearly over or over. + * @param quiz Quiz. + * @param attempt Attempt. + * @return Whether it's nearly over or over. */ isAttemptTimeNearlyOver(quiz: any, attempt: any): boolean { if (attempt.state != AddonModQuizProvider.ATTEMPT_IN_PROGRESS) { @@ -1461,10 +1461,10 @@ export class AddonModQuizProvider { /** * Check if last attempt is offline and unfinished. * - * @param {number} attemptId Attempt ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, user current site's user. - * @return {Promise} Promise resolved with boolean: true if last offline attempt is unfinished, false otherwise. + * @param attemptId Attempt ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, user current site's user. + * @return Promise resolved with boolean: true if last offline attempt is unfinished, false otherwise. */ isLastAttemptOfflineUnfinished(quiz: any, siteId?: string, userId?: number): Promise { return this.quizOfflineProvider.getQuizAttempts(quiz.id, siteId, userId).then((attempts) => { @@ -1479,8 +1479,8 @@ export class AddonModQuizProvider { /** * Check if a quiz navigation is sequential. * - * @param {any} quiz Quiz. - * @return {boolean} Whether navigation is sequential. + * @param quiz Quiz. + * @return Whether navigation is sequential. */ isNavigationSequential(quiz: any): boolean { return quiz.navmethod == 'sequential'; @@ -1489,8 +1489,8 @@ export class AddonModQuizProvider { /** * Return whether or not the plugin is enabled in a certain site. Plugin is enabled if the quiz WS are available. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean} Whether the plugin is enabled. + * @param siteId Site ID. If not defined, current site. + * @return Whether the plugin is enabled. */ isPluginEnabled(siteId?: string): boolean { // Quiz WebServices were introduced in 3.1, it will always be enabled. @@ -1500,8 +1500,8 @@ export class AddonModQuizProvider { /** * Check if a question is blocked. * - * @param {any} question Question. - * @return {boolean} Whether it's blocked. + * @param question Question. + * @return Whether it's blocked. */ isQuestionBlocked(question: any): boolean { const element = this.domUtils.convertToElement(question.html); @@ -1512,8 +1512,8 @@ export class AddonModQuizProvider { /** * Check if a quiz is enabled to be used in offline. * - * @param {any} quiz Quiz. - * @return {boolean} Whether offline is enabled. + * @param quiz Quiz. + * @return Whether offline is enabled. */ isQuizOffline(quiz: any): boolean { // Don't allow downloading the quiz if offline is disabled to prevent wasting a lot of data when opening it. @@ -1523,9 +1523,9 @@ export class AddonModQuizProvider { /** * Given a list of attempts, add finishedOffline=true to those attempts that are finished in offline but not synced. * - * @param {any[]} attempts List of attempts. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param attempts List of attempts. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ loadFinishedOfflineData(attempts: any[], siteId?: string): Promise { if (attempts.length) { @@ -1543,13 +1543,13 @@ export class AddonModQuizProvider { /** * Report an attempt as being viewed. It did not store logs offline because order of the log is important. * - * @param {number} attemptId Attempt ID. - * @param {number} [page=0] Page number. - * @param {any} [preflightData] Preflight required data (like password). - * @param {boolean} [offline] Whether attempt is offline. - * @param {string} [quiz] Quiz instance. If set, a Firebase event will be stored. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param attemptId Attempt ID. + * @param page Page number. + * @param preflightData Preflight required data (like password). + * @param offline Whether attempt is offline. + * @param quiz Quiz instance. If set, a Firebase event will be stored. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logViewAttempt(attemptId: number, page: number = 0, preflightData: any = {}, offline?: boolean, quiz?: any, siteId?: string): Promise { @@ -1578,11 +1578,11 @@ export class AddonModQuizProvider { /** * Report an attempt's review as being viewed. * - * @param {number} attemptId Attempt ID. - * @param {number} quizId Quiz ID. - * @param {string} [name] Name of the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param attemptId Attempt ID. + * @param quizId Quiz ID. + * @param name Name of the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logViewAttemptReview(attemptId: number, quizId: number, name?: string, siteId?: string): Promise { const params = { @@ -1596,12 +1596,12 @@ export class AddonModQuizProvider { /** * Report an attempt's summary as being viewed. * - * @param {number} attemptId Attempt ID. - * @param {any} preflightData Preflight required data (like password). - * @param {number} quizId Quiz ID. - * @param {string} [name] Name of the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param attemptId Attempt ID. + * @param preflightData Preflight required data (like password). + * @param quizId Quiz ID. + * @param name Name of the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logViewAttemptSummary(attemptId: number, preflightData: any, quizId: number, name?: string, siteId?: string): Promise { const params = { @@ -1616,10 +1616,10 @@ export class AddonModQuizProvider { /** * Report a quiz as being viewed. * - * @param {number} id Module ID. - * @param {string} [name] Name of the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Module ID. + * @param name Name of the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logViewQuiz(id: number, name?: string, siteId?: string): Promise { const params = { @@ -1633,15 +1633,15 @@ export class AddonModQuizProvider { /** * Process an attempt, saving its data. * - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @param {any} data Data to save. - * @param {any} preflightData Preflight required data (like password). - * @param {boolean} [finish] Whether to finish the quiz. - * @param {boolean} [timeUp] Whether the quiz time is up, false otherwise. - * @param {boolean} [offline] Whether the attempt is offline. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success, rejected otherwise. + * @param quiz Quiz. + * @param attempt Attempt. + * @param data Data to save. + * @param preflightData Preflight required data (like password). + * @param finish Whether to finish the quiz. + * @param timeUp Whether the quiz time is up, false otherwise. + * @param offline Whether the attempt is offline. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success, rejected otherwise. */ processAttempt(quiz: any, attempt: any, data: any, preflightData: any, finish?: boolean, timeUp?: boolean, offline?: boolean, siteId?: string): Promise { @@ -1655,13 +1655,13 @@ export class AddonModQuizProvider { /** * Process an online attempt, saving its data. * - * @param {number} attemptId Attempt ID. - * @param {any} data Data to save. - * @param {any} preflightData Preflight required data (like password). - * @param {boolean} [finish] Whether to finish the quiz. - * @param {boolean} [timeUp] Whether the quiz time is up, false otherwise. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success, rejected otherwise. + * @param attemptId Attempt ID. + * @param data Data to save. + * @param preflightData Preflight required data (like password). + * @param finish Whether to finish the quiz. + * @param timeUp Whether the quiz time is up, false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success, rejected otherwise. */ protected processAttemptOnline(attemptId: number, data: any, preflightData: any, finish?: boolean, timeUp?: boolean, siteId?: string): Promise { @@ -1691,13 +1691,13 @@ export class AddonModQuizProvider { /** * Process an offline attempt, saving its data. * - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @param {any} data Data to save. - * @param {any} preflightData Preflight required data (like password). - * @param {boolean} [finish] Whether to finish the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success, rejected otherwise. + * @param quiz Quiz. + * @param attempt Attempt. + * @param data Data to save. + * @param preflightData Preflight required data (like password). + * @param finish Whether to finish the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success, rejected otherwise. */ protected processAttemptOffline(quiz: any, attempt: any, data: any, preflightData: any, finish?: boolean, siteId?: string) : Promise { @@ -1714,8 +1714,8 @@ export class AddonModQuizProvider { /** * Check if it's a graded quiz. Based on Moodle's quiz_has_grades. * - * @param {any} quiz Quiz. - * @return {boolean} Whether quiz is graded. + * @param quiz Quiz. + * @return Whether quiz is graded. */ quizHasGrades(quiz: any): boolean { return quiz.grade >= 0.000005 && quiz.sumgrades >= 0.000005; @@ -1725,11 +1725,11 @@ export class AddonModQuizProvider { * Convert the raw grade into a grade out of the maximum grade for this quiz. * Based on Moodle's quiz_rescale_grade. * - * @param {string} rawGrade The unadjusted grade, for example attempt.sumgrades. - * @param {any} quiz Quiz. - * @param {boolean|string} format True to format the results for display, 'question' to format a question grade - * (different number of decimal places), false to not format it. - * @return {string} Grade to display. + * @param rawGrade The unadjusted grade, for example attempt.sumgrades. + * @param quiz Quiz. + * @param format True to format the results for display, 'question' to format a question grade + * (different number of decimal places), false to not format it. + * @return Grade to display. */ rescaleGrade(rawGrade: string, quiz: any, format: boolean | string = true): string { let grade: number; @@ -1761,13 +1761,13 @@ export class AddonModQuizProvider { /** * Save an attempt data. * - * @param {any} quiz Quiz. - * @param {any} attempt Attempt. - * @param {any} data Data to save. - * @param {any} preflightData Preflight required data (like password). - * @param {boolean} [offline] Whether attempt is offline. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success, rejected otherwise. + * @param quiz Quiz. + * @param attempt Attempt. + * @param data Data to save. + * @param preflightData Preflight required data (like password). + * @param offline Whether attempt is offline. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success, rejected otherwise. */ saveAttempt(quiz: any, attempt: any, data: any, preflightData: any, offline?: boolean, siteId?: string): Promise { try { @@ -1786,11 +1786,11 @@ export class AddonModQuizProvider { /** * Save an attempt data. * - * @param {number} attemptId Attempt ID. - * @param {any} data Data to save. - * @param {any} preflightData Preflight required data (like password). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success, rejected otherwise. + * @param attemptId Attempt ID. + * @param data Data to save. + * @param preflightData Preflight required data (like password). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success, rejected otherwise. */ protected saveAttemptOnline(attemptId: number, data: any, preflightData: any, siteId?: string): Promise { @@ -1815,10 +1815,10 @@ export class AddonModQuizProvider { /** * Check if time left should be shown. * - * @param {string[]} rules List of active rules names. - * @param {any} attempt Attempt. - * @param {number} endTime The attempt end time (in seconds). - * @return {boolean} Whether time left should be displayed. + * @param rules List of active rules names. + * @param attempt Attempt. + * @param endTime The attempt end time (in seconds). + * @return Whether time left should be displayed. */ shouldShowTimeLeft(rules: string[], attempt: any, endTime: number): boolean { const timeNow = this.timeUtils.timestamp(); @@ -1833,11 +1833,11 @@ export class AddonModQuizProvider { /** * Start an attempt. * - * @param {number} quizId Quiz ID. - * @param {any} preflightData Preflight required data (like password). - * @param {boolean} [forceNew] Whether to force a new attempt or not. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the attempt data. + * @param quizId Quiz ID. + * @param preflightData Preflight required data (like password). + * @param forceNew Whether to force a new attempt or not. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the attempt data. */ startAttempt(quizId: number, preflightData: any, forceNew?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/mod/quiz/providers/review-link-handler.ts b/src/addon/mod/quiz/providers/review-link-handler.ts index 516499fd0..c903756fd 100644 --- a/src/addon/mod/quiz/providers/review-link-handler.ts +++ b/src/addon/mod/quiz/providers/review-link-handler.ts @@ -34,12 +34,12 @@ export class AddonModQuizReviewLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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 {any} [data] Extra data to handle the URL. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @param data Extra data to handle the URL. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number, data?: any): CoreContentLinksAction[] | Promise { @@ -62,11 +62,11 @@ export class AddonModQuizReviewLinkHandler extends CoreContentLinksHandlerBase { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return this.quizProvider.isPluginEnabled(); diff --git a/src/addon/mod/quiz/providers/sync-cron-handler.ts b/src/addon/mod/quiz/providers/sync-cron-handler.ts index 2c3c1bcbe..439db41e3 100644 --- a/src/addon/mod/quiz/providers/sync-cron-handler.ts +++ b/src/addon/mod/quiz/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class AddonModQuizSyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.quizSync.syncAllQuizzes(siteId, force); @@ -40,7 +40,7 @@ export class AddonModQuizSyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return this.quizSync.syncInterval; diff --git a/src/addon/mod/resource/components/index/index.ts b/src/addon/mod/resource/components/index/index.ts index ab8ccffac..fd52daa25 100644 --- a/src/addon/mod/resource/components/index/index.ts +++ b/src/addon/mod/resource/components/index/index.ts @@ -64,7 +64,7 @@ export class AddonModResourceIndexComponent extends CoreCourseModuleMainResource /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { return this.resourceProvider.invalidateContent(this.module.id, this.courseId); @@ -73,8 +73,8 @@ export class AddonModResourceIndexComponent extends CoreCourseModuleMainResource /** * Download resource contents. * - * @param {boolean} [refresh] Whether we're refreshing data. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @return Promise resolved when done. */ protected fetchContent(refresh?: boolean): Promise { // Load module contents if needed. Passing refresh is needed to force reloading contents. diff --git a/src/addon/mod/resource/pages/index/index.ts b/src/addon/mod/resource/pages/index/index.ts index 0bc1de345..b1ae19404 100644 --- a/src/addon/mod/resource/pages/index/index.ts +++ b/src/addon/mod/resource/pages/index/index.ts @@ -40,7 +40,7 @@ export class AddonModResourceIndexPage { /** * Update some data based on the resource instance. * - * @param {any} resource Resource instance. + * @param resource Resource instance. */ updateData(resource: any): void { this.title = resource.name || this.title; diff --git a/src/addon/mod/resource/providers/helper.ts b/src/addon/mod/resource/providers/helper.ts index 0f216e4aa..cf315075a 100644 --- a/src/addon/mod/resource/providers/helper.ts +++ b/src/addon/mod/resource/providers/helper.ts @@ -46,9 +46,9 @@ export class AddonModResourceHelperProvider { /** * Get the HTML to display an embedded resource. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @return {Promise} Promise resolved with the HTML. + * @param module The module object. + * @param courseId The course ID. + * @return Promise resolved with the HTML. */ getEmbeddedHtml(module: any, courseId: number): Promise { return this.courseHelper.downloadModuleWithMainFileIfNeeded(module, courseId, AddonModResourceProvider.COMPONENT, @@ -76,8 +76,8 @@ export class AddonModResourceHelperProvider { /** * Download all the files needed and returns the src of the iframe. * - * @param {any} module The module object. - * @return {Promise} Promise resolved with the iframe src. + * @param module The module object. + * @return Promise resolved with the iframe src. */ getIframeSrc(module: any): Promise { if (!module.contents.length) { @@ -108,9 +108,9 @@ export class AddonModResourceHelperProvider { /** * Whether the resource has to be displayed embedded. * - * @param {any} module The module object. - * @param {number} [display] The display mode (if available). - * @return {boolean} Whether the resource should be displayed embeded. + * @param module The module object. + * @param display The display mode (if available). + * @return Whether the resource should be displayed embeded. */ isDisplayedEmbedded(module: any, display: number): boolean { if ((!module.contents.length && !module.contentsinfo) || !this.fileProvider.isAvailable() || @@ -132,8 +132,8 @@ export class AddonModResourceHelperProvider { /** * Whether the resource has to be displayed in an iframe. * - * @param {any} module The module object. - * @return {boolean} Whether the resource should be displayed in an iframe. + * @param module The module object. + * @return Whether the resource should be displayed in an iframe. */ isDisplayedInIframe(module: any): boolean { if ((!module.contents.length && !module.contentsinfo) || !this.fileProvider.isAvailable()) { @@ -155,8 +155,8 @@ export class AddonModResourceHelperProvider { /** * Check if the resource is a Nextcloud file. * - * @param {any} module Module to check. - * @return {boolean} Whether it's a Nextcloud file. + * @param module Module to check. + * @return Whether it's a Nextcloud file. */ isNextcloudFile(module: any): boolean { if (module.contentsinfo) { @@ -169,9 +169,9 @@ export class AddonModResourceHelperProvider { /** * Opens a file of the resource activity. * - * @param {any} module Module where to get the contents. - * @param {number} courseId Course Id, used for completion purposes. - * @return {Promise} Resolved when done. + * @param module Module where to get the contents. + * @param courseId Course Id, used for completion purposes. + * @return Resolved when done. */ openModuleFile(module: any, courseId: number): Promise { const modal = this.domUtils.showModalLoading(); diff --git a/src/addon/mod/resource/providers/list-link-handler.ts b/src/addon/mod/resource/providers/list-link-handler.ts index 8acc2d435..161816640 100644 --- a/src/addon/mod/resource/providers/list-link-handler.ts +++ b/src/addon/mod/resource/providers/list-link-handler.ts @@ -33,7 +33,7 @@ export class AddonModResourceListLinkHandler extends CoreContentLinksModuleListH /** * Check if the handler is enabled on a site level. * - * @return {boolean|Promise} 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 { return this.resourceProvider.isPluginEnabled(); diff --git a/src/addon/mod/resource/providers/module-handler.ts b/src/addon/mod/resource/providers/module-handler.ts index 573546982..f4a9888bf 100644 --- a/src/addon/mod/resource/providers/module-handler.ts +++ b/src/addon/mod/resource/providers/module-handler.ts @@ -57,7 +57,7 @@ export class AddonModResourceModuleHandler implements CoreCourseModuleHandler { /** * Check if the handler is enabled on a site level. * - * @return {boolean|Promise} 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 { return this.resourceProvider.isPluginEnabled(); @@ -66,10 +66,10 @@ export class AddonModResourceModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { const updateStatus = (status: string): void => { @@ -116,9 +116,9 @@ export class AddonModResourceModuleHandler implements CoreCourseModuleHandler { /** * Returns if contents are loaded to show open button. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @return {Promise} Resolved when done. + * @param module The module object. + * @param courseId The course ID. + * @return Resolved when done. */ protected hideOpenButton(module: any, courseId: number): Promise { let promise; @@ -140,9 +140,9 @@ export class AddonModResourceModuleHandler implements CoreCourseModuleHandler { /** * Returns the activity icon and data. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @return {Promise} Resource data. + * @param module The module object. + * @param courseId The course ID. + * @return Resource data. */ protected getResourceData(module: any, courseId: number, handlerData: CoreCourseModuleHandlerData): Promise { const promises = []; @@ -238,9 +238,9 @@ export class AddonModResourceModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModResourceIndexComponent; diff --git a/src/addon/mod/resource/providers/pluginfile-handler.ts b/src/addon/mod/resource/providers/pluginfile-handler.ts index ecd7154f1..bfda5c467 100644 --- a/src/addon/mod/resource/providers/pluginfile-handler.ts +++ b/src/addon/mod/resource/providers/pluginfile-handler.ts @@ -26,8 +26,8 @@ export class AddonModResourcePluginFileHandler implements CorePluginFileHandler /** * Return the RegExp to match the revision on pluginfile URLs. * - * @param {string[]} args Arguments of the pluginfile URL defining component and filearea at least. - * @return {RegExp} RegExp to match the revision on pluginfile URLs. + * @param args Arguments of the pluginfile URL defining component and filearea at least. + * @return RegExp to match the revision on pluginfile URLs. */ getComponentRevisionRegExp(args: string[]): RegExp { // Check filearea. @@ -40,8 +40,8 @@ export class AddonModResourcePluginFileHandler implements CorePluginFileHandler /** * Should return the string to remove the revision on pluginfile url. * - * @param {string[]} args Arguments of the pluginfile URL defining component and filearea at least. - * @return {string} String to remove the revision on pluginfile url. + * @param args Arguments of the pluginfile URL defining component and filearea at least. + * @return String to remove the revision on pluginfile url. */ getComponentRevisionReplace(args: string[]): string { // Component + Filearea + Revision diff --git a/src/addon/mod/resource/providers/prefetch-handler.ts b/src/addon/mod/resource/providers/prefetch-handler.ts index 7c3e7be65..eee3a26ef 100644 --- a/src/addon/mod/resource/providers/prefetch-handler.ts +++ b/src/addon/mod/resource/providers/prefetch-handler.ts @@ -45,10 +45,10 @@ export class AddonModResourcePrefetchHandler extends CoreCourseResourcePrefetchH /** * Return the status to show based on current status. * - * @param {any} module Module. - * @param {string} status The current status. - * @param {boolean} canCheck Whether the site allows checking for updates. - * @return {string} Status to display. + * @param module Module. + * @param status The current status. + * @param canCheck Whether the site allows checking for updates. + * @return Status to display. */ determineStatus(module: any, status: string, canCheck: boolean): string { if (status == CoreConstants.DOWNLOADED && module) { @@ -72,13 +72,13 @@ export class AddonModResourcePrefetchHandler extends CoreCourseResourcePrefetchH /** * Download or prefetch the content. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {boolean} [prefetch] True to prefetch, false to download right away. - * @param {string} [dirPath] Path of the directory where to store all the content files. This is to keep the files - * relative paths and make the package work in an iframe. Undefined to download the files - * in the filepool root folder. - * @return {Promise} Promise resolved when all content is downloaded. Data returned is not reliable. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param prefetch True to prefetch, false to download right away. + * @param dirPath Path of the directory where to store all the content files. This is to keep the files + * relative paths and make the package work in an iframe. Undefined to download the files + * in the filepool root folder. + * @return Promise resolved when all content is downloaded. Data returned is not reliable. */ downloadOrPrefetch(module: any, courseId: number, prefetch?: boolean, dirPath?: string): Promise { let promise; @@ -105,9 +105,9 @@ export class AddonModResourcePrefetchHandler extends CoreCourseResourcePrefetchH /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.resourceProvider.invalidateContent(moduleId, courseId); @@ -116,9 +116,9 @@ export class AddonModResourcePrefetchHandler extends CoreCourseResourcePrefetchH /** * Invalidate WS calls needed to determine module status. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule(module: any, courseId: number): Promise { const promises = []; @@ -132,9 +132,9 @@ export class AddonModResourcePrefetchHandler extends CoreCourseResourcePrefetchH /** * Check if a resource is downloadable. * - * @param {any} module Module to check. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved with true if downloadable, resolved with false otherwise. + * @param module Module to check. + * @param courseId Course ID the module belongs to. + * @return Promise resolved with true if downloadable, resolved with false otherwise. */ isDownloadable(module: any, courseId: number): Promise { if (this.sitesProvider.getCurrentSite().isVersionGreaterEqualThan('3.7')) { @@ -151,7 +151,7 @@ export class AddonModResourcePrefetchHandler extends CoreCourseResourcePrefetchH /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ isEnabled(): boolean | Promise { return this.resourceProvider.isPluginEnabled(); diff --git a/src/addon/mod/resource/providers/resource.ts b/src/addon/mod/resource/providers/resource.ts index 3de250b9b..05c8e4620 100644 --- a/src/addon/mod/resource/providers/resource.ts +++ b/src/addon/mod/resource/providers/resource.ts @@ -40,8 +40,8 @@ export class AddonModResourceProvider { /** * Get cache key for resource data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getResourceCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'resource:' + courseId; @@ -50,11 +50,11 @@ export class AddonModResourceProvider { /** * Get a resource data. * - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the resource is retrieved. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the resource is retrieved. */ protected getResourceDataByKey(courseId: number, key: string, value: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -84,10 +84,10 @@ export class AddonModResourceProvider { /** * Get a resource by course module ID. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the resource is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the resource is retrieved. */ getResourceData(courseId: number, cmId: number, siteId?: string): Promise { return this.getResourceDataByKey(courseId, 'coursemodule', cmId, siteId); @@ -96,10 +96,10 @@ export class AddonModResourceProvider { /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID of the module. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID of the module. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -116,9 +116,9 @@ export class AddonModResourceProvider { /** * Invalidates resource data. * - * @param {number} courseid Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseid Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateResourceData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -129,7 +129,7 @@ export class AddonModResourceProvider { /** * Returns whether or not getResource WS available or not. * - * @return {boolean} If WS is abalaible. + * @return If WS is abalaible. * @since 3.3 */ isGetResourceWSAvailable(): boolean { @@ -139,8 +139,8 @@ export class AddonModResourceProvider { /** * Return whether or not the plugin is enabled. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ isPluginEnabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -151,10 +151,10 @@ export class AddonModResourceProvider { /** * Report the resource as being viewed. * - * @param {number} id Module ID. - * @param {string} [name] Name of the resource. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Module ID. + * @param name Name of the resource. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params = { diff --git a/src/addon/mod/scorm/classes/data-model-12.ts b/src/addon/mod/scorm/classes/data-model-12.ts index 196d36fda..4c0fd345a 100644 --- a/src/addon/mod/scorm/classes/data-model-12.ts +++ b/src/addon/mod/scorm/classes/data-model-12.ts @@ -86,14 +86,14 @@ export class AddonModScormDataModel12 { /** * Constructor. * - * @param {CoreEventsProvider} eventsProvider Events provider instance. - * @param {AddonModScormProvider} scormProvider SCORM provider instance. - * @param {any} scorm SCORM. - * @param {number} scoId Current SCO ID. - * @param {number} attempt Attempt number. - * @param {any} userData The user default data. - * @param {string} [mode] Mode being played. By default, MODENORMAL. - * @param {boolean} offline Whether the attempt is offline. + * @param eventsProvider Events provider instance. + * @param scormProvider SCORM provider instance. + * @param scorm SCORM. + * @param scoId Current SCO ID. + * @param attempt Attempt number. + * @param userData The user default data. + * @param mode Mode being played. By default, MODENORMAL. + * @param offline Whether the attempt is offline. */ constructor(protected eventsProvider: CoreEventsProvider, protected scormProvider: AddonModScormProvider, protected siteId: string, protected scorm: any, protected scoId: number, protected attempt: number, @@ -108,9 +108,9 @@ export class AddonModScormDataModel12 { /** * Utility function for adding two times in format hh:mm:ss. * - * @param {string} first First time. - * @param {string} second Second time. - * @return {string} Total time. + * @param first First time. + * @param second Second time. + * @return Total time. */ protected addTime(first: string, second: string): string { const sFirst = first.split(':'), @@ -165,8 +165,8 @@ export class AddonModScormDataModel12 { /** * Utility function for cloning an object * - * @param {any} obj The object to be cloned - * @return {any} The object cloned + * @param obj The object to be cloned + * @return The object cloned */ protected cloneObj(obj: any): any { if (obj == null || typeof(obj) != 'object') { @@ -184,7 +184,7 @@ export class AddonModScormDataModel12 { /** * Collect all the user tracking data that must be persisted in the system, this is usually called by LMSCommit(). * - * @return {any[]} Collected data. + * @return Collected data. */ protected collectData(): any[] { const data = []; @@ -250,8 +250,8 @@ export class AddonModScormDataModel12 { /** * Get the value of the given element from the non-persistent (current) user data. * - * @param {string} el The element - * @return {any} The element value + * @param el The element + * @return The element value */ protected getEl(el: string): any { if (typeof this.currentUserData[this.scoId] != 'undefined' && typeof this.currentUserData[this.scoId][el] != 'undefined') { @@ -264,7 +264,7 @@ export class AddonModScormDataModel12 { /** * Initialize the model. * - * @param {any} userData The user default data. + * @param userData The user default data. */ protected init(userData: any): void { // Prepare the definition array containing the default values. @@ -463,8 +463,8 @@ export class AddonModScormDataModel12 { /** * Commit the changes. * - * @param {string} param Param. - * @return {string} "true" if success, "false" otherwise. + * @param param Param. + * @return "true" if success, "false" otherwise. */ LMSCommit(param: string): string { if (this.timeout) { @@ -497,8 +497,8 @@ export class AddonModScormDataModel12 { /** * Finish the data model. * - * @param {string} param Param. - * @return {string} "true" if success, "false" otherwise. + * @param param Param. + * @return "true" if success, "false" otherwise. */ LMSFinish(param: string): string { this.errorCode = '0'; @@ -540,8 +540,8 @@ export class AddonModScormDataModel12 { /** * Get diagnostic. * - * @param {string} param Param. - * @return {string} Result. + * @param param Param. + * @return Result. */ LMSGetDiagnostic(param: string): string { if (param == '') { @@ -554,8 +554,8 @@ export class AddonModScormDataModel12 { /** * Get the error message for a certain code. * - * @param {string} param Error code. - * @return {string} Error message. + * @param param Error code. + * @return Error message. */ LMSGetErrorString(param: string): string { if (param != '') { @@ -568,7 +568,7 @@ export class AddonModScormDataModel12 { /** * Get the last error code. * - * @return {string} Last error code. + * @return Last error code. */ LMSGetLastError(): string { return this.errorCode; @@ -577,8 +577,8 @@ export class AddonModScormDataModel12 { /** * Get the value of a certain element. * - * @param {string} element Name of the element to get. - * @return {string} Value. + * @param element Name of the element to get. + * @return Value. */ LMSGetValue(element: string): string { this.errorCode = '0'; @@ -633,8 +633,8 @@ export class AddonModScormDataModel12 { /** * Initialize the data model. * - * @param {string} param Param. - * @return {string} "true" if initialized, "false" otherwise. + * @param param Param. + * @return "true" if initialized, "false" otherwise. */ LMSInitialize(param: string): string { this.errorCode = '0'; @@ -658,9 +658,9 @@ export class AddonModScormDataModel12 { /** * Set the value of a certain element. * - * @param {string} element Name of the element to set. - * @param {any} value Value to set. - * @return {string} "true" if success, "false" otherwise. + * @param element Name of the element to set. + * @param value Value to set. + * @return "true" if success, "false" otherwise. */ LMSSetValue(element: string, value: any): string { this.errorCode = '0'; @@ -794,7 +794,7 @@ export class AddonModScormDataModel12 { * The scoId is like a pointer to be able to retrieve the SCO default values and set the new ones in the overall SCORM * data structure. * - * @param {number} scoId The new SCO id. + * @param scoId The new SCO id. */ loadSco(scoId: number): void { this.scoId = scoId; @@ -803,8 +803,8 @@ export class AddonModScormDataModel12 { /** * Set the value of the given element in the non-persistent (current) user data. * - * @param {string} el The element. - * @param {any} value The value. + * @param el The element. + * @param value The value. */ protected setEl(el: string, value: any): void { if (typeof this.currentUserData[this.scoId] == 'undefined') { @@ -817,7 +817,7 @@ export class AddonModScormDataModel12 { /** * Set offline mode to true or false. * - * @param {boolean} offline True if offline, false otherwise. + * @param offline True if offline, false otherwise. */ setOffline(offline: boolean): void { this.offline = offline; @@ -826,8 +826,8 @@ export class AddonModScormDataModel12 { /** * Persist the current user data (this is usually called by LMSCommit). * - * @param {boolean} storeTotalTime If true, we need to calculate the total time too. - * @return {boolean} True if success, false otherwise. + * @param storeTotalTime If true, we need to calculate the total time too. + * @return True if success, false otherwise. */ protected storeData(storeTotalTime?: boolean): boolean { let tracks; @@ -882,7 +882,7 @@ export class AddonModScormDataModel12 { /** * Utility function for calculating the total time spent in the SCO. * - * @return {any} Total time element. + * @return Total time element. */ protected totalTime(): any { const totalTime = this.addTime(this.getEl('cmi.core.total_time'), this.getEl('cmi.core.session_time')); @@ -893,7 +893,7 @@ export class AddonModScormDataModel12 { /** * Convenience function to trigger events. * - * @param {string} name Name of the event to trigger. + * @param name Name of the event to trigger. */ protected triggerEvent(name: string): void { this.eventsProvider.trigger(name, { diff --git a/src/addon/mod/scorm/components/index/index.ts b/src/addon/mod/scorm/components/index/index.ts index 6672548b7..b93fe28d9 100644 --- a/src/addon/mod/scorm/components/index/index.ts +++ b/src/addon/mod/scorm/components/index/index.ts @@ -107,7 +107,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Download a SCORM package or restores an ongoing download. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected downloadScormPackage(): Promise { this.downloading = true; @@ -143,10 +143,10 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Get the SCORM data. * - * @param {boolean} [refresh=false] If it's refreshing content. - * @param {boolean} [sync=false] If it should try to sync. - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved when done. + * @param refresh If it's refreshing content. + * @param sync If it should try to sync. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved when done. */ protected fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { @@ -263,7 +263,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Fetch the structure of the SCORM (TOC). * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchStructure(): Promise { return this.scormProvider.getOrganizations(this.scorm.id).then((organizations) => { @@ -285,10 +285,10 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Get the grade of an attempt and add it to the scorm attempts list. * - * @param {number} attempt The attempt number. - * @param {boolean} offline Whether it's an offline attempt. - * @param {any} attempts Object where to add the attempt. - * @return {Promise} Promise resolved when done. + * @param attempt The attempt number. + * @param offline Whether it's an offline attempt. + * @param attempts Object where to add the attempt. + * @return Promise resolved when done. */ protected getAttemptGrade(attempt: number, offline: boolean, attempts: any): Promise { return this.scormProvider.getAttemptGrade(this.scorm, attempt, offline).then((grade) => { @@ -302,7 +302,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Get the grades of each attempt and the grade of the SCORM. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected getReportedGrades(): Promise { const promises = [], @@ -351,8 +351,8 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Checks if sync has succeed from result sync data. * - * @param {any} result Data returned on the sync function. - * @return {boolean} If suceed or not. + * @param result Data returned on the sync function. + * @return If suceed or not. */ protected hasSyncSucceed(result: any): boolean { if (result.updated || this.dataSent) { @@ -412,7 +412,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -429,8 +429,8 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Compares sync event data with current data to check if refresh content is needed. * - * @param {any} syncEventData Data receiven on sync observer. - * @return {boolean} True if refresh is needed, false otherwise. + * @param syncEventData Data receiven on sync observer. + * @return True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: any): boolean { if (syncEventData.updated && this.scorm && syncEventData.scormId == this.scorm.id) { @@ -455,8 +455,8 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Load the TOC of a certain organization. * - * @param {string} organizationId The organization id. - * @return {Promise} Promise resolved when done. + * @param organizationId The organization id. + * @return Promise resolved when done. */ protected loadOrganizationToc(organizationId: string): Promise { if (!this.scorm.displaycoursestructure) { @@ -490,8 +490,8 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Open a SCORM. It will download the SCORM package if it's not downloaded or it has changed. * - * @param {Event} [event] Event. - * @param {string} [scoId] SCO that needs to be loaded when the SCORM is opened. If not defined, load first SCO. + * @param event Event. + * @param scoId SCO that needs to be loaded when the SCORM is opened. If not defined, load first SCO. */ open(event?: Event, scoId?: number): void { if (event) { @@ -534,7 +534,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Open a SCORM package. * - * @param {number} scoId SCO ID. + * @param scoId SCO ID. */ protected openScorm(scoId: number): void { this.navCtrl.push('AddonModScormPlayerPage', { @@ -549,8 +549,8 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Displays some data based on the current status. * - * @param {string} status The current status. - * @param {string} [previousStatus] The previous status. If not defined, there is no previous status. + * @param status The current status. + * @param previousStatus The previous status. If not defined, there is no previous status. */ protected showStatus(status: string, previousStatus?: string): void { @@ -574,7 +574,7 @@ export class AddonModScormIndexComponent extends CoreCourseModuleMainActivityCom /** * Performs the sync of the activity. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected sync(): Promise { return this.scormSync.syncScorm(this.scorm).then((result) => { diff --git a/src/addon/mod/scorm/pages/index/index.ts b/src/addon/mod/scorm/pages/index/index.ts index 9179fc6d1..1ed77747d 100644 --- a/src/addon/mod/scorm/pages/index/index.ts +++ b/src/addon/mod/scorm/pages/index/index.ts @@ -40,7 +40,7 @@ export class AddonModScormIndexPage { /** * Update some data based on the SCORM instance. * - * @param {any} scorm SCORM instance. + * @param scorm SCORM instance. */ updateData(scorm: any): void { this.title = scorm.name || this.title; diff --git a/src/addon/mod/scorm/pages/player/player.ts b/src/addon/mod/scorm/pages/player/player.ts index 93024042c..f4c0528a1 100644 --- a/src/addon/mod/scorm/pages/player/player.ts +++ b/src/addon/mod/scorm/pages/player/player.ts @@ -163,7 +163,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { /** * Calculate the next and previous SCO. * - * @param {number} scoId Current SCO ID. + * @param scoId Current SCO ID. */ protected calculateNextAndPreviousSco(scoId: number): void { this.previousSco = this.scormHelper.getPreviousScoFromToc(this.toc, scoId); @@ -173,8 +173,8 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { /** * Determine the attempt to use, the mode (normal/preview) and if it's offline or online. * - * @param {AddonModScormAttemptCountResult} attemptsData Attempts count. - * @return {Promise} Promise resolved when done. + * @param attemptsData Attempts count. + * @return Promise resolved when done. */ protected determineAttemptAndMode(attemptsData: AddonModScormAttemptCountResult): Promise { let result; @@ -223,7 +223,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { /** * Fetch data needed to play the SCORM. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchData(): Promise { // Wait for any ongoing sync to finish. We won't sync a SCORM while it's being played. @@ -251,7 +251,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { /** * Fetch the TOC. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchToc(): Promise { this.loadingToc = true; @@ -312,7 +312,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { /** * Load a SCO. * - * @param {any} sco The SCO to load. + * @param sco The SCO to load. */ protected loadSco(sco: any): void { if (!this.dataModel) { @@ -385,7 +385,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { /** * Show the TOC. * - * @param {MouseEvent} event Event. + * @param event Event. */ openToc(event: MouseEvent): void { const modal = this.modalCtrl.create('AddonModScormTocPage', { @@ -414,7 +414,7 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { /** * Refresh the TOC. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected refreshToc(): Promise { return this.scormProvider.invalidateAllScormData(this.scorm.id).catch(() => { @@ -429,8 +429,8 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy { /** * Set SCORM start time. * - * @param {number} scoId SCO ID. - * @return {Promise} Promise resolved when done. + * @param scoId SCO ID. + * @return Promise resolved when done. */ protected setStartTime(scoId: number): Promise { const tracks = [{ diff --git a/src/addon/mod/scorm/pages/toc/toc.ts b/src/addon/mod/scorm/pages/toc/toc.ts index 036196b6c..3d1074c12 100644 --- a/src/addon/mod/scorm/pages/toc/toc.ts +++ b/src/addon/mod/scorm/pages/toc/toc.ts @@ -45,7 +45,7 @@ export class AddonModScormTocPage { /** * Function called when a SCO is clicked. * - * @param {any} sco Clicked SCO. + * @param sco Clicked SCO. */ loadSco(sco: any): void { if (!sco.prereq || !sco.isvisible || !sco.launch) { diff --git a/src/addon/mod/scorm/providers/helper.ts b/src/addon/mod/scorm/providers/helper.ts index ec0e1523b..17b9ddf3f 100644 --- a/src/addon/mod/scorm/providers/helper.ts +++ b/src/addon/mod/scorm/providers/helper.ts @@ -37,9 +37,9 @@ export class AddonModScormHelperProvider { /** * Show a confirm dialog if needed. If SCORM doesn't have size, try to calculate it. * - * @param {any} scorm SCORM to download. - * @param {boolean} [isOutdated] True if package outdated, false if not outdated, undefined to calculate it. - * @return {Promise} Promise resolved if the user confirms or no confirmation needed. + * @param scorm SCORM to download. + * @param isOutdated True if package outdated, false if not outdated, undefined to calculate it. + * @return Promise resolved if the user confirms or no confirmation needed. */ confirmDownload(scorm: any, isOutdated?: boolean): Promise { // Check if file should be downloaded. @@ -69,10 +69,10 @@ export class AddonModScormHelperProvider { /** * Creates a new offline attempt based on an existing online attempt. * - * @param {any} scorm SCORM. - * @param {number} attempt Number of the online attempt. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the attempt is created. + * @param scorm SCORM. + * @param attempt Number of the online attempt. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the attempt is created. */ convertAttemptToOffline(scorm: any, attempt: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -121,11 +121,11 @@ export class AddonModScormHelperProvider { /** * Creates a new offline attempt. * - * @param {any} scorm SCORM. - * @param {number} newAttempt Number of the new attempt. - * @param {number} lastOnline Number of the last online attempt. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the attempt is created. + * @param scorm SCORM. + * @param newAttempt Number of the new attempt. + * @param lastOnline Number of the last online attempt. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the attempt is created. */ createOfflineAttempt(scorm: any, newAttempt: number, lastOnline: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -158,10 +158,10 @@ export class AddonModScormHelperProvider { * - The last incomplete online attempt if it hasn't been continued in offline and all offline attempts are complete. * - The attempt with highest number without surpassing max attempts otherwise. * - * @param {any} scorm SCORM object. - * @param {AddonModScormAttemptCountResult} attempts Attempts count. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise<{number: number, offline: boolean}>} Promise resolved with the attempt data. + * @param scorm SCORM object. + * @param attempts Attempts count. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the attempt data. */ determineAttemptToContinue(scorm: any, attempts: AddonModScormAttemptCountResult, siteId?: string) : Promise<{number: number, offline: boolean}> { @@ -195,14 +195,14 @@ export class AddonModScormHelperProvider { /** * Get the first SCO to load in a SCORM: the first valid and incomplete SCO. * - * @param {number} scormId Scorm ID. - * @param {number} attempt Attempt number. - * @param {any[]} [toc] SCORM's TOC. If not provided, it will be calculated. - * @param {string} [organization] Organization to use. - * @param {string} [mode] Mode. - * @param {boolean} [offline] Whether the attempt is offline. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the first SCO. + * @param scormId Scorm ID. + * @param attempt Attempt number. + * @param toc SCORM's TOC. If not provided, it will be calculated. + * @param organization Organization to use. + * @param mode Mode. + * @param offline Whether the attempt is offline. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the first SCO. */ getFirstSco(scormId: number, attempt: number, toc?: any[], organization?: string, mode?: string, offline?: boolean, siteId?: string): Promise { @@ -239,9 +239,9 @@ export class AddonModScormHelperProvider { * Get the last attempt (number and whether it's offline). * It'll be the highest number as long as it doesn't surpass the max number of attempts. * - * @param {any} scorm SCORM object. - * @param {AddonModScormAttemptCountResult} attempts Attempts count. - * @return {{number: number, offline: boolean}} Last attempt data. + * @param scorm SCORM object. + * @param attempts Attempts count. + * @return Last attempt data. */ protected getLastBeforeMax(scorm: any, attempts: AddonModScormAttemptCountResult): {number: number, offline: boolean} { if (scorm.maxattempt != 0 && attempts.lastAttempt.number > scorm.maxattempt) { @@ -260,9 +260,9 @@ export class AddonModScormHelperProvider { /** * Given a TOC in array format and a scoId, return the next available SCO. * - * @param {any[]} toc SCORM's TOC. - * @param {number} scoId SCO ID. - * @return {any} Next SCO. + * @param toc SCORM's TOC. + * @param scoId SCO ID. + * @return Next SCO. */ getNextScoFromToc(toc: any, scoId: number): any { for (let i = 0; i < toc.length; i++) { @@ -281,9 +281,9 @@ export class AddonModScormHelperProvider { /** * Given a TOC in array format and a scoId, return the previous available SCO. * - * @param {any[]} toc SCORM's TOC. - * @param {number} scoId SCO ID. - * @return {any} Previous SCO. + * @param toc SCORM's TOC. + * @param scoId SCO ID. + * @return Previous SCO. */ getPreviousScoFromToc(toc: any, scoId: number): any { for (let i = 0; i < toc.length; i++) { @@ -302,9 +302,9 @@ export class AddonModScormHelperProvider { /** * Given a TOC in array format and a scoId, return the SCO. * - * @param {any[]} toc SCORM's TOC. - * @param {number} scoId SCO ID. - * @return {any} SCO. + * @param toc SCORM's TOC. + * @param scoId SCO ID. + * @return SCO. */ getScoFromToc(toc: any[], scoId: number): any { for (let i = 0; i < toc.length; i++) { @@ -317,10 +317,10 @@ export class AddonModScormHelperProvider { /** * Searches user data for an online attempt. If the data can't be retrieved, re-try with the previous online attempt. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Online attempt to get the data. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with user data. + * @param scormId SCORM ID. + * @param attempt Online attempt to get the data. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with user data. */ searchOnlineAttemptUserData(scormId: number, attempt: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); diff --git a/src/addon/mod/scorm/providers/module-handler.ts b/src/addon/mod/scorm/providers/module-handler.ts index 1f1df4c8d..1fabceed2 100644 --- a/src/addon/mod/scorm/providers/module-handler.ts +++ b/src/addon/mod/scorm/providers/module-handler.ts @@ -44,7 +44,7 @@ export class AddonModScormModuleHandler implements CoreCourseModuleHandler { /** * 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 { return true; @@ -53,10 +53,10 @@ export class AddonModScormModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { return { @@ -78,9 +78,9 @@ export class AddonModScormModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModScormIndexComponent; diff --git a/src/addon/mod/scorm/providers/pluginfile-handler.ts b/src/addon/mod/scorm/providers/pluginfile-handler.ts index 58e16d725..e9ed78e91 100644 --- a/src/addon/mod/scorm/providers/pluginfile-handler.ts +++ b/src/addon/mod/scorm/providers/pluginfile-handler.ts @@ -26,8 +26,8 @@ export class AddonModScormPluginFileHandler implements CorePluginFileHandler { /** * Return the RegExp to match the revision on pluginfile URLs. * - * @param {string[]} args Arguments of the pluginfile URL defining component and filearea at least. - * @return {RegExp} RegExp to match the revision on pluginfile URLs. + * @param args Arguments of the pluginfile URL defining component and filearea at least. + * @return RegExp to match the revision on pluginfile URLs. */ getComponentRevisionRegExp(args: string[]): RegExp { // Check filearea. @@ -40,8 +40,8 @@ export class AddonModScormPluginFileHandler implements CorePluginFileHandler { /** * Should return the string to remove the revision on pluginfile url. * - * @param {string[]} args Arguments of the pluginfile URL defining component and filearea at least. - * @return {string} String to remove the revision on pluginfile url. + * @param args Arguments of the pluginfile URL defining component and filearea at least. + * @return String to remove the revision on pluginfile url. */ getComponentRevisionReplace(args: string[]): string { // Component + Filearea + Revision diff --git a/src/addon/mod/scorm/providers/prefetch-handler.ts b/src/addon/mod/scorm/providers/prefetch-handler.ts index 4b4dd8038..175d1f8fa 100644 --- a/src/addon/mod/scorm/providers/prefetch-handler.ts +++ b/src/addon/mod/scorm/providers/prefetch-handler.ts @@ -32,19 +32,16 @@ import { AddonModScormSyncProvider } from './scorm-sync'; export interface AddonModScormProgressEvent { /** * Whether the event is due to the download of a chunk of data. - * @type {boolean} */ downloading?: boolean; /** * Progress event sent by the download. - * @type {ProgressEvent} */ progress?: ProgressEvent; /** * A message related to the progress. This is usually used to notify that a certain step of the download has started. - * @type {string} */ message?: string; } @@ -72,11 +69,11 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Download the module. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @param {Function} [onProgress] Function to call on progress. - * @return {Promise} Promise resolved when all content is downloaded. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param dirPath Path of the directory where to store all the content files. + * @param onProgress Function to call on progress. + * @return Promise resolved when all content is downloaded. */ download(module: any, courseId: number, dirPath?: string, onProgress?: (event: AddonModScormProgressEvent) => any) : Promise { @@ -89,13 +86,13 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Download or prefetch a SCORM. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} single True if we're downloading a single module, false if we're downloading a whole section. - * @param {String} siteId Site ID. - * @param {boolean} prefetch True to prefetch, false to download right away. - * @param {Function} [onProgress] Function to call on progress. - * @return {Promise} Promise resolved with the "extra" data to store: the hash of the file. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. + * @param prefetch True to prefetch, false to download right away. + * @param onProgress Function to call on progress. + * @return Promise resolved with the "extra" data to store: the hash of the file. */ protected downloadOrPrefetchScorm(module: any, courseId: number, single: boolean, siteId: string, prefetch: boolean, onProgress?: (event: AddonModScormProgressEvent) => any): Promise { @@ -136,11 +133,11 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Downloads/Prefetches and unzips the SCORM package. * - * @param {any} scorm SCORM object. - * @param {boolean} [prefetch] True if prefetch, false otherwise. - * @param {Function} [onProgress] Function to call on progress. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the file is downloaded and unzipped. + * @param scorm SCORM object. + * @param prefetch True if prefetch, false otherwise. + * @param onProgress Function to call on progress. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the file is downloaded and unzipped. */ protected downloadOrPrefetchMainFile(scorm: any, prefetch?: boolean, onProgress?: (event: AddonModScormProgressEvent) => any, siteId?: string): Promise { @@ -187,11 +184,11 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Downloads/Prefetches and unzips the SCORM package if it should be downloaded. * - * @param {any} scorm SCORM object. - * @param {boolean} [prefetch] True if prefetch, false otherwise. - * @param {Function} [onProgress] Function to call on progress. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the file is downloaded and unzipped. + * @param scorm SCORM object. + * @param prefetch True if prefetch, false otherwise. + * @param onProgress Function to call on progress. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the file is downloaded and unzipped. */ protected downloadOrPrefetchMainFileIfNeeded(scorm: any, prefetch?: boolean, onProgress?: (event: AddonModScormProgressEvent) => any, siteId?: string): Promise { @@ -216,8 +213,8 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Function that converts a regular ProgressEvent into a AddonModScormProgressEvent. * - * @param {Function} [onProgress] Function to call on progress. - * @param {ProgressEvent} [progress] Event returned by the download function. + * @param onProgress Function to call on progress. + * @param progress Event returned by the download function. */ protected downloadProgress(downloading: boolean, onProgress?: (event: AddonModScormProgressEvent) => any, progress?: ProgressEvent): void { @@ -233,9 +230,9 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Get WS data for SCORM. * - * @param {any} scorm SCORM object. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is prefetched. + * @param scorm SCORM object. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is prefetched. */ fetchWSData(scorm: any, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -276,11 +273,11 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Get the download size of a module. * - * @param {any} module Module. - * @param {Number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise<{size: number, total: boolean}>} Promise resolved with the size and a boolean indicating if it was able - * to calculate the total size. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved with the size and a boolean indicating if it was able + * to calculate the total size. */ getDownloadSize(module: any, courseId: any, single?: boolean): Promise<{ size: number, total: boolean }> { return this.scormProvider.getScorm(courseId, module.id, module.url).then((scorm) => { @@ -300,9 +297,9 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Get the downloaded size of a module. If not defined, we'll use getFiles to calculate it (it can be slow). * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {number|Promise} Size, or promise resolved with the size. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Size, or promise resolved with the size. */ getDownloadedSize(module: any, courseId: number): number | Promise { return this.scormProvider.getScorm(courseId, module.id, module.url).then((scorm) => { @@ -316,10 +313,10 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Get list of files. If not defined, we'll assume they're in module.contents. * - * @param {any} module Module. - * @param {Number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise} Promise resolved with the list of files. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved with the list of files. */ getFiles(module: any, courseId: number, single?: boolean): Promise { return this.scormProvider.getScorm(courseId, module.id, module.url).then((scorm) => { @@ -333,9 +330,9 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId The course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId The course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.scormProvider.invalidateContent(moduleId, courseId); @@ -344,9 +341,9 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Invalidate WS calls needed to determine module status. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule(module: any, courseId: number): Promise { // Invalidate the calls required to check if a SCORM is downloadable. @@ -356,9 +353,9 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Check if a module can be downloaded. If the function is not defined, we assume that all modules are downloadable. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {boolean|Promise} Whether the module can be downloaded. The promise should never be rejected. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Whether the module can be downloaded. The promise should never be rejected. */ isDownloadable(module: any, courseId: number): boolean | Promise { return this.scormProvider.getScorm(courseId, module.id, module.url).then((scorm) => { @@ -378,12 +375,12 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @param {Function} [onProgress] Function to call on progress. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @param onProgress Function to call on progress. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string, onProgress?: (event: AddonModScormProgressEvent) => any): Promise { @@ -396,9 +393,9 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Remove module downloaded files. If not defined, we'll use getFiles to remove them (slow). * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when done. */ removeFiles(module: any, courseId: number): Promise { const siteId = this.sitesProvider.getCurrentSiteId(); @@ -433,10 +430,10 @@ export class AddonModScormPrefetchHandler extends CoreCourseActivityPrefetchHand /** * Sync a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ sync(module: any, courseId: number, siteId?: any): Promise { if (!this.syncProvider) { diff --git a/src/addon/mod/scorm/providers/scorm-offline.ts b/src/addon/mod/scorm/providers/scorm-offline.ts index 74af07260..9c605f2dd 100644 --- a/src/addon/mod/scorm/providers/scorm-offline.ts +++ b/src/addon/mod/scorm/providers/scorm-offline.ts @@ -134,12 +134,12 @@ export class AddonModScormOfflineProvider { * This function is used to convert attempts into new attempts, so the stored snapshot will be removed and * entries will be marked as not synced. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Number of the attempt to change. - * @param {number} newAttempt New attempt number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when the attempt number changes. + * @param scormId SCORM ID. + * @param attempt Number of the attempt to change. + * @param newAttempt New attempt number. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when the attempt number changes. */ changeAttemptNumber(scormId: number, attempt: number, newAttempt: number, siteId?: string, userId?: number): Promise { @@ -186,13 +186,13 @@ export class AddonModScormOfflineProvider { /** * Creates a new offline attempt. It can be created from scratch or as a copy of another attempt. * - * @param {any} scorm SCORM. - * @param {number} attempt Number of the new attempt. - * @param {any} userData User data to store in the attempt. - * @param {any} [snapshot] Optional. Snapshot to store in the attempt. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when the new attempt is created. + * @param scorm SCORM. + * @param attempt Number of the new attempt. + * @param userData User data to store in the attempt. + * @param snapshot Optional. Snapshot to store in the attempt. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when the new attempt is created. */ createNewAttempt(scorm: any, attempt: number, userData: any, snapshot?: any, siteId?: string, userId?: number): Promise { @@ -248,11 +248,11 @@ export class AddonModScormOfflineProvider { /** * Delete all the stored data from an attempt. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attempt number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when all the data has been deleted. + * @param scormId SCORM ID. + * @param attempt Attempt number. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when all the data has been deleted. */ deleteAttempt(scormId: number, attempt: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -279,8 +279,8 @@ export class AddonModScormOfflineProvider { * Helper function to return a formatted list of interactions for reports. * This function is based in Moodle's scorm_format_interactions. * - * @param {any} scoUserData Userdata from a certain SCO. - * @return {any} Formatted userdata. + * @param scoUserData Userdata from a certain SCO. + * @return Formatted userdata. */ protected formatInteractions(scoUserData: any): any { const formatted: any = {}; @@ -334,8 +334,8 @@ export class AddonModScormOfflineProvider { /** * Get all the offline attempts in a certain site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the offline attempts are retrieved. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the offline attempts are retrieved. */ getAllAttempts(siteId?: string): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -352,11 +352,11 @@ export class AddonModScormOfflineProvider { /** * Get an offline attempt. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attempt number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved with the attempt. + * @param scormId SCORM ID. + * @param attempt Attempt number. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved with the attempt. */ getAttempt(scormId: number, attempt: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -374,11 +374,11 @@ export class AddonModScormOfflineProvider { /** * Get the creation time of an attempt. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attempt number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved with time the attempt was created. + * @param scormId SCORM ID. + * @param attempt Attempt number. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved with time the attempt was created. */ getAttemptCreationTime(scormId: number, attempt: number, siteId?: string, userId?: number): Promise { return this.getAttempt(scormId, attempt, siteId, userId).catch(() => { @@ -391,10 +391,10 @@ export class AddonModScormOfflineProvider { /** * Get the offline attempts done by a user in the given SCORM. * - * @param {number} scormId SCORM ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when the offline attempts are retrieved. + * @param scormId SCORM ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when the offline attempts are retrieved. */ getAttempts(scormId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -413,11 +413,11 @@ export class AddonModScormOfflineProvider { /** * Get the snapshot of an attempt. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attempt number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved with the snapshot or undefined if no snapshot. + * @param scormId SCORM ID. + * @param attempt Attempt number. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved with the snapshot or undefined if no snapshot. */ getAttemptSnapshot(scormId: number, attempt: number, siteId?: string, userId?: number): Promise { return this.getAttempt(scormId, attempt, siteId, userId).catch(() => { @@ -430,8 +430,8 @@ export class AddonModScormOfflineProvider { /** * Get launch URLs from a list of SCOs, indexing them by SCO ID. * - * @param {any[]} scos List of SCOs. Each SCO needs to have 'id' and 'launch' properties. - * @return {{[scoId: number]: string}} Launch URLs indexed by SCO ID. + * @param scos List of SCOs. Each SCO needs to have 'id' and 'launch' properties. + * @return Launch URLs indexed by SCO ID. */ protected getLaunchUrlsFromScos(scos: any[]): {[scoId: number]: string} { scos = scos || []; @@ -448,13 +448,13 @@ export class AddonModScormOfflineProvider { /** * Get data stored in local DB for a certain scorm and attempt. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attempt number. - * @param {boolean} [excludeSynced] Whether it should only return not synced entries. - * @param {boolean} [excludeNotSynced] Whether it should only return synced entries. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved with the entries. + * @param scormId SCORM ID. + * @param attempt Attempt number. + * @param excludeSynced Whether it should only return not synced entries. + * @param excludeNotSynced Whether it should only return synced entries. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved with the entries. */ getScormStoredData(scormId: number, attempt: number, excludeSynced?: boolean, excludeNotSynced?: boolean, siteId?: string, userId?: number): Promise { @@ -491,13 +491,13 @@ export class AddonModScormOfflineProvider { /** * Get the user data for a certain SCORM and offline attempt. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attempt number. - * @param {any[]} scos SCOs returned by AddonModScormProvider.getScos. If not supplied, this function will only return the - * SCOs that have something stored and cmi.launch_data will be undefined. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when the user data is retrieved. + * @param scormId SCORM ID. + * @param attempt Attempt number. + * @param scos SCOs returned by AddonModScormProvider.getScos. If not supplied, this function will only return the + * SCOs that have something stored and cmi.launch_data will be undefined. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when the user data is retrieved. */ getScormUserData(scormId: number, attempt: number, scos: any[], siteId?: string, userId?: number): Promise { scos = scos || []; @@ -627,16 +627,16 @@ export class AddonModScormOfflineProvider { * Insert a track in the offline tracks store. * This function is based on Moodle's scorm_insert_track. * - * @param {number} scormId SCORM ID. - * @param {number} scoId SCO ID. - * @param {number} attempt Attempt number. - * @param {string} element Name of the element to insert. - * @param {any} value Value to insert. - * @param {boolean} [forceCompleted] True if SCORM forces completed. - * @param {any} [scoData] User data for the given SCO. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not set use site's current user. - * @return {Promise} Promise resolved when the insert is done. + * @param scormId SCORM ID. + * @param scoId SCO ID. + * @param attempt Attempt number. + * @param element Name of the element to insert. + * @param value Value to insert. + * @param forceCompleted True if SCORM forces completed. + * @param scoData User data for the given SCO. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not set use site's current user. + * @return Promise resolved when the insert is done. */ protected insertTrack(scormId: number, scoId: number, attempt: number, element: string, value: any, forceCompleted?: boolean, scoData?: any, siteId?: string, userId?: number): Promise { @@ -692,15 +692,15 @@ export class AddonModScormOfflineProvider { /** * Insert a track in the DB. * - * @param {SQLiteDB} db Site's DB. - * @param {number} userId User ID. - * @param {number} scormId SCORM ID. - * @param {number} scoId SCO ID. - * @param {number} attempt Attempt number. - * @param {string} element Name of the element to insert. - * @param {any} value Value of the element to insert. - * @param {boolean} synchronous True if insert should NOT return a promise. Please use it only if synchronous is a must. - * @return {boolean|Promise} Returns a promise if synchronous=false, otherwise returns a boolean. + * @param db Site's DB. + * @param userId User ID. + * @param scormId SCORM ID. + * @param scoId SCO ID. + * @param attempt Attempt number. + * @param element Name of the element to insert. + * @param value Value of the element to insert. + * @param synchronous True if insert should NOT return a promise. Please use it only if synchronous is a must. + * @return Returns a promise if synchronous=false, otherwise returns a boolean. */ protected insertTrackToDB(db: SQLiteDB, userId: number, scormId: number, scoId: number, attempt: number, element: string, value: any, synchronous?: boolean): boolean | Promise { @@ -731,15 +731,15 @@ export class AddonModScormOfflineProvider { * Please use this function only if synchronous is a must. It's recommended to use insertTrack. * This function is based on Moodle's scorm_insert_track. * - * @param {number} scormId SCORM ID. - * @param {number} scoId SCO ID. - * @param {number} attempt Attempt number. - * @param {string} element Name of the element to insert. - * @param {any} value Value of the element to insert. - * @param {boolean} [forceCompleted] True if SCORM forces completed. - * @param {any} [scoData] User data for the given SCO. - * @param {number} [userId] User ID. If not set use current user. - * @return {boolean} Promise resolved when the insert is done. + * @param scormId SCORM ID. + * @param scoId SCO ID. + * @param attempt Attempt number. + * @param element Name of the element to insert. + * @param value Value of the element to insert. + * @param forceCompleted True if SCORM forces completed. + * @param scoData User data for the given SCO. + * @param userId User ID. If not set use current user. + * @return Promise resolved when the insert is done. */ protected insertTrackSync(scormId: number, scoId: number, attempt: number, element: string, value: any, forceCompleted?: boolean, scoData?: any, userId?: number): boolean { @@ -791,12 +791,12 @@ export class AddonModScormOfflineProvider { /** * Mark all the entries from a SCO and attempt as synced. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attempt number. - * @param {number} scoId SCO ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when marked. + * @param scormId SCORM ID. + * @param attempt Attempt number. + * @param scoId SCO ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when marked. */ markAsSynced(scormId: number, attempt: number, scoId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -817,8 +817,8 @@ export class AddonModScormOfflineProvider { /** * Removes the default data form user data. * - * @param {any} userData User data returned by AddonModScormProvider.getScormUserData. - * @return {any} User data without default data. + * @param userData User data returned by AddonModScormProvider.getScormUserData. + * @return User data without default data. */ protected removeDefaultData(userData: any): any { const result = this.utils.clone(userData); @@ -833,14 +833,14 @@ export class AddonModScormOfflineProvider { /** * Saves a SCORM tracking record in offline. * - * @param {any} scorm SCORM. - * @param {number} scoId Sco ID. - * @param {number} attempt Attempt number. - * @param {any[]} tracks Tracking data to store. - * @param {any} userData User data for this attempt and SCO. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when data is saved. + * @param scorm SCORM. + * @param scoId Sco ID. + * @param attempt Attempt number. + * @param tracks Tracking data to store. + * @param userData User data for this attempt and SCO. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when data is saved. */ saveTracks(scorm: any, scoId: number, attempt: number, tracks: any[], userData: any, siteId?: string, userId?: number) : Promise { @@ -869,13 +869,13 @@ export class AddonModScormOfflineProvider { * Saves a SCORM tracking record in offline returning a synchronous value. * Please use this function only if synchronous is a must. It's recommended to use saveTracks. * - * @param {any} scorm SCORM. - * @param {number} scoId Sco ID. - * @param {number} attempt Attempt number. - * @param {Object[]} tracks Tracking data to store. - * @param {any} userData User data for this attempt and SCO. - * @return {boolean} True if data to insert is valid, false otherwise. Returning true doesn't mean that the data - * has been stored, this function can return true but the insertion can still fail somehow. + * @param scorm SCORM. + * @param scoId Sco ID. + * @param attempt Attempt number. + * @param tracks Tracking data to store. + * @param userData User data for this attempt and SCO. + * @return True if data to insert is valid, false otherwise. Returning true doesn't mean that the data + * has been stored, this function can return true but the insertion can still fail somehow. */ saveTracksSync(scorm: any, scoId: number, attempt: number, tracks: any[], userData: any, userId?: number): boolean { userId = userId || this.sitesProvider.getCurrentSiteUserId(); @@ -895,10 +895,10 @@ export class AddonModScormOfflineProvider { * Check for a parameter in userData and return it if it's set or return 'ifempty' if it's empty. * Based on Moodle's scorm_isset function. * - * @param {any} userData Contains user's data. - * @param {string} param Name of parameter that should be checked. - * @param {any} [ifEmpty] Value to be replaced with if param is not set. - * @return {any} Value from userData[param] if set, ifEmpty otherwise. + * @param userData Contains user's data. + * @param param Name of parameter that should be checked. + * @param ifEmpty Value to be replaced with if param is not set. + * @return Value from userData[param] if set, ifEmpty otherwise. */ protected scormIsset(userData: any, param: string, ifEmpty: any = ''): any { if (typeof userData[param] != 'undefined') { @@ -911,12 +911,12 @@ export class AddonModScormOfflineProvider { /** * Set an attempt's snapshot. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attempt number. - * @param {any} userData User data to store as snapshot. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when snapshot has been stored. + * @param scormId SCORM ID. + * @param attempt Attempt number. + * @param userData User data to store as snapshot. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when snapshot has been stored. */ setAttemptSnapshot(scormId: number, attempt: number, userData: any, siteId?: string, userId?: number): Promise { diff --git a/src/addon/mod/scorm/providers/scorm-sync.ts b/src/addon/mod/scorm/providers/scorm-sync.ts index bb6074179..9a5cc7259 100644 --- a/src/addon/mod/scorm/providers/scorm-sync.ts +++ b/src/addon/mod/scorm/providers/scorm-sync.ts @@ -36,19 +36,16 @@ import { AddonModScormPrefetchHandler } from './prefetch-handler'; export interface AddonModScormSyncResult { /** * List of warnings. - * @type {string[]} */ warnings: string[]; /** * Whether an attempt was finished in the site due to the sync, - * @type {boolean} */ attemptFinished: boolean; /** * Whether some data was sent to the site. - * @type {boolean} */ updated: boolean; } @@ -81,16 +78,16 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * Add an offline attempt to the right of the new attempts array if possible. * If the attempt cannot be created as a new attempt then it will be deleted. * - * @param {number} scormId SCORM ID. - * @param {number} attempt The offline attempt to treat. - * @param {number} lastOffline Last offline attempt number. - * @param {number[]} newAttemptsSameOrder Attempts that'll be created as new attempts but keeping the current order. - * @param {any} newAttemptsAtEnd Object with attempts that'll be created at the end of the list of attempts (should be max 1). - * @param {number} lastOfflineCreated Time when the last offline attempt was created. - * @param {boolean} lastOfflineIncomplete Whether the last offline attempt is incomplete. - * @param {string[]} warnings Array where to add the warnings. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when done. + * @param scormId SCORM ID. + * @param attempt The offline attempt to treat. + * @param lastOffline Last offline attempt number. + * @param newAttemptsSameOrder Attempts that'll be created as new attempts but keeping the current order. + * @param newAttemptsAtEnd Object with attempts that'll be created at the end of the list of attempts (should be max 1). + * @param lastOfflineCreated Time when the last offline attempt was created. + * @param lastOfflineIncomplete Whether the last offline attempt is incomplete. + * @param warnings Array where to add the warnings. + * @param siteId Site ID. + * @return Promise resolved when done. */ protected addToNewOrDelete(scormId: number, attempt: number, lastOffline: number, newAttemptsSameOrder: number[], newAttemptsAtEnd: any, lastOfflineCreated: number, lastOfflineIncomplete: boolean, warnings: string[], @@ -129,11 +126,11 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide /** * Check if can retry an attempt synchronization. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attempt number. - * @param {number} lastOnline Last online attempt number. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved if can retry the synchronization, rejected otherwise. + * @param scormId SCORM ID. + * @param attempt Attempt number. + * @param lastOnline Last online attempt number. + * @param siteId Site ID. + * @return Promise resolved if can retry the synchronization, rejected otherwise. */ protected canRetrySync(scormId: number, attempt: number, lastOnline: number, siteId: string): Promise { // If it's the last attempt we don't need to ignore cache because we already did it. @@ -153,11 +150,11 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide /** * Create new attempts at the end of the offline attempts list. * - * @param {number} scormId SCORM ID. - * @param {any} newAttempts Object with the attempts to create. The keys are the timecreated, the values are the attempt number. - * @param {number} lastOffline Number of last offline attempt. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when done. + * @param scormId SCORM ID. + * @param newAttempts Object with the attempts to create. The keys are the timecreated, the values are the attempt number. + * @param lastOffline Number of last offline attempt. + * @param siteId Site ID. + * @return Promise resolved when done. */ protected createNewAttemptsAtEnd(scormId: number, newAttempts: any, lastOffline: number, siteId: string): Promise { const times = Object.keys(newAttempts).sort(), // Sort in ASC order. @@ -179,14 +176,14 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide /** * Finish a sync process: remove offline data if needed, prefetch SCORM data, set sync time and return the result. * - * @param {string} siteId Site ID. - * @param {any} scorm SCORM. - * @param {string[]} warnings List of warnings generated by the sync. - * @param {number} [lastOnline] Last online attempt number before the sync. - * @param {boolean} [lastOnlineWasFinished] Whether the last online attempt was finished before the sync. - * @param {AddonModScormAttemptCountResult} [initialCount] Attempt count before the sync. - * @param {boolean} [updated] Whether some data was sent to the site. - * @return {Promise} Promise resolved on success. + * @param siteId Site ID. + * @param scorm SCORM. + * @param warnings List of warnings generated by the sync. + * @param lastOnline Last online attempt number before the sync. + * @param lastOnlineWasFinished Whether the last online attempt was finished before the sync. + * @param initialCount Attempt count before the sync. + * @param updated Whether some data was sent to the site. + * @return Promise resolved on success. */ protected finishSync(siteId: string, scorm: any, warnings: string[], lastOnline?: number, lastOnlineWasFinished?: boolean, initialCount?: AddonModScormAttemptCountResult, updated?: boolean): Promise { @@ -239,10 +236,10 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide /** * Get the creation time and the status (complete/incomplete) of an offline attempt. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attempt number. - * @param {string} siteId Site ID. - * @return {Promise<{incomplete: boolean, timecreated: number}>} Promise resolved with the data. + * @param scormId SCORM ID. + * @param attempt Attempt number. + * @param siteId Site ID. + * @return Promise resolved with the data. */ protected getOfflineAttemptData(scormId: number, attempt: number, siteId: string) : Promise<{incomplete: boolean, timecreated: number}> { @@ -264,13 +261,13 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * Example: We have offline attempts 1, 2 and 3. #1 and #2 have collisions. #1 can be synced, but #2 needs * to be a new attempt. #3 will now be #4, and #2 will now be #3. * - * @param {number} scormId SCORM ID. - * @param {number[]} newAttempts Attempts that need to be converted into new attempts. - * @param {number} lastOnline Last online attempt. - * @param {number} lastCollision Last attempt with collision (exists in online and offline). - * @param {number[]} offlineAttempts Numbers of offline attempts. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when attempts have been moved. + * @param scormId SCORM ID. + * @param newAttempts Attempts that need to be converted into new attempts. + * @param lastOnline Last online attempt. + * @param lastCollision Last attempt with collision (exists in online and offline). + * @param offlineAttempts Numbers of offline attempts. + * @param siteId Site ID. + * @return Promise resolved when attempts have been moved. */ protected moveNewAttempts(scormId: any, newAttempts: number[], lastOnline: number, lastCollision: number, offlineAttempts: number[], siteId: string): Promise { @@ -364,10 +361,10 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide /** * Save a snapshot from a synchronization. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attemot number. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when the snapshot is stored. + * @param scormId SCORM ID. + * @param attempt Attemot number. + * @param siteId Site ID. + * @return Promise resolved when the snapshot is stored. */ protected saveSyncSnapshot(scormId: number, attempt: number, siteId: string): Promise { // Try to get current state from the site. @@ -404,9 +401,9 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * It only compares elements with dot notation. This means that, if some SCO has been added to Moodle web * but the user hasn't generated data for it, then the snapshot will be detected as equal. * - * @param {any} snapshot Attempt's snapshot. - * @param {any} userData Data retrieved from the site. - * @return {boolean} True if snapshot is equal to the user data, false otherwise. + * @param snapshot Attempt's snapshot. + * @param userData Data retrieved from the site. + * @return True if snapshot is equal to the user data, false otherwise. */ protected snapshotEquals(snapshot: any, userData: any): boolean { // Check that snapshot contains the data from the site. @@ -443,9 +440,9 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide /** * Try to synchronize all the SCORMs in a certain site or in all sites. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} force Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncAllScorms(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all SCORMs', this.syncAllScormsFunc.bind(this), [force], siteId); @@ -454,9 +451,9 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide /** * Sync all SCORMs on a site. * - * @param {string} siteId Site ID to sync. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @param {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. + * @param force Wether to force sync not depending on last execution. + * @param Promise resolved if sync is successful, rejected if sync fails. */ protected syncAllScormsFunc(siteId: string, force?: boolean): Promise { @@ -507,10 +504,10 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide /** * Send data from a SCORM offline attempt to the site. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attempt number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the attempt is successfully synced. + * @param scormId SCORM ID. + * @param attempt Attempt number. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the attempt is successfully synced. */ protected syncAttempt(scormId: number, attempt: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -583,9 +580,9 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide /** * Sync a SCORM only if a certain time has passed since the last time. * - * @param {any} scorm SCORM. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the SCORM is synced or if it doesn't need to be synced. + * @param scorm SCORM. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the SCORM is synced or if it doesn't need to be synced. */ syncScormIfNeeded(scorm: any, siteId?: string): Promise { return this.isSyncNeeded(scorm.id, siteId).then((needed) => { @@ -600,9 +597,9 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide * The promise returned will be resolved with an array with warnings if the synchronization is successful. A successful * synchronization doesn't mean that all the data has been sent to the site, it's possible that some attempt can't be sent. * - * @param {any} scorm SCORM. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved in success. + * @param scorm SCORM. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved in success. */ syncScorm(scorm: any, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -729,12 +726,12 @@ export class AddonModScormSyncProvider extends CoreCourseActivitySyncBaseProvide /** * Treat collisions found in a SCORM synchronization process. * - * @param {number} scormId SCORM ID. - * @param {number[]} collisions Numbers of attempts that exist both in online and offline. - * @param {number} lastOnline Last online attempt. - * @param {number[]} offlineAttempts Numbers of offline attempts. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved with the SCORM size. + * @param scorm SCORM. + * @return Promise resolved with the SCORM size. */ calculateScormSize(scorm: any): Promise { if (scorm.packagesize) { @@ -195,9 +191,9 @@ export class AddonModScormProvider { /** * Count the attempts left for the given scorm. * - * @param {any} scorm SCORM. - * @param {number} attemptsCount Number of attempts performed. - * @return {number} Number of attempts left. + * @param scorm SCORM. + * @param attemptsCount Number of attempts performed. + * @return Number of attempts left. */ countAttemptsLeft(scorm: any, attemptsCount: number): number { if (scorm.maxattempt == 0) { @@ -216,12 +212,12 @@ export class AddonModScormProvider { * Returns the mode and attempt number to use based on mode selected and SCORM data. * This function is based on Moodle's scorm_check_mode. * - * @param {any} scorm SCORM. - * @param {string} mode Selected mode. - * @param {number} attempt Current attempt. - * @param {boolean} [newAttempt] Whether it should start a new attempt. - * @param {boolean} [incomplete] Whether current attempt is incomplete. - * @return {{mode: string, attempt: number, newAttempt: boolean}} Mode, attempt number and whether to start a new attempt. + * @param scorm SCORM. + * @param mode Selected mode. + * @param attempt Current attempt. + * @param newAttempt Whether it should start a new attempt. + * @param incomplete Whether current attempt is incomplete. + * @return Mode, attempt number and whether to start a new attempt. */ determineAttemptAndMode(scorm: any, mode: string, attempt: number, newAttempt?: boolean, incomplete?: boolean) : {mode: string, attempt: number, newAttempt: boolean} { @@ -289,8 +285,8 @@ export class AddonModScormProvider { /** * Check if TOC should be displayed in the player. * - * @param {any} scorm SCORM. - * @return {boolean} Whether it should display TOC. + * @param scorm SCORM. + * @return Whether it should display TOC. */ displayTocInPlayer(scorm: any): boolean { return scorm.hidetoc !== 3; @@ -301,9 +297,9 @@ export class AddonModScormProvider { * Evaluates the expression and returns a boolean answer. * See 2.3.2.5.1. Sequencing/Navigation Today - from the SCORM 1.2 spec (CAM). * - * @param {string} prerequisites The AICC_SCRIPT prerequisites expression. - * @param {any} trackData The tracked user data of each SCO. - * @return {boolean} Whether the prerequisites are fulfilled. + * @param prerequisites The AICC_SCRIPT prerequisites expression. + * @param trackData The tracked user data of each SCO. + * @return Whether the prerequisites are fulfilled. */ evalPrerequisites(prerequisites: string, trackData: any): boolean { @@ -404,9 +400,9 @@ export class AddonModScormProvider { /** * Formats a grade to be displayed. * - * @param {any} scorm SCORM. - * @param {number} grade Grade. - * @return {string} Grade to display. + * @param scorm SCORM. + * @param grade Grade. + * @return Grade to display. */ formatGrade(scorm: any, grade: number): string { if (typeof grade == 'undefined' || grade == -1) { @@ -425,9 +421,9 @@ export class AddonModScormProvider { /** * Formats a tree-like TOC into an array. * - * @param {any[]} toc SCORM's TOC (tree format). - * @param {number} [level=0] The level of the TOC we're right now. 0 by default. - * @return {any[]} SCORM's TOC (array format). + * @param toc SCORM's TOC (tree format). + * @param level The level of the TOC we're right now. 0 by default. + * @return SCORM's TOC (array format). */ formatTocToArray(toc: any[], level: number = 0): any[] { if (!toc || !toc.length) { @@ -449,10 +445,10 @@ export class AddonModScormProvider { /** * Get access information for a given SCORM. * - * @param {number} scormId SCORM ID. - * @param {boolean} [forceCache] True to always get the value from cache. false otherwise. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Object with access information. + * @param scormId SCORM ID. + * @param forceCache True to always get the value from cache. false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Object with access information. * @since 3.7 */ getAccessInformation(scormId: number, forceCache?: boolean, siteId?: string): Promise { @@ -477,8 +473,8 @@ export class AddonModScormProvider { /** * Get cache key for access information WS calls. * - * @param {number} scormId SCORM ID. - * @return {string} Cache key. + * @param scormId SCORM ID. + * @return Cache key. */ protected getAccessInformationCacheKey(scormId: number): string { return this.ROOT_CACHE_KEY + 'accessInfo:' + scormId; @@ -487,12 +483,12 @@ export class AddonModScormProvider { /** * Get the number of attempts done by a user in the given SCORM. * - * @param {number} scormId SCORM ID. - * @param {boolean} [ignoreMissing] Whether it should ignore attempts without grade/completion. Only for online attempts. - * @param {boolean} [ignoreCache] Whether it should ignore cached data for online attempts. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when done. + * @param scormId SCORM ID. + * @param ignoreMissing Whether it should ignore attempts without grade/completion. Only for online attempts. + * @param ignoreCache Whether it should ignore cached data for online attempts. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when done. */ getAttemptCount(scormId: number, ignoreMissing?: boolean, ignoreCache?: boolean, siteId?: string, userId?: number) : Promise { @@ -559,9 +555,9 @@ export class AddonModScormProvider { /** * Get cache key for SCORM attempt count WS calls. * - * @param {number} scormId SCORM ID. - * @param {number} [userId] User ID. If not defined, current user. - * @return {string} Cache key. + * @param scormId SCORM ID. + * @param userId User ID. If not defined, current user. + * @return Cache key. */ protected getAttemptCountCacheKey(scormId: number, userId: number): string { return this.ROOT_CACHE_KEY + 'attemptcount:' + scormId + ':' + userId; @@ -570,12 +566,12 @@ export class AddonModScormProvider { /** * Get the number of attempts done by a user in the given SCORM in online. * - * @param {number} scormId SCORM ID. - * @param {boolean} [ignoreMissing] Whether it should ignore attempts that haven't reported a grade/completion. - * @param {boolean} [ignoreCache] Whether 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 {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when the attempt count is retrieved. + * @param scormId SCORM ID. + * @param ignoreMissing Whether it should ignore attempts that haven't reported a grade/completion. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when the attempt count is retrieved. */ getAttemptCountOnline(scormId: number, ignoreMissing?: boolean, ignoreCache?: boolean, siteId?: string, userId?: number) : Promise { @@ -612,11 +608,11 @@ export class AddonModScormProvider { * Get the grade for a certain SCORM and attempt. * Based on Moodle's scorm_grade_user_attempt. * - * @param {any} scorm SCORM. - * @param {number} attempt Attempt number. - * @param {boolean} [offline] Whether the attempt is offline. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the grade. If the attempt hasn't reported grade/completion, it will be -1. + * @param scorm SCORM. + * @param attempt Attempt number. + * @param offline Whether the attempt is offline. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the grade. If the attempt hasn't reported grade/completion, it will be -1. */ getAttemptGrade(scorm: any, attempt: number, offline?: boolean, siteId?: string): Promise { const attemptScore = { @@ -680,9 +676,9 @@ export class AddonModScormProvider { /** * Get the list of a organizations defined in a SCORM package. * - * @param {number} scormId SCORM ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the list of organizations. + * @param scormId SCORM ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of organizations. */ getOrganizations(scormId: number, siteId?: string): Promise { return this.getScos(scormId, undefined, false, siteId).then((scos) => { @@ -706,12 +702,12 @@ export class AddonModScormProvider { /** * Get the organization Toc any * - * @param {number} scormId SCORM ID. - * @param {number} attempt The attempt number (to populate SCO track data). - * @param {string} [organization] Organization identifier. - * @param {boolean} [offline] Whether the attempt is offline. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the toc object. + * @param scormId SCORM ID. + * @param attempt The attempt number (to populate SCO track data). + * @param organization Organization identifier. + * @param offline Whether the attempt is offline. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the toc object. */ getOrganizationToc(scormId: number, attempt: number, organization?: string, offline?: boolean, siteId?: string) : Promise { @@ -742,8 +738,8 @@ export class AddonModScormProvider { /** * Get the package URL of a given SCORM. * - * @param {any} scorm SCORM. - * @return {string} Package URL. + * @param scorm SCORM. + * @return Package URL. */ getPackageUrl(scorm: any): string { if (scorm.packageurl) { @@ -759,13 +755,13 @@ export class AddonModScormProvider { /** * Get the user data for a certain SCORM and attempt. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attempt number. - * @param {any[]} [scos] SCOs returned by getScos. Recommended if offline=true. - * @param {boolean} [offline] Whether the attempt is offline. - * @param {boolean} [ignoreCache] Whether it should ignore cached data for online attempts. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the user data is retrieved. + * @param scormId SCORM ID. + * @param attempt Attempt number. + * @param scos SCOs returned by getScos. Recommended if offline=true. + * @param offline Whether the attempt is offline. + * @param ignoreCache Whether it should ignore cached data for online attempts. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the user data is retrieved. */ getScormUserData(scormId: number, attempt: number, scos?: any[], offline?: boolean, ignoreCache?: boolean, siteId?: string) : Promise { @@ -787,9 +783,9 @@ export class AddonModScormProvider { /** * Get cache key for SCORM user data WS calls. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attempt number. - * @return {string} Cache key. + * @param scormId SCORM ID. + * @param attempt Attempt number. + * @return Cache key. */ protected getScormUserDataCacheKey(scormId: number, attempt: number): string { return this.getScormUserDataCommonCacheKey(scormId) + ':' + attempt; @@ -798,8 +794,8 @@ export class AddonModScormProvider { /** * Get common cache key for SCORM user data WS calls. * - * @param {number} scormId SCORM ID. - * @return {string} Cache key. + * @param scormId SCORM ID. + * @return Cache key. */ protected getScormUserDataCommonCacheKey(scormId: number): string { return this.ROOT_CACHE_KEY + 'userdata:' + scormId; @@ -808,11 +804,11 @@ export class AddonModScormProvider { /** * Get the user data for a certain SCORM and attempt in online. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attempt number. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the user data is retrieved. + * @param scormId SCORM ID. + * @param attempt Attempt number. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the user data is retrieved. */ getScormUserDataOnline(scormId: number, attempt: number, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -852,8 +848,8 @@ export class AddonModScormProvider { /** * Get cache key for get SCORM scos WS calls. * - * @param {number} scormId SCORM ID. - * @return {string} Cache key. + * @param scormId SCORM ID. + * @return Cache key. */ protected getScosCacheKey(scormId: number): string { return this.ROOT_CACHE_KEY + 'scos:' + scormId; @@ -862,11 +858,11 @@ export class AddonModScormProvider { /** * Retrieves the list of SCO objects for a given SCORM and organization. * - * @param {number} scormId SCORM ID. - * @param {string} [organization] Organization. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail if offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -909,13 +905,13 @@ export class AddonModScormProvider { * Retrieves the list of SCO objects for a given SCORM and organization, including data about * a certain attempt (status, isvisible, ...). * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attempt number. - * @param {string} [organization] Organization ID. - * @param {boolean} [offline] Whether the attempt is offline. - * @param {boolean} [ignoreCache] Whether it should ignore cached data for online attempts. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with a list of SCO objects. + * @param scormId SCORM ID. + * @param attempt Attempt number. + * @param organization Organization ID. + * @param offline Whether the attempt is offline. + * @param ignoreCache Whether it should ignore cached data for online attempts. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with a list of SCO objects. */ getScosWithData(scormId: number, attempt: number, organization?: string, offline?: boolean, ignoreCache?: boolean, siteId?: string): Promise { @@ -963,10 +959,10 @@ export class AddonModScormProvider { /** * Given a SCORM and a SCO, returns the full launch URL for the SCO. * - * @param {any} scorm SCORM. - * @param {any} sco SCO. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the URL. + * @param scorm SCORM. + * @param sco SCO. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the URL. */ getScoSrc(scorm: any, sco: any, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -1008,9 +1004,9 @@ export class AddonModScormProvider { /** * Get the path to the folder where a SCORM is downloaded. * - * @param {string} moduleUrl Module URL (returned by get_course_contents). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the folder path. + * @param moduleUrl Module URL (returned by get_course_contents). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the folder path. */ getScormFolder(moduleUrl: string, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -1022,8 +1018,8 @@ export class AddonModScormProvider { * Gets a list of files to downlaod for a SCORM, using a format similar to module.contents from get_course_contents. * It will only return one file: the ZIP package. * - * @param {any} scorm SCORM. - * @return {any[]} File list. + * @param scorm SCORM. + * @return File list. */ getScormFileList(scorm: any): any[] { const files = []; @@ -1045,9 +1041,9 @@ export class AddonModScormProvider { /** * Get the URL and description of the status icon. * - * @param {any} sco SCO. - * @param {boolean} [incomplete] Whether the SCORM is incomplete. - * @return {{url: string, description: string}} Image URL and description. + * @param sco SCO. + * @param incomplete Whether the SCORM is incomplete. + * @return Image URL and description. */ getScoStatusIcon(sco: any, incomplete?: boolean): {url: string, description: string} { let imageName = '', @@ -1088,8 +1084,8 @@ export class AddonModScormProvider { /** * Get cache key for SCORM data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getScormDataCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'scorm:' + courseId; @@ -1098,13 +1094,13 @@ export class AddonModScormProvider { /** * Get a SCORM with key=value. If more than one is found, only the first will be returned. * - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {string} [moduleUrl] Module URL. - * @param {boolean} [forceCache] Whether it should always return cached data. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the SCORM is retrieved. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param moduleUrl Module URL. + * @param forceCache Whether it should always return cached data. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the SCORM is retrieved. */ protected getScormByField(courseId: number, key: string, value: any, moduleUrl?: string, forceCache?: boolean, siteId?: string) : Promise { @@ -1154,12 +1150,12 @@ export class AddonModScormProvider { /** * Get a SCORM by module ID. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {string} [moduleUrl] Module URL. - * @param {boolean} [forceCache] Whether it should always return cached data. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the SCORM is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param moduleUrl Module URL. + * @param forceCache Whether it should always return cached data. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the SCORM is retrieved. */ getScorm(courseId: number, cmId: number, moduleUrl?: string, forceCache?: boolean, siteId?: string): Promise { return this.getScormByField(courseId, 'coursemodule', cmId, moduleUrl, forceCache, siteId); @@ -1168,12 +1164,12 @@ export class AddonModScormProvider { /** * Get a SCORM by SCORM ID. * - * @param {number} courseId Course ID. - * @param {number} id SCORM ID. - * @param {string} [moduleUrl] Module URL. - * @param {boolean} [forceCache] Whether it should always return cached data. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the SCORM is retrieved. + * @param courseId Course ID. + * @param id SCORM ID. + * @param moduleUrl Module URL. + * @param forceCache Whether it should always return cached data. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the SCORM is retrieved. */ getScormById(courseId: number, id: number, moduleUrl?: string, forceCache?: boolean, siteId?: string): Promise { return this.getScormByField(courseId, 'id', id, moduleUrl, forceCache, siteId); @@ -1182,8 +1178,8 @@ export class AddonModScormProvider { /** * Get a readable SCORM grade method. * - * @param {any} scorm SCORM. - * @return {string} Grading method. + * @param scorm SCORM. + * @return Grading method. */ getScormGradeMethod(scorm: any): string { if (scorm.maxattempt == 1) { @@ -1224,9 +1220,9 @@ export class AddonModScormProvider { /** * Invalidates access information. * - * @param {number} forumId SCORM ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param forumId SCORM ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAccessInformation(scormId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1237,10 +1233,10 @@ export class AddonModScormProvider { /** * Invalidates all the data related to a certain SCORM. * - * @param {number} scormId SCORM ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when the data is invalidated. + * @param scormId SCORM ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when the data is invalidated. */ invalidateAllScormData(scormId: number, siteId?: string, userId?: number): Promise { const promises = []; @@ -1256,10 +1252,10 @@ export class AddonModScormProvider { /** * Invalidates attempt count. * - * @param {number} scormId SCORM ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when the data is invalidated. + * @param scormId SCORM ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when the data is invalidated. */ invalidateAttemptCount(scormId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1272,11 +1268,11 @@ export class AddonModScormProvider { /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID of the module. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined use site's current user. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID of the module. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined use site's current user. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number, siteId?: string, userId?: number): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -1295,9 +1291,9 @@ export class AddonModScormProvider { /** * Invalidates SCORM data. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateScormData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1308,9 +1304,9 @@ export class AddonModScormProvider { /** * Invalidates SCORM user data for all attempts. * - * @param {number} scormId SCORM ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param scormId SCORM ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateScormUserData(scormId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1321,9 +1317,9 @@ export class AddonModScormProvider { /** * Invalidates SCORM scos for all organizations. * - * @param {number} scormId SCORM ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param scormId SCORM ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateScos(scormId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1334,12 +1330,12 @@ export class AddonModScormProvider { /** * Check if a SCORM's attempt is incomplete. * - * @param {any} scormId SCORM ID. - * @param {number} attempt Attempt. - * @param {boolean} offline Whether the attempt is offline. - * @param {boolean} ignoreCache Whether it should ignore cached data for online attempts. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with a boolean: true if incomplete, false otherwise. + * @param scormId SCORM ID. + * @param attempt Attempt. + * @param offline Whether the attempt is offline. + * @param ignoreCache Whether it should ignore cached data for online attempts. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with a boolean: true if incomplete, false otherwise. */ isAttemptIncomplete(scormId: number, attempt: number, offline?: boolean, ignoreCache?: boolean, siteId?: string) : Promise { @@ -1365,8 +1361,8 @@ export class AddonModScormProvider { * Given a launch URL, check if it's a external link. * Based on Moodle's scorm_external_link. * - * @param {string} link Link to check. - * @return {boolean} Whether it's an external link. + * @param link Link to check. + * @return Whether it's an external link. */ protected isExternalLink(link: string): boolean { link = link.toLowerCase(); @@ -1383,8 +1379,8 @@ export class AddonModScormProvider { /** * Check if the given SCORM is closed. * - * @param {any} scorm SCORM to check. - * @return {boolean} Whether the SCORM is closed. + * @param scorm SCORM to check. + * @return Whether the SCORM is closed. */ isScormClosed(scorm: any): boolean { const timeNow = this.timeUtils.timestamp(); @@ -1399,8 +1395,8 @@ export class AddonModScormProvider { /** * Check if the given SCORM is downloadable. * - * @param {any} scorm SCORM to check. - * @return {boolean} Whether the SCORM is downloadable. + * @param scorm SCORM to check. + * @return Whether the SCORM is downloadable. */ isScormDownloadable(scorm: any): boolean { return typeof scorm.protectpackagedownloads != 'undefined' && scorm.protectpackagedownloads === false; @@ -1409,8 +1405,8 @@ export class AddonModScormProvider { /** * Check if the given SCORM is open. * - * @param {any} scorm SCORM to check. - * @return {boolean} Whether the SCORM is open. + * @param scorm SCORM to check. + * @return Whether the SCORM is open. */ isScormOpen(scorm: any): boolean { const timeNow = this.timeUtils.timestamp(); @@ -1425,8 +1421,8 @@ export class AddonModScormProvider { /** * Check if a SCORM is unsupported in the app. If it's not, returns the error code to show. * - * @param {any} scorm SCORM to check. - * @return {string} String with error code if unsupported, undefined if supported. + * @param scorm SCORM to check. + * @return String with error code if unsupported, undefined if supported. */ isScormUnsupported(scorm: any): string { if (!this.isScormValidVersion(scorm)) { @@ -1441,8 +1437,8 @@ export class AddonModScormProvider { /** * Check if it's a valid SCORM 1.2. * - * @param {any} scorm SCORM to check. - * @return {boolean} Whether the SCORM is valid. + * @param scorm SCORM to check. + * @return Whether the SCORM is valid. */ isScormValidVersion(scorm: any): boolean { return scorm.version == 'SCORM_1.2'; @@ -1451,8 +1447,8 @@ export class AddonModScormProvider { /** * Check if a SCO status is incomplete. * - * @param {string} status SCO status. - * @return {boolean} Whether it's incomplete. + * @param status SCO status. + * @return Whether it's incomplete. */ isStatusIncomplete(status: any): boolean { return !status || status == 'notattempted' || status == 'incomplete' || status == 'browsed'; @@ -1461,8 +1457,8 @@ export class AddonModScormProvider { /** * Check if a package URL is valid. * - * @param {string} packageUrl Package URL. - * @return {boolean} Whether it's valid. + * @param packageUrl Package URL. + * @return Whether it's valid. */ isValidPackageUrl(packageUrl: string): boolean { if (!packageUrl) { @@ -1478,11 +1474,11 @@ export class AddonModScormProvider { /** * Report a SCO as being launched. * - * @param {number} scormId SCORM ID. - * @param {number} scoId SCO ID. - * @param {string} [name] Name of the SCORM. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param scormId SCORM ID. + * @param scoId SCO ID. + * @param name Name of the SCORM. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logLaunchSco(scormId: number, scoId: number, name?: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1499,10 +1495,10 @@ export class AddonModScormProvider { /** * Report a SCORM as being viewed. * - * @param {string} id Module ID. - * @param {string} [name] Name of the SCORM. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Module ID. + * @param name Name of the SCORM. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params = { @@ -1516,13 +1512,13 @@ export class AddonModScormProvider { /** * Saves a SCORM tracking record. * - * @param {number} scoId Sco ID. - * @param {number} attempt Attempt number. - * @param {any[]} tracks Tracking data to store. - * @param {any} scorm SCORM. - * @param {boolean} offline Whether the attempt is offline. - * @param {any} [userData] User data for this attempt and SCO. If not defined, it will be retrieved from DB. Recommended. - * @return {Promise} Promise resolved when data is saved. + * @param scoId Sco ID. + * @param attempt Attempt number. + * @param tracks Tracking data to store. + * @param scorm SCORM. + * @param offline Whether the attempt is offline. + * @param userData User data for this attempt and SCO. If not defined, it will be retrieved from DB. Recommended. + * @return Promise resolved when data is saved. */ saveTracks(scoId: number, attempt: number, tracks: any[], scorm: any, offline?: boolean, userData?: any, siteId?: string) : Promise { @@ -1553,12 +1549,12 @@ export class AddonModScormProvider { /** * Saves a SCORM tracking record. * - * @param {number} scormId SCORM ID. - * @param {number} scoId Sco ID. - * @param {number} attempt Attempt number. - * @param {any[]} tracks Tracking data. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when data is saved. + * @param scormId SCORM ID. + * @param scoId Sco ID. + * @param attempt Attempt number. + * @param tracks Tracking data. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when data is saved. */ saveTracksOnline(scormId: number, scoId: number, attempt: number, tracks: any[], siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1590,15 +1586,15 @@ export class AddonModScormProvider { * Saves a SCORM tracking record using a synchronous call. * Please use this function only if synchronous is a must. It's recommended to use saveTracks. * - * @param {number} scoId Sco ID. - * @param {number} attempt Attempt number. - * @param {any[]} tracks Tracking data to store. - * @param {any} scorm SCORM. - * @param {boolean} [offline] Whether the attempt is offline. - * @param {any} [userData] User data for this attempt and SCO. Required if offline=true. - * @return {boolean} In online returns true if data is inserted, false otherwise. - * In offline returns true if data to insert is valid, false otherwise. True doesn't mean that the - * data has been stored, this function can return true but the insertion can still fail somehow. + * @param scoId Sco ID. + * @param attempt Attempt number. + * @param tracks Tracking data to store. + * @param scorm SCORM. + * @param offline Whether the attempt is offline. + * @param userData User data for this attempt and SCO. Required if offline=true. + * @return In online returns true if data is inserted, false otherwise. + * In offline returns true if data to insert is valid, false otherwise. True doesn't mean that the + * data has been stored, this function can return true but the insertion can still fail somehow. */ saveTracksSync(scoId: number, attempt: number, tracks: any[], scorm: any, offline?: boolean, userData?: any): boolean { if (offline) { @@ -1625,10 +1621,10 @@ export class AddonModScormProvider { * Saves a SCORM tracking record using a synchronous call. * Please use this function only if synchronous is a must. It's recommended to use saveTracksOnline. * - * @param {number} scoId Sco ID. - * @param {number} attempt Attempt number. - * @param {any[]} tracks Tracking data. - * @return {boolean} True if success, false otherwise. + * @param scoId Sco ID. + * @param attempt Attempt number. + * @param tracks Tracking data. + * @return True if success, false otherwise. */ saveTracksSyncOnline(scoId: number, attempt: number, tracks: any[]): boolean { const params = { @@ -1671,10 +1667,10 @@ export class AddonModScormProvider { * Check if the SCORM main file should be downloaded. * This function should only be called if the SCORM can be downloaded (not downloaded or outdated). * - * @param {any} scorm SCORM to check. - * @param {boolean} [isOutdated] True if package outdated, false if not downloaded, undefined to calculate it. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if it should be downloaded, false otherwise. + * @param scorm SCORM to check. + * @param isOutdated True if package outdated, false if not downloaded, undefined to calculate it. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if it should be downloaded, false otherwise. */ shouldDownloadMainFile(scorm: any, isOutdated?: boolean, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -1712,11 +1708,11 @@ export class AddonModScormProvider { /** * If needed, updates cached user data after saving tracks in online. * - * @param {number} scormId SCORM ID. - * @param {number} attempt Attempt number. - * @param {any[]} tracks Tracking data saved. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when updated. + * @param scormId SCORM ID. + * @param attempt Attempt number. + * @param tracks Tracking data saved. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when updated. */ protected updateUserDataAfterSave(scormId: number, attempt: number, tracks: any[], siteId?: string): Promise { if (!tracks || !tracks.length) { diff --git a/src/addon/mod/scorm/providers/sync-cron-handler.ts b/src/addon/mod/scorm/providers/sync-cron-handler.ts index 33999d0cb..e0fef8e95 100644 --- a/src/addon/mod/scorm/providers/sync-cron-handler.ts +++ b/src/addon/mod/scorm/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class AddonModScormSyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.scormSync.syncAllScorms(siteId, force); @@ -40,7 +40,7 @@ export class AddonModScormSyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return this.scormSync.syncInterval; diff --git a/src/addon/mod/survey/components/index/index.ts b/src/addon/mod/survey/components/index/index.ts index 8b6cfbb65..23f479553 100644 --- a/src/addon/mod/survey/components/index/index.ts +++ b/src/addon/mod/survey/components/index/index.ts @@ -64,7 +64,7 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -80,8 +80,8 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo /** * Compares sync event data with current data to check if refresh content is needed. * - * @param {any} syncEventData Data receiven on sync observer. - * @return {boolean} True if refresh is needed, false otherwise. + * @param syncEventData Data receiven on sync observer. + * @return True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: any): boolean { if (this.survey && syncEventData.surveyId == this.survey.id && syncEventData.userId == this.userId) { @@ -94,10 +94,10 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo /** * Download survey contents. * - * @param {boolean} [refresh=false] If it's refreshing content. - * @param {boolean} [sync=false] If it should try to sync. - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved when done. + * @param refresh If it's refreshing content. + * @param sync If it should try to sync. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved when done. */ protected fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { return this.surveyProvider.getSurvey(this.courseId, this.module.id).then((survey) => { @@ -135,7 +135,7 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo /** * Convenience function to get survey questions. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchQuestions(): Promise { return this.surveyProvider.getQuestions(this.survey.id).then((questions) => { @@ -161,7 +161,7 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo /** * Check if answers are valid to be submitted. * - * @return {boolean} If answers are valid + * @return If answers are valid */ isValidResponse(): boolean { for (const x in this.answers) { @@ -213,7 +213,7 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo /** * Performs the sync of the activity. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected sync(): Promise { return this.surveySync.syncSurvey(this.survey.id, this.userId); @@ -222,8 +222,8 @@ export class AddonModSurveyIndexComponent extends CoreCourseModuleMainActivityCo /** * Checks if sync has succeed from result sync data. * - * @param {any} result Data returned on the sync function. - * @return {boolean} If suceed or not. + * @param result Data returned on the sync function. + * @return If suceed or not. */ protected hasSyncSucceed(result: any): boolean { return result.answersSent; diff --git a/src/addon/mod/survey/pages/index/index.ts b/src/addon/mod/survey/pages/index/index.ts index 3c18ae76f..ce2546b82 100644 --- a/src/addon/mod/survey/pages/index/index.ts +++ b/src/addon/mod/survey/pages/index/index.ts @@ -40,7 +40,7 @@ export class AddonModSurveyIndexPage { /** * Update some data based on the survey instance. * - * @param {any} survey Survey instance. + * @param survey Survey instance. */ updateData(survey: any): void { this.title = survey.name || this.title; diff --git a/src/addon/mod/survey/providers/helper.ts b/src/addon/mod/survey/providers/helper.ts index cc3d48e31..23d7dc9b4 100644 --- a/src/addon/mod/survey/providers/helper.ts +++ b/src/addon/mod/survey/providers/helper.ts @@ -26,8 +26,8 @@ export class AddonModSurveyHelperProvider { /** * Turns a string with values separated by commas into an array. * - * @param {any} value Value to convert. - * @return {string[]} Array. + * @param value Value to convert. + * @return Array. */ protected commaStringToArray(value: any): string[] { if (typeof value == 'string') { @@ -44,8 +44,8 @@ export class AddonModSurveyHelperProvider { /** * Gets the parent questions and puts them in an object: ID -> question. * - * @param {Object[]} questions Questions. - * @return {any} Object with parent questions. + * @param questions Questions. + * @return Object with parent questions. */ protected getParentQuestions(questions: any[]): any { const parents = {}; @@ -63,8 +63,8 @@ export class AddonModSurveyHelperProvider { * Format a questions list, turning "multi" and "options" strings into arrays and adding the properties * 'num' and 'name'. * - * @param {any[]} questions Questions. - * @return {any[]} Promise resolved with the formatted questions. + * @param questions Questions. + * @return Promise resolved with the formatted questions. */ formatQuestions(questions: any[]): any[] { diff --git a/src/addon/mod/survey/providers/module-handler.ts b/src/addon/mod/survey/providers/module-handler.ts index ed3368ccb..14db300e5 100644 --- a/src/addon/mod/survey/providers/module-handler.ts +++ b/src/addon/mod/survey/providers/module-handler.ts @@ -44,7 +44,7 @@ export class AddonModSurveyModuleHandler implements CoreCourseModuleHandler { /** * 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 { return true; @@ -53,10 +53,10 @@ export class AddonModSurveyModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { return { @@ -78,9 +78,9 @@ export class AddonModSurveyModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModSurveyIndexComponent; diff --git a/src/addon/mod/survey/providers/offline.ts b/src/addon/mod/survey/providers/offline.ts index 5e3185315..b9709ca0b 100644 --- a/src/addon/mod/survey/providers/offline.ts +++ b/src/addon/mod/survey/providers/offline.ts @@ -72,10 +72,10 @@ export class AddonModSurveyOfflineProvider { /** * Delete a survey answers. * - * @param {number} surveyId Survey ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the answers belong to. If not defined, current user in site. - * @return {Promise} Promise resolved if deleted, rejected if failure. + * @param surveyId Survey ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User the answers belong to. If not defined, current user in site. + * @return Promise resolved if deleted, rejected if failure. */ deleteSurveyAnswers(surveyId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -88,8 +88,8 @@ export class AddonModSurveyOfflineProvider { /** * Get all the stored data from all the surveys. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with answers. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with answers. */ getAllData(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -106,10 +106,10 @@ export class AddonModSurveyOfflineProvider { /** * Get a survey stored answers. * - * @param {number} surveyId Survey ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the answers belong to. If not defined, current user in site. - * @return {Promise} Promise resolved with the answers. + * @param surveyId Survey ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User the answers belong to. If not defined, current user in site. + * @return Promise resolved with the answers. */ getSurveyAnswers(surveyId: number, siteId?: string, userId?: number): Promise { return this.getSurveyData(surveyId, siteId, userId).then((entry) => { @@ -122,10 +122,10 @@ export class AddonModSurveyOfflineProvider { /** * Get a survey stored data. * - * @param {number} surveyId Survey ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the answers belong to. If not defined, current user in site. - * @return {Promise} Promise resolved with the data. + * @param surveyId Survey ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User the answers belong to. If not defined, current user in site. + * @return Promise resolved with the data. */ getSurveyData(surveyId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -142,10 +142,10 @@ export class AddonModSurveyOfflineProvider { /** * Check if there are offline answers to send. * - * @param {number} surveyId Survey ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the answers belong to. If not defined, current user in site. - * @return {Promise} Promise resolved with boolean: true if has offline answers, false otherwise. + * @param surveyId Survey ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User the answers belong to. If not defined, current user in site. + * @return Promise resolved with boolean: true if has offline answers, false otherwise. */ hasAnswers(surveyId: number, siteId?: string, userId?: number): Promise { return this.getSurveyAnswers(surveyId, siteId, userId).then((answers) => { @@ -156,13 +156,13 @@ export class AddonModSurveyOfflineProvider { /** * Save answers to be sent later. * - * @param {number} surveyId Survey ID. - * @param {string} name Survey name. - * @param {number} courseId Course ID the survey belongs to. - * @param {any[]} answers Answers. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User the answers belong to. If not defined, current user in site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param surveyId Survey ID. + * @param name Survey name. + * @param courseId Course ID the survey belongs to. + * @param answers Answers. + * @param siteId Site ID. If not defined, current site. + * @param userId User the answers belong to. If not defined, current user in site. + * @return Promise resolved if stored, rejected if failure. */ saveAnswers(surveyId: number, name: string, courseId: number, answers: any[], siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/mod/survey/providers/prefetch-handler.ts b/src/addon/mod/survey/providers/prefetch-handler.ts index 83945c844..b56636f8f 100644 --- a/src/addon/mod/survey/providers/prefetch-handler.ts +++ b/src/addon/mod/survey/providers/prefetch-handler.ts @@ -48,9 +48,9 @@ export class AddonModSurveyPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Returns survey intro files. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved with list of intro files. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @return Promise resolved with list of intro files. */ getIntroFiles(module: any, courseId: number): Promise { return this.surveyProvider.getSurvey(courseId, module.id).catch(() => { @@ -63,9 +63,9 @@ export class AddonModSurveyPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.surveyProvider.invalidateContent(moduleId, courseId); @@ -74,9 +74,9 @@ export class AddonModSurveyPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Invalidate WS calls needed to determine module status. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule(module: any, courseId: number): Promise { return this.surveyProvider.invalidateSurveyData(courseId); @@ -85,7 +85,7 @@ export class AddonModSurveyPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ isEnabled(): boolean | Promise { return true; @@ -94,11 +94,11 @@ export class AddonModSurveyPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string): Promise { return this.prefetchPackage(module, courseId, single, this.prefetchSurvey.bind(this)); @@ -107,11 +107,11 @@ export class AddonModSurveyPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Prefetch a survey. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} single True if we're downloading a single module, false if we're downloading a whole section. - * @param {String} siteId Site ID. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. + * @return Promise resolved when done. */ protected prefetchSurvey(module: any, courseId: number, single: boolean, siteId: string): Promise { return this.surveyProvider.getSurvey(courseId, module.id, true, siteId).then((survey) => { @@ -133,10 +133,10 @@ export class AddonModSurveyPrefetchHandler extends CoreCourseActivityPrefetchHan /** * Sync a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ sync(module: any, courseId: number, siteId?: any): Promise { if (!this.syncProvider) { diff --git a/src/addon/mod/survey/providers/survey.ts b/src/addon/mod/survey/providers/survey.ts index 824b7bd33..078fae02c 100644 --- a/src/addon/mod/survey/providers/survey.ts +++ b/src/addon/mod/survey/providers/survey.ts @@ -41,10 +41,10 @@ export class AddonModSurveyProvider { /** * Get a survey's questions. * - * @param {number} surveyId Survey ID. - * @param {boolean} [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. - * @return {Promise} Promise resolved when the questions are retrieved. + * @param surveyId Survey ID. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the questions are retrieved. */ getQuestions(surveyId: number, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -74,8 +74,8 @@ export class AddonModSurveyProvider { /** * Get cache key for survey questions WS calls. * - * @param {number} surveyId Survey ID. - * @return {string} Cache key. + * @param surveyId Survey ID. + * @return Cache key. */ protected getQuestionsCacheKey(surveyId: number): string { return this.ROOT_CACHE_KEY + 'questions:' + surveyId; @@ -84,8 +84,8 @@ export class AddonModSurveyProvider { /** * Get cache key for survey data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getSurveyCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'survey:' + courseId; @@ -94,12 +94,12 @@ export class AddonModSurveyProvider { /** * Get a survey data. * - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {boolean} [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. - * @return {Promise} Promise resolved when the survey is retrieved. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the survey is retrieved. */ protected getSurveyDataByKey(courseId: number, key: string, value: any, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -134,11 +134,11 @@ export class AddonModSurveyProvider { /** * Get a survey by course module ID. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {boolean} [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. - * @return {Promise} Promise resolved when the survey is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the survey is retrieved. */ getSurvey(courseId: number, cmId: number, ignoreCache?: boolean, siteId?: string): Promise { return this.getSurveyDataByKey(courseId, 'coursemodule', cmId, ignoreCache, siteId); @@ -147,11 +147,11 @@ export class AddonModSurveyProvider { /** * Get a survey by ID. * - * @param {number} courseId Course ID. - * @param {number} id Survey ID. - * @param {boolean} [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. - * @return {Promise} Promise resolved when the survey is retrieved. + * @param courseId Course ID. + * @param id Survey ID. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the survey is retrieved. */ getSurveyById(courseId: number, id: number, ignoreCache?: boolean, siteId?: string): Promise { return this.getSurveyDataByKey(courseId, 'id', id, ignoreCache, siteId); @@ -160,10 +160,10 @@ export class AddonModSurveyProvider { /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID of the module. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID of the module. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -188,9 +188,9 @@ export class AddonModSurveyProvider { /** * Invalidates survey questions. * - * @param {number} surveyId Survey ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param surveyId Survey ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateQuestions(surveyId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -201,9 +201,9 @@ export class AddonModSurveyProvider { /** * Invalidates survey data. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateSurveyData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -214,10 +214,10 @@ export class AddonModSurveyProvider { /** * Report the survey as being viewed. * - * @param {number} id Module ID. - * @param {string} [name] Name of the assign. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Module ID. + * @param name Name of the assign. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params = { @@ -231,13 +231,13 @@ export class AddonModSurveyProvider { /** * Send survey answers. If cannot send them to Moodle, they'll be stored in offline to be sent later. * - * @param {number} surveyId Survey ID. - * @param {string} name Survey name. - * @param {number} courseId Course ID the survey belongs to. - * @param {any[]} answers Answers. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean if success: true if answers were sent to server, - * false if stored in device. + * @param surveyId Survey ID. + * @param name Survey name. + * @param courseId Course ID the survey belongs to. + * @param answers Answers. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean if success: true if answers were sent to server, + * false if stored in device. */ submitAnswers(surveyId: number, name: string, courseId: number, answers: any[], siteId?: string): Promise { // Convenience function to store a survey to be synchronized later. @@ -274,11 +274,11 @@ export class AddonModSurveyProvider { /** * Send survey answers to Moodle. * - * @param {number} surveyId Survey ID. - * @param {any[]} answers Answers. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when answers are successfully submitted. Rejected with object containing - * the error message (if any) and a boolean indicating if the error was returned by WS. + * @param surveyId Survey ID. + * @param answers Answers. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when answers are successfully submitted. Rejected with object containing + * the error message (if any) and a boolean indicating if the error was returned by WS. */ submitAnswersOnline(surveyId: number, answers: any[], siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/mod/survey/providers/sync-cron-handler.ts b/src/addon/mod/survey/providers/sync-cron-handler.ts index f3e2e9552..e3b731569 100644 --- a/src/addon/mod/survey/providers/sync-cron-handler.ts +++ b/src/addon/mod/survey/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class AddonModSurveySyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.surveySync.syncAllSurveys(siteId, force); @@ -40,7 +40,7 @@ export class AddonModSurveySyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return this.surveySync.syncInterval; diff --git a/src/addon/mod/survey/providers/sync.ts b/src/addon/mod/survey/providers/sync.ts index 0a57a0258..4ffc79cd0 100644 --- a/src/addon/mod/survey/providers/sync.ts +++ b/src/addon/mod/survey/providers/sync.ts @@ -55,9 +55,9 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid /** * Get the ID of a survey sync. * - * @param {number} surveyId Survey ID. - * @param {number} userId User the answers belong to. - * @return {string} Sync ID. + * @param surveyId Survey ID. + * @param userId User the answers belong to. + * @return Sync ID. * @protected */ getSyncId(surveyId: number, userId: number): string { @@ -67,9 +67,9 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid /** * Try to synchronize all the surveys in a certain site or in all sites. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncAllSurveys(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all surveys', this.syncAllSurveysFunc.bind(this), [force], siteId); @@ -78,9 +78,9 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid /** * Sync all pending surveys on a site. * - * @param {string} siteId Site ID to sync. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @param {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. + * @param force Wether to force sync not depending on last execution. + * @param Promise resolved if sync is successful, rejected if sync fails. */ protected syncAllSurveysFunc(siteId: string, force?: boolean): Promise { // Get all survey answers pending to be sent in the site. @@ -109,10 +109,10 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid /** * Sync a survey only if a certain time has passed since the last time. * - * @param {number} surveyId Survey ID. - * @param {number} userId User the answers belong to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the survey is synced or if it doesn't need to be synced. + * @param surveyId Survey ID. + * @param userId User the answers belong to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the survey is synced or if it doesn't need to be synced. */ syncSurveyIfNeeded(surveyId: number, userId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -129,10 +129,10 @@ export class AddonModSurveySyncProvider extends CoreCourseActivitySyncBaseProvid /** * Synchronize a survey. * - * @param {number} surveyId Survey ID. - * @param {number} [userId] User the answers belong to. If not defined, current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param surveyId Survey ID. + * @param userId User the answers belong to. If not defined, current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncSurvey(surveyId: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/mod/url/components/index/index.ts b/src/addon/mod/url/components/index/index.ts index 842d14194..e7bcd6206 100644 --- a/src/addon/mod/url/components/index/index.ts +++ b/src/addon/mod/url/components/index/index.ts @@ -68,7 +68,7 @@ export class AddonModUrlIndexComponent extends CoreCourseModuleMainResourceCompo /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { return this.urlProvider.invalidateContent(this.module.id, this.courseId); @@ -77,8 +77,8 @@ export class AddonModUrlIndexComponent extends CoreCourseModuleMainResourceCompo /** * Download url contents. * - * @param {boolean} [refresh] Whether we're refreshing data. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @return Promise resolved when done. */ protected fetchContent(refresh?: boolean): Promise { let canGetUrl = this.canGetUrl, @@ -138,8 +138,8 @@ export class AddonModUrlIndexComponent extends CoreCourseModuleMainResourceCompo /** * Calculate the display options to determine how the URL should be rendered. * - * @param {any} url Object with the URL data. - * @return {Promise} Promise resolved when done. + * @param url Object with the URL data. + * @return Promise resolved when done. */ protected calculateDisplayOptions(url: any): Promise { const displayType = this.urlProvider.getFinalDisplayType(url); @@ -175,7 +175,7 @@ export class AddonModUrlIndexComponent extends CoreCourseModuleMainResourceCompo /** * Log view into the site and checks module completion. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected logView(): Promise { return this.urlProvider.logView(this.module.instance, this.module.name).then(() => { diff --git a/src/addon/mod/url/pages/index/index.ts b/src/addon/mod/url/pages/index/index.ts index 1e0ec28c6..1b5fde2db 100644 --- a/src/addon/mod/url/pages/index/index.ts +++ b/src/addon/mod/url/pages/index/index.ts @@ -40,7 +40,7 @@ export class AddonModUrlIndexPage { /** * Update some data based on the url instance. * - * @param {any} url Url instance. + * @param url Url instance. */ updateData(url: any): void { this.title = url.name || this.title; diff --git a/src/addon/mod/url/providers/helper.ts b/src/addon/mod/url/providers/helper.ts index 4620fce98..25a9f99e5 100644 --- a/src/addon/mod/url/providers/helper.ts +++ b/src/addon/mod/url/providers/helper.ts @@ -29,7 +29,7 @@ export class AddonModUrlHelperProvider { /** * Opens a URL. * - * @param {string} url The URL to go to. + * @param url The URL to go to. */ open(url: string): void { const modal = this.domUtils.showModalLoading(); diff --git a/src/addon/mod/url/providers/module-handler.ts b/src/addon/mod/url/providers/module-handler.ts index fb51ea3bc..05f475d59 100644 --- a/src/addon/mod/url/providers/module-handler.ts +++ b/src/addon/mod/url/providers/module-handler.ts @@ -50,7 +50,7 @@ export class AddonModUrlModuleHandler implements CoreCourseModuleHandler { /** * 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 { return true; @@ -59,10 +59,10 @@ export class AddonModUrlModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { // tslint:disable: no-this-assignment @@ -140,9 +140,9 @@ export class AddonModUrlModuleHandler implements CoreCourseModuleHandler { /** * Returns if contents are loaded to show link button. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @return {Promise} Resolved when done. + * @param module The module object. + * @param courseId The course ID. + * @return Resolved when done. */ protected hideLinkButton(module: any, courseId: number): Promise { return this.courseProvider.loadModuleContents(module, courseId, undefined, false, false, undefined, this.modName) @@ -158,9 +158,9 @@ export class AddonModUrlModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModUrlIndexComponent; @@ -169,8 +169,8 @@ export class AddonModUrlModuleHandler implements CoreCourseModuleHandler { /** * Open the URL. * - * @param {any} module The module object. - * @param {number} courseId The course ID. + * @param module The module object. + * @param courseId The course ID. */ protected openUrl(module: any, courseId: number): void { this.urlProvider.logView(module.instance, module.name).then(() => { diff --git a/src/addon/mod/url/providers/url.ts b/src/addon/mod/url/providers/url.ts index 13261f104..28ffe8da8 100644 --- a/src/addon/mod/url/providers/url.ts +++ b/src/addon/mod/url/providers/url.ts @@ -41,8 +41,8 @@ export class AddonModUrlProvider { /** * Get the final display type for a certain URL. Based on Moodle's url_get_final_display_type. * - * @param {any} url URL data. - * @return {number} Final display type. + * @param url URL data. + * @return Final display type. */ getFinalDisplayType(url: any): number { if (!url) { @@ -93,8 +93,8 @@ export class AddonModUrlProvider { /** * Get cache key for url data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getUrlCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'url:' + courseId; @@ -103,11 +103,11 @@ export class AddonModUrlProvider { /** * Get a url data. * - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the url is retrieved. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the url is retrieved. */ protected getUrlDataByKey(courseId: number, key: string, value: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -137,10 +137,10 @@ export class AddonModUrlProvider { /** * Get a url by course module ID. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the url is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the url is retrieved. */ getUrl(courseId: number, cmId: number, siteId?: string): Promise { return this.getUrlDataByKey(courseId, 'coursemodule', cmId, siteId); @@ -149,8 +149,8 @@ export class AddonModUrlProvider { /** * Guess the icon for a certain URL. Based on Moodle's url_guess_icon. * - * @param {string} url URL to check. - * @return {string} Icon, empty if it should use the default icon. + * @param url URL to check. + * @return Icon, empty if it should use the default icon. */ guessIcon(url: string): string { url = url || ''; @@ -176,10 +176,10 @@ export class AddonModUrlProvider { /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID of the module. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID of the module. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -195,9 +195,9 @@ export class AddonModUrlProvider { /** * Invalidates url data. * - * @param {number} courseid Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseid Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateUrlData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -208,7 +208,7 @@ export class AddonModUrlProvider { /** * Returns whether or not getUrl WS available or not. * - * @return {boolean} If WS is abalaible. + * @return If WS is abalaible. * @since 3.3 */ isGetUrlWSAvailable(): boolean { @@ -218,10 +218,10 @@ export class AddonModUrlProvider { /** * Report the url as being viewed. * - * @param {number} id Module ID. - * @param {string} [name] Name of the assign. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Module ID. + * @param name Name of the assign. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params = { diff --git a/src/addon/mod/wiki/components/index/index.ts b/src/addon/mod/wiki/components/index/index.ts index cb91ef072..7296709d2 100644 --- a/src/addon/mod/wiki/components/index/index.ts +++ b/src/addon/mod/wiki/components/index/index.ts @@ -144,7 +144,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Check if the current page was created or discarded. * - * @param {any} data Data about created and deleted pages. + * @param data Data about created and deleted pages. */ protected checkPageCreatedOrDiscarded(data: any): void { if (!this.currentPage && data) { @@ -182,7 +182,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Construct the map of pages. * - * @param {any[]} subwikiPages List of pages. + * @param subwikiPages List of pages. */ constructMap(subwikiPages: any[]): void { let letter, @@ -216,10 +216,10 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Get the wiki data. * - * @param {boolean} [refresh=false] If it's refreshing content. - * @param {boolean} [sync=false] If it should try to sync. - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved when done. + * @param refresh If it's refreshing content. + * @param sync If it should try to sync. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved when done. */ protected fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { @@ -315,8 +315,8 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Get wiki page contents. * - * @param {number} pageId Page to get. - * @return {Promise} Promise resolved with the page data. + * @param pageId Page to get. + * @return Promise resolved with the page data. */ protected fetchPageContents(pageId: number): Promise { if (!pageId) { @@ -361,7 +361,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Fetch the list of pages of a subwiki. * - * @param {any} subwiki Subwiki. + * @param subwiki Subwiki. */ protected fetchSubwikiPages(subwiki: any): Promise { let subwikiPages; @@ -409,7 +409,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Get the subwikis. * - * @param {number} wikiId Wiki ID. + * @param wikiId Wiki ID. */ protected fetchSubwikis(wikiId: number): Promise { return this.wikiProvider.getSubwikis(wikiId).then((subwikis) => { @@ -424,7 +424,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Fetch the page to be shown. * - * @return {Promise} [description] + * @return [description] */ protected fetchWikiPage(): Promise { // Search the current Subwiki. @@ -458,7 +458,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Get the wiki home view. If cannot determine or it's current view, return undefined. * - * @return {ViewController} The view controller of the home view + * @return The view controller of the home view */ protected getWikiHomeView(): ViewController { @@ -580,7 +580,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Go to view a certain page. * - * @param {any} page Page to view. + * @param page Page to view. */ goToPage(page: any): void { if (!page.id) { @@ -621,10 +621,10 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Go to the page to view a certain subwiki. * - * @param {number} subwikiId Subwiki ID. - * @param {number} userId User ID of the subwiki. - * @param {number} groupId Group ID of the subwiki. - * @param {boolean} canEdit Whether the subwiki can be edited. + * @param subwikiId Subwiki ID. + * @param userId User ID of the subwiki. + * @param groupId Group ID of the subwiki. + * @param canEdit Whether the subwiki can be edited. */ goToSubwiki(subwikiId: number, userId: number, groupId: number, canEdit: boolean): void { // Check if the subwiki is disabled. @@ -648,7 +648,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Checks if there is any subwiki selected. * - * @return {boolean} Whether there is any subwiki selected. + * @return Whether there is any subwiki selected. */ protected isAnySubwikiSelected(): boolean { return this.subwikiData.subwikiSelected > 0 || this.subwikiData.userSelected > 0 || this.subwikiData.groupSelected > 0; @@ -657,8 +657,8 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Checks if the given subwiki is the one picked on the subwiki picker. * - * @param {any} subwiki Subwiki to check. - * @return {boolean} Whether it's the selected subwiki. + * @param subwiki Subwiki to check. + * @return Whether it's the selected subwiki. */ protected isSubwikiSelected(subwiki: any): boolean { const subwikiId = parseInt(subwiki.id, 10) || 0; @@ -676,8 +676,8 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Replace edit links to have full url. * - * @param {string} content Content to treat. - * @return {string} Treated content. + * @param content Content to treat. + * @return Treated content. */ protected replaceEditLinks(content: string): string { content = content.trim(); @@ -693,9 +693,9 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Sets the selected subwiki for the subwiki picker. * - * @param {number} subwikiId Subwiki ID to select. - * @param {number} userId User ID of the subwiki to select. - * @param {number} groupId Group ID of the subwiki to select. + * @param subwikiId Subwiki ID to select. + * @param userId User ID of the subwiki to select. + * @param groupId Group ID of the subwiki to select. */ protected setSelectedWiki(subwikiId: number, userId: number, groupId: number): void { this.subwikiData.subwikiSelected = this.wikiOffline.convertToPositiveNumber(subwikiId); @@ -706,8 +706,8 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Checks if sync has succeed from result sync data. * - * @param {any} result Data returned on the sync function. - * @return {boolean} If suceed or not. + * @param result Data returned on the sync function. + * @return If suceed or not. */ protected hasSyncSucceed(result: any): boolean { result.wikiId = this.wiki.id; @@ -755,7 +755,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -783,8 +783,8 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Compares sync event data with current data to check if refresh content is needed. * - * @param {any} syncEventData Data receiven on sync observer. - * @return {boolean} True if refresh is needed, false otherwise. + * @param syncEventData Data receiven on sync observer. + * @return True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: any): boolean { if (this.currentSubwiki && syncEventData.subwikiId == this.currentSubwiki.id && @@ -806,7 +806,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Show the TOC. * - * @param {MouseEvent} event Event. + * @param event Event. */ showSubwikiPicker(event: MouseEvent): void { const popover = this.popoverCtrl.create(AddonModWikiSubwikiPickerComponent, { @@ -828,7 +828,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Performs the sync of the activity. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected sync(): Promise { return this.wikiSync.syncWiki(this.wiki.id, this.courseId, this.wiki.coursemodule); @@ -847,8 +847,8 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Create the subwiki list for the selector and store it in the cache. * - * @param {any[]} userGroups Groups. - * @return {Promise} Promise resolved when done. + * @param userGroups Groups. + * @return Promise resolved when done. */ protected createSubwikiList(userGroups: any[]): Promise { const subwikiList = [], @@ -938,9 +938,9 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp /** * Fill the subwiki data. * - * @param {any[]} subwikiList List of subwikis. - * @param {boolean} showMyGroupsLabel Whether subwikis should be grouped in "My groups" and "Other groups". - * @param {boolean} multiLevelList Whether it's a multi level list. + * @param subwikiList List of subwikis. + * @param showMyGroupsLabel Whether subwikis should be grouped in "My groups" and "Other groups". + * @param multiLevelList Whether it's a multi level list. */ protected fillSubwikiData(subwikiList: any[], showMyGroupsLabel: boolean, multiLevelList: boolean): void { let groupValue = -1, diff --git a/src/addon/mod/wiki/components/subwiki-picker/subwiki-picker.ts b/src/addon/mod/wiki/components/subwiki-picker/subwiki-picker.ts index 56a149bd6..858125544 100644 --- a/src/addon/mod/wiki/components/subwiki-picker/subwiki-picker.ts +++ b/src/addon/mod/wiki/components/subwiki-picker/subwiki-picker.ts @@ -34,8 +34,8 @@ export class AddonModWikiSubwikiPickerComponent { /** * Checks if the given subwiki is the one currently selected. * - * @param {any} subwiki Subwiki to check. - * @return {boolean} Whether it's the selected subwiki. + * @param subwiki Subwiki to check. + * @return Whether it's the selected subwiki. */ protected isSubwikiSelected(subwiki: any): boolean { const subwikiId = parseInt(subwiki.id, 10) || 0; @@ -53,7 +53,7 @@ export class AddonModWikiSubwikiPickerComponent { /** * Function called when a subwiki is clicked. * - * @param {any} subwiki The subwiki to open. + * @param subwiki The subwiki to open. */ openSubwiki(subwiki: any): void { // Check if the subwiki is disabled. diff --git a/src/addon/mod/wiki/pages/edit/edit.ts b/src/addon/mod/wiki/pages/edit/edit.ts index 3d56004ff..9bcc6817b 100644 --- a/src/addon/mod/wiki/pages/edit/edit.ts +++ b/src/addon/mod/wiki/pages/edit/edit.ts @@ -125,7 +125,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy { /** * Convenience function to get wiki page data. * - * @return {Promise} Promise resolved with boolean: whether it was successful. + * @return Promise resolved with boolean: whether it was successful. */ protected fetchWikiPageData(): Promise { let promise, @@ -247,7 +247,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy { /** * Navigate to a new offline page. * - * @param {string} title Page title. + * @param title Page title. */ protected goToNewOfflinePage(title: string): void { if (this.courseId && (this.module.id || this.wikiId)) { @@ -274,8 +274,8 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy { /** * Check if we need to navigate to a new state. * - * @param {string} title Page title. - * @return {Promise} Promise resolved when done. + * @param title Page title. + * @return Promise resolved when done. */ protected gotoPage(title: string): Promise { return this.retrieveModuleInfo(this.wikiId).then(() => { @@ -316,7 +316,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy { /** * Check if data has changed. * - * @return {boolean} Whether data has changed. + * @return Whether data has changed. */ protected hasDataChanged(): boolean { const values = this.pageForm.value; @@ -327,7 +327,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy { /** * Check if we can leave the page or not. * - * @return {boolean|Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { if (this.forceLeave) { @@ -355,7 +355,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy { /** * In case we are NOT editing an offline page, check if the page loaded in previous view is different than this view. * - * @return {boolean} Whether previous view wiki page is different than current page. + * @return Whether previous view wiki page is different than current page. */ protected previousViewIsDifferentPageOnline(): boolean { // We cannot precisely detect when the state is the same but this is close to it. @@ -368,8 +368,8 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy { /** * In case we're editing an offline page, check if the page loaded in previous view is different than this view. * - * @param {string} title The current page title. - * @return {boolean} Whether previous view wiki page is different than current page. + * @param title The current page title. + * @return Whether previous view wiki page is different than current page. */ protected previousViewPageIsDifferentOffline(title: string): boolean { // We cannot precisely detect when the state is the same but this is close to it. @@ -501,8 +501,8 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy { /** * Fetch module information to redirect when needed. * - * @param {number} wikiId Wiki ID. - * @return {Promise} Promise resolved when done. + * @param wikiId Wiki ID. + * @return Promise resolved when done. */ protected retrieveModuleInfo(wikiId: number): Promise { if (this.module.id && this.courseId) { diff --git a/src/addon/mod/wiki/pages/index/index.ts b/src/addon/mod/wiki/pages/index/index.ts index 8acca3028..b3cef20a7 100644 --- a/src/addon/mod/wiki/pages/index/index.ts +++ b/src/addon/mod/wiki/pages/index/index.ts @@ -55,7 +55,7 @@ export class AddonModWikiIndexPage { /** * Update some data based on the data received. * - * @param {any} data The data received. + * @param data The data received. */ updateData(data: any): void { if (typeof data == 'string') { diff --git a/src/addon/mod/wiki/providers/create-link-handler.ts b/src/addon/mod/wiki/providers/create-link-handler.ts index 7eb5287ab..048d41822 100644 --- a/src/addon/mod/wiki/providers/create-link-handler.ts +++ b/src/addon/mod/wiki/providers/create-link-handler.ts @@ -40,10 +40,10 @@ export class AddonModWikiCreateLinkHandler extends CoreContentLinksHandlerBase { /** * Check if the current view is a wiki page of the same wiki. * - * @param {ViewController} activeView Active view. - * @param {number} subwikiId Subwiki ID to check. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved with boolean: whether current view belongs to the same wiki. + * @param activeView Active view. + * @param subwikiId Subwiki ID to check. + * @param siteId Site ID. + * @return Promise resolved with boolean: whether current view belongs to the same wiki. */ protected currentStateIsSameWiki(activeView: ViewController, subwikiId: number, siteId: string): Promise { @@ -86,11 +86,11 @@ export class AddonModWikiCreateLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { diff --git a/src/addon/mod/wiki/providers/edit-link-handler.ts b/src/addon/mod/wiki/providers/edit-link-handler.ts index 512c8c65f..4373bc024 100644 --- a/src/addon/mod/wiki/providers/edit-link-handler.ts +++ b/src/addon/mod/wiki/providers/edit-link-handler.ts @@ -34,11 +34,11 @@ export class AddonModWikiEditLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { diff --git a/src/addon/mod/wiki/providers/module-handler.ts b/src/addon/mod/wiki/providers/module-handler.ts index 20a94af39..1963d5def 100644 --- a/src/addon/mod/wiki/providers/module-handler.ts +++ b/src/addon/mod/wiki/providers/module-handler.ts @@ -45,7 +45,7 @@ export class AddonModWikiModuleHandler implements CoreCourseModuleHandler { /** * 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 { return true; @@ -54,10 +54,10 @@ export class AddonModWikiModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { return { @@ -79,9 +79,9 @@ export class AddonModWikiModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModWikiIndexComponent; diff --git a/src/addon/mod/wiki/providers/page-or-map-link-handler.ts b/src/addon/mod/wiki/providers/page-or-map-link-handler.ts index 8a5bf9e23..bcbe26978 100644 --- a/src/addon/mod/wiki/providers/page-or-map-link-handler.ts +++ b/src/addon/mod/wiki/providers/page-or-map-link-handler.ts @@ -37,11 +37,11 @@ export class AddonModWikiPageOrMapLinkHandler extends CoreContentLinksHandlerBas /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -89,11 +89,11 @@ export class AddonModWikiPageOrMapLinkHandler extends CoreContentLinksHandlerBas * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { const isMap = url.indexOf('mod/wiki/map.php') != -1; diff --git a/src/addon/mod/wiki/providers/prefetch-handler.ts b/src/addon/mod/wiki/providers/prefetch-handler.ts index 5acebea4c..0097af2f6 100644 --- a/src/addon/mod/wiki/providers/prefetch-handler.ts +++ b/src/addon/mod/wiki/providers/prefetch-handler.ts @@ -52,12 +52,12 @@ export class AddonModWikiPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Returns a list of pages that can be downloaded. * - * @param {any} module The module object returned by WS. - * @param {number} courseId The course ID. - * @param {boolean} [offline] Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} List of pages. + * @param module The module object returned by WS. + * @param courseId The course ID. + * @param offline Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return List of pages. */ protected getAllPages(module: any, courseId: number, offline?: boolean, ignoreCache?: boolean, siteId?: string) : Promise { @@ -75,11 +75,11 @@ export class AddonModWikiPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Get the download size of a module. * - * @param {any} module Module. - * @param {Number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise<{size: number, total: boolean}>} Promise resolved with the size and a boolean indicating if it was able - * to calculate the total size. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved with the size and a boolean indicating if it was able + * to calculate the total size. */ getDownloadSize(module: any, courseId: number, single?: boolean): Promise<{ size: number, total: boolean }> { const promises = [], @@ -112,11 +112,11 @@ export class AddonModWikiPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Get list of files. If not defined, we'll assume they're in module.contents. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the list of files. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of files. */ getFiles(module: any, courseId: number, single?: boolean, siteId?: string): Promise { @@ -137,9 +137,9 @@ export class AddonModWikiPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId The course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId The course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.wikiProvider.invalidateContent(moduleId, courseId); @@ -148,11 +148,11 @@ export class AddonModWikiPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string): Promise { // Get the download time of the package before starting the download (otherwise we'd always get current time). @@ -170,12 +170,12 @@ export class AddonModWikiPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Prefetch a wiki. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} single True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} siteId Site ID. - * @param {number} downloadTime The previous download time, 0 if no previous download. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. + * @param downloadTime The previous download time, 0 if no previous download. + * @return Promise resolved when done. */ protected prefetchWiki(module: any, courseId: number, single: boolean, siteId: string, downloadTime: number): Promise { const userId = this.sitesProvider.getCurrentSiteUserId(); @@ -211,10 +211,10 @@ export class AddonModWikiPrefetchHandler extends CoreCourseActivityPrefetchHandl /** * Sync a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ sync(module: any, courseId: number, siteId?: any): Promise { return this.syncProvider.syncWiki(module.instance, module.course, module.id, siteId); diff --git a/src/addon/mod/wiki/providers/sync-cron-handler.ts b/src/addon/mod/wiki/providers/sync-cron-handler.ts index c74a439fe..5d31464c8 100644 --- a/src/addon/mod/wiki/providers/sync-cron-handler.ts +++ b/src/addon/mod/wiki/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class AddonModWikiSyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.wikiSync.syncAllWikis(siteId, force); @@ -40,7 +40,7 @@ export class AddonModWikiSyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return this.wikiSync.syncInterval; diff --git a/src/addon/mod/wiki/providers/tag-area-handler.ts b/src/addon/mod/wiki/providers/tag-area-handler.ts index 0f3cab521..2d06b73b2 100644 --- a/src/addon/mod/wiki/providers/tag-area-handler.ts +++ b/src/addon/mod/wiki/providers/tag-area-handler.ts @@ -29,7 +29,7 @@ export class AddonModWikiTagAreaHandler implements CoreTagAreaHandler { /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return true; @@ -38,8 +38,8 @@ export class AddonModWikiTagAreaHandler implements CoreTagAreaHandler { /** * Parses the rendered content of a tag index and returns the items. * - * @param {string} content Rendered content. - * @return {any[]|Promise} Area items (or promise resolved with the items). + * @param content Rendered content. + * @return Area items (or promise resolved with the items). */ parseContent(content: string): any[] | Promise { return this.tagHelper.parseFeedContent(content); @@ -48,8 +48,8 @@ export class AddonModWikiTagAreaHandler implements CoreTagAreaHandler { /** * Get the component to use to display items. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return CoreTagFeedComponent; diff --git a/src/addon/mod/wiki/providers/wiki-offline.ts b/src/addon/mod/wiki/providers/wiki-offline.ts index 003fa3b7a..0c11d14d1 100644 --- a/src/addon/mod/wiki/providers/wiki-offline.ts +++ b/src/addon/mod/wiki/providers/wiki-offline.ts @@ -91,8 +91,8 @@ export class AddonModWikiOfflineProvider { /** * Convert a value to a positive number. If not a number or less than 0, 0 will be returned. * - * @param {any} value Value to convert. - * @return {number} Converted value. + * @param value Value to convert. + * @return Converted value. */ convertToPositiveNumber(value: any): number { value = parseInt(value, 10); @@ -103,13 +103,13 @@ export class AddonModWikiOfflineProvider { /** * Delete a new page. * - * @param {string} title Title of the page. - * @param {number} [subwikiId] Subwiki ID. If not defined, wikiId, userId and groupId should be defined. - * @param {number} [wikiId] Wiki ID. Optional, will be used create subwiki if not informed. - * @param {number} [userId] User ID. Optional, will be used create subwiki if not informed. - * @param {number} [groupId] Group ID. Optional, will be used create subwiki if not informed. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if deleted, rejected if failure. + * @param title Title of the page. + * @param subwikiId Subwiki ID. If not defined, wikiId, userId and groupId should be defined. + * @param wikiId Wiki ID. Optional, will be used create subwiki if not informed. + * @param userId User ID. Optional, will be used create subwiki if not informed. + * @param groupId Group ID. Optional, will be used create subwiki if not informed. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if deleted, rejected if failure. */ deleteNewPage(title: string, subwikiId?: number, wikiId?: number, userId?: number, groupId?: number, siteId?: string) : Promise { @@ -134,8 +134,8 @@ export class AddonModWikiOfflineProvider { /** * Get all the stored new pages from all the wikis. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with pages. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with pages. */ getAllNewPages(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -146,13 +146,13 @@ export class AddonModWikiOfflineProvider { /** * Get a stored new page. * - * @param {string} title Title of the page. - * @param {number} [subwikiId] Subwiki ID. If not defined, wikiId, userId and groupId should be defined. - * @param {number} [wikiId] Wiki ID. Optional, will be used create subwiki if not informed. - * @param {number} [userId] User ID. Optional, will be used create subwiki if not informed. - * @param {number} [groupId] Group ID. Optional, will be used create subwiki if not informed. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with page. + * @param title Title of the page. + * @param subwikiId Subwiki ID. If not defined, wikiId, userId and groupId should be defined. + * @param wikiId Wiki ID. Optional, will be used create subwiki if not informed. + * @param userId User ID. Optional, will be used create subwiki if not informed. + * @param groupId Group ID. Optional, will be used create subwiki if not informed. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with page. */ getNewPage(title: string, subwikiId?: number, wikiId?: number, userId?: number, groupId?: number, siteId?: string) : Promise { @@ -177,12 +177,12 @@ export class AddonModWikiOfflineProvider { /** * Get all the stored new pages from a certain subwiki. * - * @param {number} [subwikiId] Subwiki ID. If not defined, wikiId, userId and groupId should be defined. - * @param {number} [wikiId] Wiki ID. Optional, will be used create subwiki if not informed. - * @param {number} [userId] User ID. Optional, will be used create subwiki if not informed. - * @param {number} [groupId] Group ID. Optional, will be used create subwiki if not informed. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with pages. + * @param subwikiId Subwiki ID. If not defined, wikiId, userId and groupId should be defined. + * @param wikiId Wiki ID. Optional, will be used create subwiki if not informed. + * @param userId User ID. Optional, will be used create subwiki if not informed. + * @param groupId Group ID. Optional, will be used create subwiki if not informed. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with pages. */ getSubwikiNewPages(subwikiId?: number, wikiId?: number, userId?: number, groupId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -204,9 +204,9 @@ export class AddonModWikiOfflineProvider { /** * Get all the stored new pages from a list of subwikis. * - * @param {any[]} subwikis List of subwiki. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with pages. + * @param subwikis List of subwiki. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with pages. */ getSubwikisNewPages(subwikis: any[], siteId?: string): Promise { const promises = []; @@ -227,14 +227,14 @@ export class AddonModWikiOfflineProvider { /** * Save a new page to be sent later. * - * @param {string} title Title of the page. - * @param {string} content Content of the page. - * @param {number} [subwikiId] Subwiki ID. If not defined, wikiId, userId and groupId should be defined. - * @param {number} [wikiId] Wiki ID. Optional, will be used create subwiki if not informed. - * @param {number} [userId] User ID. Optional, will be used create subwiki if not informed. - * @param {number} [groupId] Group ID. Optional, will be used create subwiki if not informed. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param title Title of the page. + * @param content Content of the page. + * @param subwikiId Subwiki ID. If not defined, wikiId, userId and groupId should be defined. + * @param wikiId Wiki ID. Optional, will be used create subwiki if not informed. + * @param userId User ID. Optional, will be used create subwiki if not informed. + * @param groupId Group ID. Optional, will be used create subwiki if not informed. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ saveNewPage(title: string, content: string, subwikiId?: number, wikiId?: number, userId?: number, groupId?: number, siteId?: string): Promise { @@ -261,9 +261,9 @@ export class AddonModWikiOfflineProvider { /** * Check if a list of subwikis have offline data stored. * - * @param {any[]} subwikis List of subwikis. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return{Promise} Promise resolved with boolean: whether it has offline data. + * @param subwikis List of subwikis. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether it has offline data. */ subwikisHaveOfflineData(subwikis: any[], siteId?: string): Promise { return this.getSubwikisNewPages(subwikis, siteId).then((pages) => { diff --git a/src/addon/mod/wiki/providers/wiki-sync.ts b/src/addon/mod/wiki/providers/wiki-sync.ts index 9fa0200c9..4bd73581a 100644 --- a/src/addon/mod/wiki/providers/wiki-sync.ts +++ b/src/addon/mod/wiki/providers/wiki-sync.ts @@ -35,25 +35,21 @@ import { AddonModWikiOfflineProvider } from './wiki-offline'; export interface AddonModWikiSyncSubwikiResult { /** * List of warnings. - * @type {string[]} */ warnings: string[]; /** * Whether data was updated in the site. - * @type {boolean} */ updated: boolean; /** * List of created pages. - * @type {{pageId: number, title: string}} */ created: {pageId: number, title: string}[]; /** * List of discarded pages. - * @type {{title: string, warning: string}} */ discarded: {title: string, warning: string}[]; } @@ -64,19 +60,16 @@ export interface AddonModWikiSyncSubwikiResult { export interface AddonModWikiSyncWikiResult { /** * List of warnings. - * @type {string[]} */ warnings: string[]; /** * Whether data was updated in the site. - * @type {boolean} */ updated: boolean; /** * List of subwikis. - * @type {{[subwikiId: number]: {created: {pageId: number, title: string}, discarded: {title: string, warning: string}}}} */ subwikis: {[subwikiId: number]: { created: {pageId: number, title: string}[], @@ -85,7 +78,6 @@ export interface AddonModWikiSyncWikiResult { /** * Site ID. - * @type {string} */ siteId: string; } @@ -117,11 +109,11 @@ export class AddonModWikiSyncProvider extends CoreSyncBaseProvider { /** * Get a string to identify a subwiki. If it doesn't have a subwiki ID it will be identified by wiki ID, user ID and group ID. * - * @param {number} subwikiId Subwiki ID. If not defined, wikiId, userId and groupId should be defined. - * @param {number} [wikiId] Wiki ID. Optional, will be used to create the subwiki if subwiki ID not provided. - * @param {number} [userId] User ID. Optional, will be used to create the subwiki if subwiki ID not provided. - * @param {number} [groupId] Group ID. Optional, will be used to create the subwiki if subwiki ID not provided. - * @return {string} Identifier. + * @param subwikiId Subwiki ID. If not defined, wikiId, userId and groupId should be defined. + * @param wikiId Wiki ID. Optional, will be used to create the subwiki if subwiki ID not provided. + * @param userId User ID. Optional, will be used to create the subwiki if subwiki ID not provided. + * @param groupId Group ID. Optional, will be used to create the subwiki if subwiki ID not provided. + * @return Identifier. */ getSubwikiBlockId(subwikiId: number, wikiId?: number, userId?: number, groupId?: number): string { subwikiId = this.wikiOfflineProvider.convertToPositiveNumber(subwikiId); @@ -142,9 +134,9 @@ export class AddonModWikiSyncProvider extends CoreSyncBaseProvider { /** * Try to synchronize all the wikis in a certain site or in all sites. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncAllWikis(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all wikis', this.syncAllWikisFunc.bind(this), [force], siteId); @@ -153,9 +145,9 @@ export class AddonModWikiSyncProvider extends CoreSyncBaseProvider { /** * Sync all wikis on a site. * - * @param {string} siteId Site ID to sync. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @param {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. + * @param force Wether to force sync not depending on last execution. + * @param Promise resolved if sync is successful, rejected if sync fails. */ protected syncAllWikisFunc(siteId: string, force?: boolean): Promise { // Get all the pages created in offline. @@ -201,12 +193,12 @@ export class AddonModWikiSyncProvider extends CoreSyncBaseProvider { /** * Sync a subwiki only if a certain time has passed since the last time. * - * @param {number} subwikiId Subwiki ID. If not defined, wikiId, userId and groupId should be defined. - * @param {number} [wikiId] Wiki ID. Optional, will be used to create the subwiki if subwiki ID not provided. - * @param {number} [userId] User ID. Optional, will be used to create the subwiki if subwiki ID not provided. - * @param {number} [groupId] Group ID. Optional, will be used to create the subwiki if subwiki ID not provided. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when subwiki is synced or doesn't need to be synced. + * @param subwikiId Subwiki ID. If not defined, wikiId, userId and groupId should be defined. + * @param wikiId Wiki ID. Optional, will be used to create the subwiki if subwiki ID not provided. + * @param userId User ID. Optional, will be used to create the subwiki if subwiki ID not provided. + * @param groupId Group ID. Optional, will be used to create the subwiki if subwiki ID not provided. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when subwiki is synced or doesn't need to be synced. */ syncSubwikiIfNeeded(subwikiId: number, wikiId?: number, userId?: number, groupId?: number, siteId?: string) : Promise { @@ -223,12 +215,12 @@ export class AddonModWikiSyncProvider extends CoreSyncBaseProvider { /** * Synchronize a subwiki. * - * @param {number} subwikiId Subwiki ID. If not defined, wikiId, userId and groupId should be defined. - * @param {number} [wikiId] Wiki ID. Optional, will be used to create the subwiki if subwiki ID not provided. - * @param {number} [userId] User ID. Optional, will be used to create the subwiki if subwiki ID not provided. - * @param {number} [groupId] Group ID. Optional, will be used to create the subwiki if subwiki ID not provided. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param subwikiId Subwiki ID. If not defined, wikiId, userId and groupId should be defined. + * @param wikiId Wiki ID. Optional, will be used to create the subwiki if subwiki ID not provided. + * @param userId User ID. Optional, will be used to create the subwiki if subwiki ID not provided. + * @param groupId Group ID. Optional, will be used to create the subwiki if subwiki ID not provided. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncSubwiki(subwikiId: number, wikiId?: number, userId?: number, groupId?: number, siteId?: string) : Promise { @@ -333,11 +325,11 @@ export class AddonModWikiSyncProvider extends CoreSyncBaseProvider { /** * Tries to synchronize a wiki. * - * @param {number} wikiId Wiki ID. - * @param {number} [courseId] Course ID. - * @param {number} [cmId] Wiki course module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param wikiId Wiki ID. + * @param courseId Course ID. + * @param cmId Wiki course module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncWiki(wikiId: number, courseId?: number, cmId?: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); diff --git a/src/addon/mod/wiki/providers/wiki.ts b/src/addon/mod/wiki/providers/wiki.ts index 4523f541b..f4fa688e2 100644 --- a/src/addon/mod/wiki/providers/wiki.ts +++ b/src/addon/mod/wiki/providers/wiki.ts @@ -27,31 +27,26 @@ import { CoreSite, CoreSiteWSPreSets } from '@classes/site'; export interface AddonModWikiSubwikiListData { /** * Number of subwikis. - * @type {number} */ count: number; /** * Subwiki ID currently selected. - * @type {number} */ subwikiSelected: number; /** * User of the subwiki currently selected. - * @type {number} */ userSelected: number; /** * Group of the subwiki currently selected. - * @type {number} */ groupSelected: number; /** * List of subwikis. - * @type {any[]} */ subwikis: any[]; } @@ -84,7 +79,7 @@ export class AddonModWikiProvider { /** * Clear subwiki list cache for a certain wiki or all of them. * - * @param {number} [wikiId] wiki Id, if not provided all will be cleared. + * @param wikiId wiki Id, if not provided all will be cleared. */ clearSubwikiList(wikiId?: number): void { if (typeof wikiId == 'undefined') { @@ -97,10 +92,10 @@ export class AddonModWikiProvider { /** * Save wiki contents on a page or section. * - * @param {number} pageId Page ID. - * @param {string} content content to be saved. - * @param {string} [section] section to get. - * @return {Promise} Promise resolved with the page ID. + * @param pageId Page ID. + * @param content content to be saved. + * @param section section to get. + * @return Promise resolved with the page ID. */ editPage(pageId: number, content: string, section?: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -122,11 +117,11 @@ export class AddonModWikiProvider { /** * Get a wiki page contents. * - * @param {number} pageId Page ID. - * @param {boolean} [offline] Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the page data. + * @param pageId Page ID. + * @param offline Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the page data. */ getPageContents(pageId: number, offline?: boolean, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -154,8 +149,8 @@ export class AddonModWikiProvider { /** * Get cache key for wiki Pages Contents WS calls. * - * @param {number} pageId Wiki Page ID. - * @return {string} Cache key. + * @param pageId Wiki Page ID. + * @return Cache key. */ protected getPageContentsCacheKey(pageId: number): string { return this.ROOT_CACHE_KEY + 'page:' + pageId; @@ -164,11 +159,11 @@ export class AddonModWikiProvider { /** * Get a wiki page contents for editing. It does not cache calls. * - * @param {number} pageId Page ID. - * @param {string} [section] Section to get. - * @param {boolean} [lockOnly] Just renew lock and not return content. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with page contents. + * @param pageId Page ID. + * @param section Section to get. + * @param lockOnly Just renew lock and not return content. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with page contents. */ getPageForEditing(pageId: number, section?: string, lockOnly?: boolean, siteId?: string): Promise { @@ -195,13 +190,13 @@ export class AddonModWikiProvider { /** * Gets the list of files from a specific subwiki. * - * @param {number} wikiId Wiki ID. - * @param {number} [groupId] Group to get files from. - * @param {number} [userId] User to get files from. - * @param {boolean} [offline] Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with subwiki files. + * @param wikiId Wiki ID. + * @param groupId Group to get files from. + * @param userId User to get files from. + * @param offline Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with subwiki files. */ getSubwikiFiles(wikiId: number, groupId?: number, userId?: number, offline?: boolean, ignoreCache?: boolean, siteId?: string) : Promise { @@ -236,10 +231,10 @@ export class AddonModWikiProvider { /** * Get cache key for wiki Subwiki Files WS calls. * - * @param {number} wikiId Wiki ID. - * @param {number} groupId Group ID. - * @param {number} userId User ID. - * @return {string} Cache key. + * @param wikiId Wiki ID. + * @param groupId Group ID. + * @param userId User ID. + * @return Cache key. */ protected getSubwikiFilesCacheKey(wikiId: number, groupId: number, userId: number): string { return this.getSubwikiFilesCacheKeyPrefix(wikiId) + ':' + groupId + ':' + userId; @@ -248,8 +243,8 @@ export class AddonModWikiProvider { /** * Get cache key for all wiki Subwiki Files WS calls. * - * @param {number} wikiId Wiki ID. - * @return {string} Cache key. + * @param wikiId Wiki ID. + * @return Cache key. */ protected getSubwikiFilesCacheKeyPrefix(wikiId: number): string { return this.ROOT_CACHE_KEY + 'subwikifiles:' + wikiId; @@ -258,8 +253,8 @@ export class AddonModWikiProvider { /** * Get a list of subwikis and related data for a certain wiki from the cache. * - * @param {number} wikiId wiki Id - * @return {AddonModWikiSubwikiListData} Subwiki list and related data. + * @param wikiId wiki Id + * @return Subwiki list and related data. */ getSubwikiList(wikiId: number): AddonModWikiSubwikiListData { return this.subwikiListsCache[wikiId]; @@ -268,16 +263,16 @@ export class AddonModWikiProvider { /** * Get the list of Pages of a SubWiki. * - * @param {number} wikiId Wiki ID. - * @param {number} [groupId] Group to get pages from. - * @param {number} [userId] User to get pages from. - * @param {string} [sortBy=title] The attribute to sort the returned list. - * @param {string} [sortDirection=ASC] Direction to sort the returned list (ASC | DESC). - * @param {boolean} [includeContent] Whether the pages have to include its content. Default: false. - * @param {boolean} [offline] Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with wiki subwiki pages. + * @param wikiId Wiki ID. + * @param groupId Group to get pages from. + * @param userId User to get pages from. + * @param sortBy The attribute to sort the returned list. + * @param sortDirection Direction to sort the returned list (ASC | DESC). + * @param includeContent Whether the pages have to include its content. Default: false. + * @param offline Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with wiki subwiki pages. */ getSubwikiPages(wikiId: number, groupId?: number, userId?: number, sortBy: string = 'title', sortDirection: string = 'ASC', includeContent?: boolean, offline?: boolean, ignoreCache?: boolean, siteId?: string): Promise { @@ -321,10 +316,10 @@ export class AddonModWikiProvider { /** * Get cache key for wiki Subwiki Pages WS calls. * - * @param {number} wikiId Wiki ID. - * @param {number} groupId Group ID. - * @param {number} userId User ID. - * @return {string} Cache key. + * @param wikiId Wiki ID. + * @param groupId Group ID. + * @param userId User ID. + * @return Cache key. */ protected getSubwikiPagesCacheKey(wikiId: number, groupId: number, userId: number): string { return this.getSubwikiPagesCacheKeyPrefix(wikiId) + ':' + groupId + ':' + userId; @@ -333,8 +328,8 @@ export class AddonModWikiProvider { /** * Get cache key for all wiki Subwiki Pages WS calls. * - * @param {number} wikiId Wiki ID. - * @return {string} Cache key. + * @param wikiId Wiki ID. + * @return Cache key. */ protected getSubwikiPagesCacheKeyPrefix(wikiId: number): string { return this.ROOT_CACHE_KEY + 'subwikipages:' + wikiId; @@ -343,11 +338,11 @@ export class AddonModWikiProvider { /** * Get all the subwikis of a wiki. * - * @param {number} wikiId Wiki ID. - * @param {boolean} [offline] Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with subwikis. + * @param wikiId Wiki ID. + * @param offline Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with subwikis. */ getSubwikis(wikiId: number, offline?: boolean, ignoreCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -375,8 +370,8 @@ export class AddonModWikiProvider { /** * Get cache key for get wiki subWikis WS calls. * - * @param {number} wikiId Wiki ID. - * @return {string} Cache key. + * @param wikiId Wiki ID. + * @return Cache key. */ protected getSubwikisCacheKey(wikiId: number): string { return this.ROOT_CACHE_KEY + 'subwikis:' + wikiId; @@ -385,11 +380,11 @@ export class AddonModWikiProvider { /** * Get a wiki by module ID. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {boolean} [forceCache] Whether it should always return cached data. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the wiki is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param forceCache Whether it should always return cached data. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the wiki is retrieved. */ getWiki(courseId: number, cmId: number, forceCache?: boolean, siteId?: string): Promise { return this.getWikiByField(courseId, 'coursemodule', cmId, forceCache, siteId); @@ -398,12 +393,12 @@ export class AddonModWikiProvider { /** * Get a wiki with key=value. If more than one is found, only the first will be returned. * - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {boolean} [forceCache] Whether it should always return cached data. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the wiki is retrieved. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param forceCache Whether it should always return cached data. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the wiki is retrieved. */ protected getWikiByField(courseId: number, key: string, value: any, forceCache?: boolean, siteId?: string): Promise { @@ -435,11 +430,11 @@ export class AddonModWikiProvider { /** * Get a wiki by wiki ID. * - * @param {number} courseId Course ID. - * @param {number} id Wiki ID. - * @param {boolean} [forceCache] Whether it should always return cached data. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the wiki is retrieved. + * @param courseId Course ID. + * @param id Wiki ID. + * @param forceCache Whether it should always return cached data. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the wiki is retrieved. */ getWikiById(courseId: number, id: number, forceCache?: boolean, siteId?: string): Promise { return this.getWikiByField(courseId, 'id', id, forceCache, siteId); @@ -448,8 +443,8 @@ export class AddonModWikiProvider { /** * Get cache key for wiki data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getWikiDataCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'wiki:' + courseId; @@ -458,11 +453,11 @@ export class AddonModWikiProvider { /** * Gets a list of files to download for a wiki, using a format similar to module.contents from get_course_contents. * - * @param {any} wiki Wiki. - * @param {boolean} [offline] Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the list of files. + * @param wiki Wiki. + * @param offline Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of files. */ getWikiFileList(wiki: any, offline?: boolean, ignoreCache?: boolean, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -488,11 +483,11 @@ export class AddonModWikiProvider { /** * Gets a list of all pages for a Wiki. * - * @param {any} wiki Wiki. - * @param {boolean} [offline] Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Page list. + * @param wiki Wiki. + * @param offline Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Page list. */ getWikiPageList(wiki: any, offline?: boolean, ignoreCache?: boolean, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -519,10 +514,10 @@ export class AddonModWikiProvider { * Invalidate the prefetched content except files. * To invalidate files, use invalidateFiles. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param moduleId The module ID. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -542,9 +537,9 @@ export class AddonModWikiProvider { /** * Invalidate the prefetched files. * - * @param {number} moduleId The module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the files are invalidated. + * @param moduleId The module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the files are invalidated. */ invalidateFiles(moduleId: number, siteId?: string): Promise { return this.filepoolProvider.invalidateFilesByComponent(siteId, AddonModWikiProvider.COMPONENT, moduleId); @@ -553,9 +548,9 @@ export class AddonModWikiProvider { /** * Invalidates page content WS call for a certain page. * - * @param {number} pageId Wiki Page ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param pageId Wiki Page ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidatePage(pageId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -566,9 +561,9 @@ export class AddonModWikiProvider { /** * Invalidates all the subwiki files WS calls for a certain wiki. * - * @param {number} wikiId Wiki ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param wikiId Wiki ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateSubwikiFiles(wikiId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -579,9 +574,9 @@ export class AddonModWikiProvider { /** * Invalidates all the subwiki pages WS calls for a certain wiki. * - * @param {Number} wikiId Wiki ID. - * @param {String} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param wikiId Wiki ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateSubwikiPages(wikiId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -592,9 +587,9 @@ export class AddonModWikiProvider { /** * Invalidates all the get subwikis WS calls for a certain wiki. * - * @param {number} wikiId Wiki ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param wikiId Wiki ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateSubwikis(wikiId: number, siteId?: string): Promise { this.clearSubwikiList(wikiId); @@ -607,9 +602,9 @@ export class AddonModWikiProvider { /** * Invalidates wiki data. * - * @param {Number} courseId Course ID. - * @param {String} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateWikiData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -620,13 +615,13 @@ export class AddonModWikiProvider { /** * Check if a page title is already used. * - * @param {number} wikiId Wiki ID. - * @param {number} subwikiId Subwiki ID. - * @param {string} title Page title. - * @param {boolean} [offline] Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if used, resolved with false if not used or cannot determine. + * @param wikiId Wiki ID. + * @param subwikiId Subwiki ID. + * @param title Page title. + * @param offline Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if used, resolved with false if not used or cannot determine. */ isTitleUsed(wikiId: number, subwikiId: number, title: string, offline?: boolean, ignoreCache?: boolean, siteId?: string) : Promise { @@ -658,11 +653,11 @@ export class AddonModWikiProvider { /** * Report a wiki page as being viewed. * - * @param {number} id Page ID. - * @param {number} wikiId Wiki ID. - * @param {string} [name] Name of the wiki. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Page ID. + * @param wikiId Wiki ID. + * @param name Name of the wiki. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logPageView(id: number, wikiId: number, name?: string, siteId?: string): Promise { const params = { @@ -676,10 +671,10 @@ export class AddonModWikiProvider { /** * Report the wiki as being viewed. * - * @param {number} id Wiki ID. - * @param {string} [name] Name of the wiki. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Wiki ID. + * @param name Name of the wiki. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params = { @@ -693,14 +688,14 @@ export class AddonModWikiProvider { /** * Create a new page on a subwiki. * - * @param {string} title Title to create the page. - * @param {string} content Content to save on the page. - * @param {number} [subwikiId] Subwiki ID. If not defined, wikiId, userId and groupId should be defined. - * @param {number} [wikiId] Wiki ID. Optional, will be used to create a new subwiki if subwikiId not supplied. - * @param {number} [userId] User ID. Optional, will be used to create a new subwiki if subwikiId not supplied. - * @param {number} [groupId] Group ID. Optional, will be used to create a new subwiki if subwikiId not supplied. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with page ID if page was created in server, -1 if stored in device. + * @param title Title to create the page. + * @param content Content to save on the page. + * @param subwikiId Subwiki ID. If not defined, wikiId, userId and groupId should be defined. + * @param wikiId Wiki ID. Optional, will be used to create a new subwiki if subwikiId not supplied. + * @param userId User ID. Optional, will be used to create a new subwiki if subwikiId not supplied. + * @param groupId Group ID. Optional, will be used to create a new subwiki if subwikiId not supplied. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with page ID if page was created in server, -1 if stored in device. */ newPage(title: string, content: string, subwikiId?: number, wikiId?: number, userId?: number, groupId?: number, siteId?: string): Promise { @@ -755,14 +750,14 @@ export class AddonModWikiProvider { /** * Create a new page on a subwiki. It will fail if offline or cannot connect. * - * @param {string} title Title to create the page. - * @param {string} content Content to save on the page. - * @param {number} [subwikiId] Subwiki ID. If not defined, wikiId, userId and groupId should be defined. - * @param {number} [wikiId] Wiki ID. Optional, will be used create subwiki if not informed. - * @param {number} [userId] User ID. Optional, will be used create subwiki if not informed. - * @param {number} [groupId] Group ID. Optional, will be used create subwiki if not informed. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the page ID if created, rejected otherwise. + * @param title Title to create the page. + * @param content Content to save on the page. + * @param subwikiId Subwiki ID. If not defined, wikiId, userId and groupId should be defined. + * @param wikiId Wiki ID. Optional, will be used create subwiki if not informed. + * @param userId User ID. Optional, will be used create subwiki if not informed. + * @param groupId Group ID. Optional, will be used create subwiki if not informed. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the page ID if created, rejected otherwise. */ newPageOnline(title: string, content: string, subwikiId?: number, wikiId?: number, userId?: number, groupId?: number, siteId?: string): Promise { @@ -794,12 +789,12 @@ export class AddonModWikiProvider { /** * Save subwiki list for a wiki to the cache. * - * @param {number} wikiId Wiki Id. - * @param {any[]} subwikis List of subwikis. - * @param {number} count Number of subwikis in the subwikis list. - * @param {number} subwikiId Subwiki Id currently selected. - * @param {number} userId User Id currently selected. - * @param {number} groupId Group Id currently selected. + * @param wikiId Wiki Id. + * @param subwikis List of subwikis. + * @param count Number of subwikis in the subwikis list. + * @param subwikiId Subwiki Id currently selected. + * @param userId User Id currently selected. + * @param groupId Group Id currently selected. */ setSubwikiList(wikiId: number, subwikis: any[], count: number, subwikiId: number, userId: number, groupId: number): void { this.subwikiListsCache[wikiId] = { @@ -814,9 +809,9 @@ export class AddonModWikiProvider { /** * Sort an array of wiki pages by title. * - * @param {any[]} pages Pages to sort. - * @param {boolean} [desc] True to sort in descendent order, false to sort in ascendent order. Defaults to false. - * @return {any[]} Sorted pages. + * @param pages Pages to sort. + * @param desc True to sort in descendent order, false to sort in ascendent order. Defaults to false. + * @return Sorted pages. */ sortPagesByTitle(pages: any[], desc?: boolean): any[] { return pages.sort((a, b) => { @@ -833,12 +828,12 @@ export class AddonModWikiProvider { /** * Check if a wiki has a certain subwiki. * - * @param {number} wikiId Wiki ID. - * @param {number} subwikiId Subwiki ID to search. - * @param {boolean} [offline] Whether it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] Whether it should ignore cached data (it will always fail in offline or server down). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if it has subwiki, resolved with false otherwise. + * @param wikiId Wiki ID. + * @param subwikiId Subwiki ID to search. + * @param offline Whether it should return cached data. Has priority over ignoreCache. + * @param ignoreCache Whether it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if it has subwiki, resolved with false otherwise. */ wikiHasSubwiki(wikiId: number, subwikiId: number, offline?: boolean, ignoreCache?: boolean, siteId?: string): Promise { // Get the subwikis to check if any of them matches the one passed as param. diff --git a/src/addon/mod/workshop/assessment/accumulative/providers/handler.ts b/src/addon/mod/workshop/assessment/accumulative/providers/handler.ts index 40505af47..b5b9e0962 100644 --- a/src/addon/mod/workshop/assessment/accumulative/providers/handler.ts +++ b/src/addon/mod/workshop/assessment/accumulative/providers/handler.ts @@ -30,7 +30,7 @@ export class AddonModWorkshopAssessmentStrategyAccumulativeHandler implements Ad /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return true; @@ -40,8 +40,8 @@ export class AddonModWorkshopAssessmentStrategyAccumulativeHandler implements Ad * Return the Component to render the plugin. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return AddonModWorkshopAssessmentStrategyAccumulativeComponent; @@ -50,9 +50,9 @@ export class AddonModWorkshopAssessmentStrategyAccumulativeHandler implements Ad /** * Prepare original values to be shown and compared. * - * @param {any} form Original data of the form. - * @param {number} workshopId WorkShop Id - * @return {Promise} Promise resolved with original values sorted. + * @param form Original data of the form. + * @param workshopId WorkShop Id + * @return Promise resolved with original values sorted. */ getOriginalValues(form: any, workshopId: number): Promise { const defaultGrade = this.translate.instant('core.choosedots'), @@ -92,9 +92,9 @@ export class AddonModWorkshopAssessmentStrategyAccumulativeHandler implements Ad /** * Check if the assessment data has changed for a certain submission and workshop for a this strategy plugin. * - * @param {any[]} originalValues Original values of the form. - * @param {any[]} currentValues Current values of the form. - * @return {boolean} True if data has changed, false otherwise. + * @param originalValues Original values of the form. + * @param currentValues Current values of the form. + * @return True if data has changed, false otherwise. */ hasDataChanged(originalValues: any[], currentValues: any[]): boolean { for (const x in originalValues) { @@ -112,9 +112,9 @@ export class AddonModWorkshopAssessmentStrategyAccumulativeHandler implements Ad /** * Prepare assessment data to be sent to the server depending on the strategy selected. * - * @param {any{}} currentValues Current values of the form. - * @param {any} form Assessment form data. - * @return {Promise} Promise resolved with the data to be sent. Or rejected with the input errors object. + * @param currentValues Current values of the form. + * @param form Assessment form data. + * @return Promise resolved with the data to be sent. Or rejected with the input errors object. */ prepareAssessmentData(currentValues: any[], form: any): Promise { const data = {}; diff --git a/src/addon/mod/workshop/assessment/comments/providers/handler.ts b/src/addon/mod/workshop/assessment/comments/providers/handler.ts index 132e0f38b..83922cc0e 100644 --- a/src/addon/mod/workshop/assessment/comments/providers/handler.ts +++ b/src/addon/mod/workshop/assessment/comments/providers/handler.ts @@ -29,7 +29,7 @@ export class AddonModWorkshopAssessmentStrategyCommentsHandler implements AddonW /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return true; @@ -39,8 +39,8 @@ export class AddonModWorkshopAssessmentStrategyCommentsHandler implements AddonW * Return the Component to render the plugin. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return AddonModWorkshopAssessmentStrategyCommentsComponent; @@ -49,9 +49,9 @@ export class AddonModWorkshopAssessmentStrategyCommentsHandler implements AddonW /** * Prepare original values to be shown and compared. * - * @param {any} form Original data of the form. - * @param {number} workshopId Workshop Id - * @return {Promise} Promise resolved with original values sorted. + * @param form Original data of the form. + * @param workshopId Workshop Id + * @return Promise resolved with original values sorted. */ getOriginalValues(form: any, workshopId: number): Promise { const originalValues = []; @@ -75,9 +75,9 @@ export class AddonModWorkshopAssessmentStrategyCommentsHandler implements AddonW /** * Check if the assessment data has changed for a certain submission and workshop for a this strategy plugin. * - * @param {any[]} originalValues Original values of the form. - * @param {any[]} currentValues Current values of the form. - * @return {boolean} True if data has changed, false otherwise. + * @param originalValues Original values of the form. + * @param currentValues Current values of the form. + * @return True if data has changed, false otherwise. */ hasDataChanged(originalValues: any[], currentValues: any[]): boolean { for (const x in originalValues) { @@ -92,9 +92,9 @@ export class AddonModWorkshopAssessmentStrategyCommentsHandler implements AddonW /** * Prepare assessment data to be sent to the server depending on the strategy selected. * - * @param {any{}} currentValues Current values of the form. - * @param {any} form Assessment form data. - * @return {Promise} Promise resolved with the data to be sent. Or rejected with the input errors object. + * @param currentValues Current values of the form. + * @param form Assessment form data. + * @return Promise resolved with the data to be sent. Or rejected with the input errors object. */ prepareAssessmentData(currentValues: any[], form: any): Promise { const data = {}; diff --git a/src/addon/mod/workshop/assessment/numerrors/providers/handler.ts b/src/addon/mod/workshop/assessment/numerrors/providers/handler.ts index 5e77dc7e0..94e361d83 100644 --- a/src/addon/mod/workshop/assessment/numerrors/providers/handler.ts +++ b/src/addon/mod/workshop/assessment/numerrors/providers/handler.ts @@ -29,7 +29,7 @@ export class AddonModWorkshopAssessmentStrategyNumErrorsHandler implements Addon /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return true; @@ -39,8 +39,8 @@ export class AddonModWorkshopAssessmentStrategyNumErrorsHandler implements Addon * Return the Component to render the plugin. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return AddonModWorkshopAssessmentStrategyNumErrorsComponent; @@ -49,9 +49,9 @@ export class AddonModWorkshopAssessmentStrategyNumErrorsHandler implements Addon /** * Prepare original values to be shown and compared. * - * @param {any} form Original data of the form. - * @param {number} workshopId Workshop Id - * @return {Promise} Promise resolved with original values sorted. + * @param form Original data of the form. + * @param workshopId Workshop Id + * @return Promise resolved with original values sorted. */ getOriginalValues(form: any, workshopId: number): Promise { const originalValues = []; @@ -76,9 +76,9 @@ export class AddonModWorkshopAssessmentStrategyNumErrorsHandler implements Addon /** * Check if the assessment data has changed for a certain submission and workshop for a this strategy plugin. * - * @param {any[]} originalValues Original values of the form. - * @param {any[]} currentValues Current values of the form. - * @return {boolean} True if data has changed, false otherwise. + * @param originalValues Original values of the form. + * @param currentValues Current values of the form. + * @return True if data has changed, false otherwise. */ hasDataChanged(originalValues: any[], currentValues: any[]): boolean { for (const x in originalValues) { @@ -96,9 +96,9 @@ export class AddonModWorkshopAssessmentStrategyNumErrorsHandler implements Addon /** * Prepare assessment data to be sent to the server depending on the strategy selected. * - * @param {any{}} currentValues Current values of the form. - * @param {any} form Assessment form data. - * @return {Promise} Promise resolved with the data to be sent. Or rejected with the input errors object. + * @param currentValues Current values of the form. + * @param form Assessment form data. + * @return Promise resolved with the data to be sent. Or rejected with the input errors object. */ prepareAssessmentData(currentValues: any[], form: any): Promise { const data = {}; diff --git a/src/addon/mod/workshop/assessment/rubric/providers/handler.ts b/src/addon/mod/workshop/assessment/rubric/providers/handler.ts index d9dc5a38b..41a9eb6b1 100644 --- a/src/addon/mod/workshop/assessment/rubric/providers/handler.ts +++ b/src/addon/mod/workshop/assessment/rubric/providers/handler.ts @@ -29,7 +29,7 @@ export class AddonModWorkshopAssessmentStrategyRubricHandler implements AddonWor /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return true; @@ -39,8 +39,8 @@ export class AddonModWorkshopAssessmentStrategyRubricHandler implements AddonWor * Return the Component to render the plugin. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return AddonModWorkshopAssessmentStrategyRubricComponent; @@ -49,9 +49,9 @@ export class AddonModWorkshopAssessmentStrategyRubricHandler implements AddonWor /** * Prepare original values to be shown and compared. * - * @param {any} form Original data of the form. - * @param {number} workshopId Workshop Id - * @return {Promise} Promise resolved with original values sorted. + * @param form Original data of the form. + * @param workshopId Workshop Id + * @return Promise resolved with original values sorted. */ getOriginalValues(form: any, workshopId: number): Promise { const originalValues = []; @@ -75,9 +75,9 @@ export class AddonModWorkshopAssessmentStrategyRubricHandler implements AddonWor /** * Check if the assessment data has changed for a certain submission and workshop for a this strategy plugin. * - * @param {any[]} originalValues Original values of the form. - * @param {any[]} currentValues Current values of the form. - * @return {boolean} True if data has changed, false otherwise. + * @param originalValues Original values of the form. + * @param currentValues Current values of the form. + * @return True if data has changed, false otherwise. */ hasDataChanged(originalValues: any[], currentValues: any[]): boolean { for (const x in originalValues) { @@ -92,9 +92,9 @@ export class AddonModWorkshopAssessmentStrategyRubricHandler implements AddonWor /** * Prepare assessment data to be sent to the server depending on the strategy selected. * - * @param {any{}} currentValues Current values of the form. - * @param {any} form Assessment form data. - * @return {Promise} Promise resolved with the data to be sent. Or rejected with the input errors object. + * @param currentValues Current values of the form. + * @param form Assessment form data. + * @return Promise resolved with the data to be sent. Or rejected with the input errors object. */ prepareAssessmentData(currentValues: any[], form: any): Promise { const data = {}; diff --git a/src/addon/mod/workshop/components/assessment-strategy/assessment-strategy.ts b/src/addon/mod/workshop/components/assessment-strategy/assessment-strategy.ts index 1516b9c60..6fe11499b 100644 --- a/src/addon/mod/workshop/components/assessment-strategy/assessment-strategy.ts +++ b/src/addon/mod/workshop/components/assessment-strategy/assessment-strategy.ts @@ -138,7 +138,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit { /** * Convenience function to load the assessment data. * - * @return {Promise} Promised resvoled when data is loaded. + * @return Promised resvoled when data is loaded. */ protected load(): Promise { return this.workshopHelper.getReviewerAssessmentById(this.workshop.id, this.assessmentId, this.userId) @@ -224,7 +224,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit { /** * Check if data has changed. * - * @return {boolean} True if data has changed. + * @return True if data has changed. */ hasDataChanged(): boolean { if (!this.assessmentStrategyLoaded) { @@ -254,7 +254,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit { /** * Save the assessment. * - * @return {Promise} Promise resolved when done, rejected if assessment could not be saved. + * @return Promise resolved when done, rejected if assessment could not be saved. */ saveAssessment(): Promise { const files = this.fileSessionProvider.getFiles(AddonModWorkshopProvider.COMPONENT, @@ -332,7 +332,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit { /** * Feedback text changed. * - * @param {string} text The new text. + * @param text The new text. */ onFeedbackChange(text: string): void { this.feedbackText = text; diff --git a/src/addon/mod/workshop/components/index/index.ts b/src/addon/mod/workshop/components/index/index.ts index 6e96123a2..b4f88d644 100644 --- a/src/addon/mod/workshop/components/index/index.ts +++ b/src/addon/mod/workshop/components/index/index.ts @@ -118,7 +118,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity /** * Function called when we receive an event of submission changes. * - * @param {any} data Data received by the event. + * @param data Data received by the event. */ protected eventReceived(data: any): void { if ((this.workshop && this.workshop.id === data.workshopId) || data.cmId === this.module.id) { @@ -132,7 +132,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { const promises = []; @@ -161,8 +161,8 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity /** * Compares sync event data with current data to check if refresh content is needed. * - * @param {any} syncEventData Data receiven on sync observer. - * @return {boolean} True if refresh is needed, false otherwise. + * @param syncEventData Data receiven on sync observer. + * @return True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: any): boolean { if (this.workshop && syncEventData.workshopId == this.workshop.id) { @@ -178,10 +178,10 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity /** * Download feedback contents. * - * @param {boolean} [refresh=false] If it's refreshing content. - * @param {boolean} [sync=false] If it should try to sync. - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved when done. + * @param refresh If it's refreshing content. + * @param sync If it should try to sync. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved when done. */ protected fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { return this.workshopProvider.getWorkshop(this.courseId, this.module.id).then((workshop) => { @@ -240,8 +240,8 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity /** * Retrieves and shows submissions grade page. * - * @param {number} page Page number to be retrieved. - * @return {Promise} Resolved when done. + * @param page Page number to be retrieved. + * @return Resolved when done. */ gotoSubmissionsPage(page: number): Promise { return this.workshopProvider.getGradesReport(this.workshop.id, this.group, page).then((report) => { @@ -269,7 +269,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity /** * Open task. * - * @param {any} task Task to be done. + * @param task Task to be done. */ runTask(task: any): void { if (task.code == 'submit') { @@ -315,8 +315,8 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity /** * Set group to see the workshop. - * @param {number} groupId Group Id. - * @return {Promise} Promise resolved when done. + * @param groupId Group Id. + * @return Promise resolved when done. */ setGroup(groupId: number): Promise { this.group = groupId; @@ -327,7 +327,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity /** * Convenience function to set current phase information. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected setPhaseInfo(): Promise { this.submission = false; @@ -417,7 +417,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity /** * Performs the sync of the activity. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected sync(): Promise { return this.workshopSync.syncWorkshop(this.workshop.id); @@ -426,8 +426,8 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity /** * Checks if sync has succeed from result sync data. * - * @param {any} result Data returned on the sync function. - * @return {boolean} If suceed or not. + * @param result Data returned on the sync function. + * @return If suceed or not. */ protected hasSyncSucceed(result: any): boolean { return result.updated; diff --git a/src/addon/mod/workshop/pages/assessment/assessment.ts b/src/addon/mod/workshop/pages/assessment/assessment.ts index 6c1783e35..e49d720a7 100644 --- a/src/addon/mod/workshop/pages/assessment/assessment.ts +++ b/src/addon/mod/workshop/pages/assessment/assessment.ts @@ -116,7 +116,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy { /** * Check if we can leave the page or not. * - * @return {boolean|Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { if (this.forceLeave || !this.evaluating) { @@ -134,7 +134,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy { /** * Fetch the assessment data. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected fetchAssessmentData(): Promise { return this.workshopProvider.getWorkshopById(this.courseId, this.workshopId).then((workshopData) => { @@ -247,7 +247,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy { /** * Check if data has changed. * - * @return {boolean} True if changed, false otherwise. + * @return True if changed, false otherwise. */ protected hasEvaluationChanged(): boolean { if (!this.loaded || !this.evaluating) { @@ -276,7 +276,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy { /** * Convenience function to refresh all the data. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected refreshAllData(): Promise { const promises = []; @@ -300,7 +300,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy { /** * Pull to refresh. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshAssessment(refresher: any): void { if (this.loaded) { @@ -328,7 +328,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy { /** * Sends the evaluation to be saved on the server. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected sendEvaluation(): Promise { const modal = this.domUtils.showModalLoading('core.sending', true), diff --git a/src/addon/mod/workshop/pages/edit-submission/edit-submission.ts b/src/addon/mod/workshop/pages/edit-submission/edit-submission.ts index 3409680a1..5e82ed2fa 100644 --- a/src/addon/mod/workshop/pages/edit-submission/edit-submission.ts +++ b/src/addon/mod/workshop/pages/edit-submission/edit-submission.ts @@ -103,7 +103,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy { /** * Check if we can leave the page or not. * - * @return {boolean|Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { if (this.forceLeave) { @@ -131,7 +131,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy { /** * Fetch the submission data. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected fetchSubmissionData(): Promise { return this.workshopProvider.getWorkshop(this.courseId, this.module.id).then((workshopData) => { @@ -225,7 +225,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy { /** * Get the form input data. * - * @return {any} Object with all the info. + * @return Object with all the info. */ protected getInputData(): any { const submissionId = this.submission.id || 'newsub'; @@ -250,7 +250,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy { /** * Check if data has changed. * - * @return {boolean} True if changed or false if not. + * @return True if changed or false if not. */ protected hasDataChanged(): boolean { if (!this.loaded) { @@ -277,7 +277,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy { /** * Pull to refresh. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshSubmission(refresher: any): void { if (this.loaded) { @@ -315,7 +315,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy { /** * Send submission and save. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected saveSubmission(): Promise { const inputData = this.getInputData(); diff --git a/src/addon/mod/workshop/pages/index/index.ts b/src/addon/mod/workshop/pages/index/index.ts index db244a7d1..7ad7677da 100644 --- a/src/addon/mod/workshop/pages/index/index.ts +++ b/src/addon/mod/workshop/pages/index/index.ts @@ -42,7 +42,7 @@ export class AddonModWorkshopIndexPage { /** * Update some data based on the workshop instance. * - * @param {any} workshop Workshop instance. + * @param workshop Workshop instance. */ updateData(workshop: any): void { this.title = workshop.name || this.title; diff --git a/src/addon/mod/workshop/pages/phase/phase.ts b/src/addon/mod/workshop/pages/phase/phase.ts index a0d88a01f..3773fa727 100644 --- a/src/addon/mod/workshop/pages/phase/phase.ts +++ b/src/addon/mod/workshop/pages/phase/phase.ts @@ -58,7 +58,7 @@ export class AddonModWorkshopPhaseInfoPage { /** * Open task. * - * @param {any} task Task to be done. + * @param task Task to be done. */ runTask(task: any): void { if (task.code == 'submit') { diff --git a/src/addon/mod/workshop/pages/submission/submission.ts b/src/addon/mod/workshop/pages/submission/submission.ts index 1158e5df5..63580cdc8 100644 --- a/src/addon/mod/workshop/pages/submission/submission.ts +++ b/src/addon/mod/workshop/pages/submission/submission.ts @@ -141,7 +141,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy { /** * Check if we can leave the page or not. * - * @return {boolean|Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { const assessmentHasChanged = this.assessmentStrategy && this.assessmentStrategy.hasDataChanged(); @@ -170,7 +170,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy { /** * Function called when we receive an event of submission changes. * - * @param {any} data Event data received. + * @param data Event data received. */ protected eventReceived(data: any): void { if (this.workshopId === data.workshopId) { @@ -184,7 +184,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy { /** * Fetch the submission data. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected fetchSubmissionData(): Promise { return this.workshopHelper.getSubmissionById(this.workshopId, this.submissionId).then((submissionData) => { @@ -332,7 +332,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy { /** * Check if data has changed. * - * @return {boolean} True if changed, false otherwise. + * @return True if changed, false otherwise. */ protected hasEvaluationChanged(): boolean { if (!this.loaded || !this.access.canoverridegrades) { @@ -359,7 +359,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy { /** * Convenience function to refresh all the data. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected refreshAllData(): Promise { const promises = []; @@ -383,7 +383,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy { /** * Pull to refresh. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshSubmission(refresher: any): void { if (this.loaded) { @@ -427,7 +427,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy { /** * Sends the evaluation to be saved on the server. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected sendEvaluation(): Promise { const modal = this.domUtils.showModalLoading('core.sending', true); @@ -490,7 +490,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy { /** * Undo the submission delete action. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ undoDeleteSubmission(): Promise { return this.workshopOffline.deleteSubmissionAction(this.workshopId, this.submissionId, 'delete').finally(() => { diff --git a/src/addon/mod/workshop/providers/assessment-strategy-delegate.ts b/src/addon/mod/workshop/providers/assessment-strategy-delegate.ts index 3002f6deb..d403d3cb6 100644 --- a/src/addon/mod/workshop/providers/assessment-strategy-delegate.ts +++ b/src/addon/mod/workshop/providers/assessment-strategy-delegate.ts @@ -24,7 +24,6 @@ import { CoreSitesProvider } from '@providers/sites'; export interface AddonWorkshopAssessmentStrategyHandler extends CoreDelegateHandler { /** * The name of the assessment strategy. E.g. 'accumulative'. - * @type {string} */ strategyName: string; @@ -32,35 +31,35 @@ export interface AddonWorkshopAssessmentStrategyHandler extends CoreDelegateHand * Return the Component to render the plugin. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent?(injector: Injector): any | Promise; /** * Prepare original values to be shown and compared. * - * @param {any} form Original data of the form. - * @param {number} workshopId WorkShop Id - * @return {Promise} Promise resolved with original values sorted. + * @param form Original data of the form. + * @param workshopId WorkShop Id + * @return Promise resolved with original values sorted. */ getOriginalValues?(form: any, workshopId: number): Promise; /** * Check if the assessment data has changed for a certain submission and workshop for a this strategy plugin. * - * @param {any[]} originalValues Original values of the form. - * @param {any[]} currentValues Current values of the form. - * @return {boolean} True if data has changed, false otherwise. + * @param originalValues Original values of the form. + * @param currentValues Current values of the form. + * @return True if data has changed, false otherwise. */ hasDataChanged?(originalValues: any[], currentValues: any[]): boolean; /** * Prepare assessment data to be sent to the server depending on the strategy selected. * - * @param {any{}} currentValues Current values of the form. - * @param {any} form Assessment form data. - * @return {Promise} Promise resolved with the data to be sent. Or rejected with the input errors object. + * @param currentValues Current values of the form. + * @param form Assessment form data. + * @return Promise resolved with the data to be sent. Or rejected with the input errors object. */ prepareAssessmentData(currentValues: any[], form: any): Promise; } @@ -82,8 +81,8 @@ export interface AddonWorkshopAssessmentStrategyHandler extends CoreDelegateHand /** * Check if an assessment strategy plugin is supported. * - * @param {string} workshopStrategy Assessment strategy name. - * @return {boolean} True if supported, false otherwise. + * @param workshopStrategy Assessment strategy name. + * @return True if supported, false otherwise. */ isPluginSupported(workshopStrategy: string): boolean { return this.hasHandler(workshopStrategy, true); @@ -92,9 +91,9 @@ export interface AddonWorkshopAssessmentStrategyHandler extends CoreDelegateHand /** * Get the directive to use for a certain assessment strategy plugin. * - * @param {Injector} injector Injector. - * @param {string} workshopStrategy Assessment strategy name. - * @return {any} The component, undefined if not found. + * @param injector Injector. + * @param workshopStrategy Assessment strategy name. + * @return The component, undefined if not found. */ getComponentForPlugin(injector: Injector, workshopStrategy: string): Promise { return this.executeFunctionOnEnabled(workshopStrategy, 'getComponent', [injector]); @@ -103,10 +102,10 @@ export interface AddonWorkshopAssessmentStrategyHandler extends CoreDelegateHand /** * Prepare original values to be shown and compared depending on the strategy selected. * - * @param {string} workshopStrategy Workshop strategy. - * @param {any} form Original data of the form. - * @param {number} workshopId Workshop ID. - * @return {Promise} Resolved with original values sorted. + * @param workshopStrategy Workshop strategy. + * @param form Original data of the form. + * @param workshopId Workshop ID. + * @return Resolved with original values sorted. */ getOriginalValues(workshopStrategy: string, form: any, workshopId: number): Promise { return Promise.resolve(this.executeFunctionOnEnabled(workshopStrategy, 'getOriginalValues', [form, workshopId]) || []); @@ -115,10 +114,10 @@ export interface AddonWorkshopAssessmentStrategyHandler extends CoreDelegateHand /** * Check if the assessment data has changed for a certain submission and workshop for a this strategy plugin. * - * @param {any} workshop Workshop. - * @param {any[]} originalValues Original values of the form. - * @param {any[]} currentValues Current values of the form. - * @return {boolean} True if data has changed, false otherwise. + * @param workshop Workshop. + * @param originalValues Original values of the form. + * @param currentValues Current values of the form. + * @return True if data has changed, false otherwise. */ hasDataChanged(workshop: any, originalValues: any[], currentValues: any[]): boolean { return this.executeFunctionOnEnabled(workshop.strategy, 'hasDataChanged', [originalValues, currentValues]) || false; @@ -127,10 +126,10 @@ export interface AddonWorkshopAssessmentStrategyHandler extends CoreDelegateHand /** * Prepare assessment data to be sent to the server depending on the strategy selected. * - * @param {string} workshopStrategy Workshop strategy to follow. - * @param {any{}} currentValues Current values of the form. - * @param {any} form Assessment form data. - * @return {Promise} Promise resolved with the data to be sent. Or rejected with the input errors object. + * @param workshopStrategy Workshop strategy to follow. + * @param currentValues Current values of the form. + * @param form Assessment form data. + * @return Promise resolved with the data to be sent. Or rejected with the input errors object. */ prepareAssessmentData(workshopStrategy: string, currentValues: any, form: any): Promise { return Promise.resolve(this.executeFunctionOnEnabled(workshopStrategy, 'prepareAssessmentData', [currentValues, form])); diff --git a/src/addon/mod/workshop/providers/helper.ts b/src/addon/mod/workshop/providers/helper.ts index c4d6560b0..9236845b2 100644 --- a/src/addon/mod/workshop/providers/helper.ts +++ b/src/addon/mod/workshop/providers/helper.ts @@ -43,9 +43,9 @@ export class AddonModWorkshopHelperProvider { /** * Get a task by code. * - * @param {any[]} tasks Array of tasks. - * @param {string} taskCode Unique task code. - * @return {any} Task requested + * @param tasks Array of tasks. + * @param taskCode Unique task code. + * @return Task requested */ getTask(tasks: any[], taskCode: string): any { for (const x in tasks) { @@ -60,9 +60,9 @@ export class AddonModWorkshopHelperProvider { /** * Check is task code is done. * - * @param {any[]} tasks Array of tasks. - * @param {string} taskCode Unique task code. - * @return {boolean} True if task is completed. + * @param tasks Array of tasks. + * @param taskCode Unique task code. + * @return True if task is completed. */ isTaskDone(tasks: any[], taskCode: string): boolean { const task = this.getTask(tasks, taskCode); @@ -78,10 +78,10 @@ export class AddonModWorkshopHelperProvider { /** * Return if a user can submit a workshop. * - * @param {any} workshop Workshop info. - * @param {any} access Access information. - * @param {any[]} tasks Array of tasks. - * @return {boolean} True if the user can submit the workshop. + * @param workshop Workshop info. + * @param access Access information. + * @param tasks Array of tasks. + * @return True if the user can submit the workshop. */ canSubmit(workshop: any, access: any, tasks: any[]): boolean { const examplesMust = workshop.useexamples && workshop.examplesmode == AddonModWorkshopProvider.EXAMPLES_BEFORE_SUBMISSION; @@ -94,9 +94,9 @@ export class AddonModWorkshopHelperProvider { /** * Return if a user can assess a workshop. * - * @param {any} workshop Workshop info. - * @param {any} access Access information. - * @return {boolean} True if the user can assess the workshop. + * @param workshop Workshop info. + * @param access Access information. + * @return True if the user can assess the workshop. */ canAssess(workshop: any, access: any): boolean { const examplesMust = workshop.useexamples && workshop.examplesmode == AddonModWorkshopProvider.EXAMPLES_BEFORE_ASSESSMENT; @@ -108,9 +108,9 @@ export class AddonModWorkshopHelperProvider { /** * Return a particular user submission from the submission list. * - * @param {number} workshopId Workshop ID. - * @param {number} [userId] User ID. If not defined current user Id. - * @return {Promise} Resolved with the submission, resolved with false if not found. + * @param workshopId Workshop ID. + * @param userId User ID. If not defined current user Id. + * @return Resolved with the submission, resolved with false if not found. */ getUserSubmission(workshopId: number, userId: number = 0): Promise { return this.workshopProvider.getSubmissions(workshopId).then((submissions) => { @@ -129,10 +129,10 @@ export class AddonModWorkshopHelperProvider { /** * Return a particular submission. It will use prefetched data if fetch fails. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId Submission ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved with the submission, resolved with false if not found. + * @param workshopId Workshop ID. + * @param submissionId Submission ID. + * @param siteId Site ID. If not defined, current site. + * @return Resolved with the submission, resolved with false if not found. */ getSubmissionById(workshopId: number, submissionId: number, siteId?: string): Promise { return this.workshopProvider.getSubmission(workshopId, submissionId, siteId).catch(() => { @@ -152,11 +152,11 @@ export class AddonModWorkshopHelperProvider { /** * Return a particular assesment. It will use prefetched data if fetch fails. It will add assessment form data. * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @param {number} [userId] User ID. If not defined, current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved with the assessment. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @param userId User ID. If not defined, current user. + * @param siteId Site ID. If not defined, current site. + * @return Resolved with the assessment. */ getReviewerAssessmentById(workshopId: number, assessmentId: number, userId: number = 0, siteId?: string): Promise { return this.workshopProvider.getAssessment(workshopId, assessmentId, siteId).catch((error) => { @@ -184,12 +184,12 @@ export class AddonModWorkshopHelperProvider { /** * Retrieves the assessment of the given user and all the related data. * - * @param {number} workshopId Workshop ID. - * @param {number} [userId=0] User ID. If not defined, current user. - * @param {boolean} [offline=false] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache=false] 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. - * @return {Promise} Promise resolved when the workshop data is retrieved. + * @param workshopId Workshop ID. + * @param userId User ID. If not defined, current user. + * @param offline True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the workshop data is retrieved. */ getReviewerAssessments(workshopId: number, userId: number = 0, offline: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { @@ -212,11 +212,11 @@ export class AddonModWorkshopHelperProvider { /** * Delete stored attachment files for a submission. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId If not editing, it will refer to timecreated. - * @param {boolean} editing If the submission is being edited or added otherwise. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when deleted. + * @param workshopId Workshop ID. + * @param submissionId If not editing, it will refer to timecreated. + * @param editing If the submission is being edited or added otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when deleted. */ deleteSubmissionStoredFiles(workshopId: number, submissionId: number, editing: boolean, siteId?: string): Promise { return this.workshopOffline.getSubmissionFolder(workshopId, submissionId, editing, siteId).then((folderPath) => { @@ -230,12 +230,12 @@ export class AddonModWorkshopHelperProvider { * Given a list of files (either online files or local files), store the local files in a local folder * to be submitted later. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId If not editing, it will refer to timecreated. - * @param {boolean} editing If the submission is being edited or added otherwise. - * @param {any[]} files List of files. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success, rejected otherwise. + * @param workshopId Workshop ID. + * @param submissionId If not editing, it will refer to timecreated. + * @param editing If the submission is being edited or added otherwise. + * @param files List of files. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success, rejected otherwise. */ storeSubmissionFiles(workshopId: number, submissionId: number, editing: boolean, files: any[], siteId?: string): Promise { // Get the folder where to store the files. @@ -247,13 +247,13 @@ export class AddonModWorkshopHelperProvider { /** * Upload or store some files for a submission, depending if the user is offline or not. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId If not editing, it will refer to timecreated. - * @param {any[]} files List of files. - * @param {boolean} editing If the submission is being edited or added otherwise. - * @param {boolean} offline True if files sould be stored for offline, false to upload them. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success. + * @param workshopId Workshop ID. + * @param submissionId If not editing, it will refer to timecreated. + * @param files List of files. + * @param editing If the submission is being edited or added otherwise. + * @param offline True if files sould be stored for offline, false to upload them. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success. */ uploadOrStoreSubmissionFiles(workshopId: number, submissionId: number, files: any[], editing: boolean, offline: boolean, siteId?: string): Promise { @@ -267,11 +267,11 @@ export class AddonModWorkshopHelperProvider { /** * Get a list of stored attachment files for a submission. See AddonModWorkshopHelperProvider#storeFiles. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId If not editing, it will refer to timecreated. - * @param {boolean} editing If the submission is being edited or added otherwise. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the files. + * @param workshopId Workshop ID. + * @param submissionId If not editing, it will refer to timecreated. + * @param editing If the submission is being edited or added otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the files. */ getStoredSubmissionFiles(workshopId: number, submissionId: number, editing: boolean, siteId?: string): Promise { return this.workshopOffline.getSubmissionFolder(workshopId, submissionId, editing, siteId).then((folderPath) => { @@ -285,12 +285,12 @@ export class AddonModWorkshopHelperProvider { /** * Get a list of stored attachment files for a submission and online files also. See AddonModWorkshopHelperProvider#storeFiles. * - * @param {any} filesObject Files object combining offline and online information. - * @param {number} workshopId Workshop ID. - * @param {number} submissionId If not editing, it will refer to timecreated. - * @param {boolean} editing If the submission is being edited or added otherwise. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the files. + * @param filesObject Files object combining offline and online information. + * @param workshopId Workshop ID. + * @param submissionId If not editing, it will refer to timecreated. + * @param editing If the submission is being edited or added otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the files. */ getSubmissionFilesFromOfflineFilesObject(filesObject: any, workshopId: number, submissionId: number, editing: boolean, siteId?: string): Promise { @@ -302,10 +302,10 @@ export class AddonModWorkshopHelperProvider { /** * Delete stored attachment files for an assessment. * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when deleted. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when deleted. */ deleteAssessmentStoredFiles(workshopId: number, assessmentId: number, siteId?: string): Promise { return this.workshopOffline.getAssessmentFolder(workshopId, assessmentId, siteId).then((folderPath) => { @@ -319,11 +319,11 @@ export class AddonModWorkshopHelperProvider { * Given a list of files (either online files or local files), store the local files in a local folder * to be submitted later. * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @param {any[]} files List of files. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success, rejected otherwise. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @param files List of files. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success, rejected otherwise. */ storeAssessmentFiles(workshopId: number, assessmentId: number, files: any[], siteId?: string): Promise { // Get the folder where to store the files. @@ -335,12 +335,12 @@ export class AddonModWorkshopHelperProvider { /** * Upload or store some files for an assessment, depending if the user is offline or not. * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId ID. - * @param {any[]} files List of files. - * @param {boolean} offline True if files sould be stored for offline, false to upload them. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success. + * @param workshopId Workshop ID. + * @param assessmentId ID. + * @param files List of files. + * @param offline True if files sould be stored for offline, false to upload them. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success. */ uploadOrStoreAssessmentFiles(workshopId: number, assessmentId: number, files: any[], offline: boolean, siteId?: string): Promise { @@ -354,10 +354,10 @@ export class AddonModWorkshopHelperProvider { /** * Get a list of stored attachment files for an assessment. See AddonModWorkshopHelperProvider#storeFiles. * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the files. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the files. */ getStoredAssessmentFiles(workshopId: number, assessmentId: number, siteId?: string): Promise { return this.workshopOffline.getAssessmentFolder(workshopId, assessmentId, siteId).then((folderPath) => { @@ -371,11 +371,11 @@ export class AddonModWorkshopHelperProvider { /** * Get a list of stored attachment files for an assessment and online files also. See AddonModWorkshopHelperProvider#storeFiles. * - * @param {object} filesObject Files object combining offline and online information. - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the files. + * @param filesObject Files object combining offline and online information. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the files. */ getAssessmentFilesFromOfflineFilesObject(filesObject: any, workshopId: number, assessmentId: number, siteId?: string): Promise { @@ -387,9 +387,9 @@ export class AddonModWorkshopHelperProvider { /** * Returns the action of a given submission. * - * @param {any[]} actions Offline actions to be applied to the given submission. - * @param {number} submissionId ID of the submission to filter by or false. - * @return {any[]} Promise resolved with the files. + * @param actions Offline actions to be applied to the given submission. + * @param submissionId ID of the submission to filter by or false. + * @return Promise resolved with the files. */ filterSubmissionActions(actions: any[], submissionId: number): any[] { return actions.filter((action) => { @@ -404,9 +404,9 @@ export class AddonModWorkshopHelperProvider { /** * Applies offline data to submission. * - * @param {any} submission Submission object to be modified. - * @param {any[]} actions Offline actions to be applied to the given submission. - * @return {Promise} Promise resolved with the files. + * @param submission Submission object to be modified. + * @param actions Offline actions to be applied to the given submission. + * @return Promise resolved with the files. */ applyOfflineData(submission: any, actions: any[]): Promise { if (actions.length && !submission) { @@ -460,13 +460,13 @@ export class AddonModWorkshopHelperProvider { /** * Prepare assessment data to be sent to the server. * - * @param {any} workshop Workshop object. - * @param {any[]} selectedValues Assessment current values - * @param {string} feedbackText Feedback text. - * @param {any[]} feedbackFiles Feedback attachments. - * @param {any} form Assessment form original data. - * @param {number} attachmentsId The draft file area id for attachments. - * @return {Promise} Promise resolved with the data to be sent. Or rejected with the input errors object. + * @param workshop Workshop object. + * @param selectedValues Assessment current values + * @param feedbackText Feedback text. + * @param feedbackFiles Feedback attachments. + * @param form Assessment form original data. + * @param attachmentsId The draft file area id for attachments. + * @return Promise resolved with the data to be sent. Or rejected with the input errors object. */ prepareAssessmentData(workshop: any, selectedValues: any[], feedbackText: string, feedbackFiles: any[], form: any, attachmentsId: number): Promise { @@ -486,10 +486,10 @@ export class AddonModWorkshopHelperProvider { /** * Calculates the real value of a grade based on real_grade_value. * - * @param {number} value Percentual value from 0 to 100. - * @param {number} max The maximal grade. - * @param {number} decimals Decimals to show in the formatted grade. - * @return {string} Real grade formatted. + * @param value Percentual value from 0 to 100. + * @param max The maximal grade. + * @param decimals Decimals to show in the formatted grade. + * @return Real grade formatted. */ protected realGradeValueHelper(value: number, max: number, decimals: number): string { if (value == null) { @@ -506,9 +506,9 @@ export class AddonModWorkshopHelperProvider { /** * Calculates the real value of a grades of an assessment. * - * @param {any} workshop Workshop object. - * @param {any} assessment Assessment data. - * @return {any} Assessment with real grades. + * @param workshop Workshop object. + * @param assessment Assessment data. + * @return Assessment with real grades. */ realGradeValue(workshop: any, assessment: any): any { assessment.grade = this.realGradeValueHelper(assessment.grade, workshop.grade, workshop.gradedecimals); @@ -522,8 +522,8 @@ export class AddonModWorkshopHelperProvider { /** * Check grade should be shown * - * @param {any} grade Grade to be shown - * @return {boolean} If grade should be shown or not. + * @param grade Grade to be shown + * @return If grade should be shown or not. */ showGrade(grade: any): boolean { return typeof grade !== 'undefined' && grade !== null; diff --git a/src/addon/mod/workshop/providers/list-link-handler.ts b/src/addon/mod/workshop/providers/list-link-handler.ts index db2bfb9cc..3614949ec 100644 --- a/src/addon/mod/workshop/providers/list-link-handler.ts +++ b/src/addon/mod/workshop/providers/list-link-handler.ts @@ -33,7 +33,7 @@ export class AddonModWorkshopListLinkHandler extends CoreContentLinksModuleListH /** * Check if the handler is enabled on a site level. * - * @return {Promise} Whether or not the handler is enabled on a site level. + * @return Whether or not the handler is enabled on a site level. */ isEnabled(): Promise { return this.workshopProvider.isPluginEnabled(); diff --git a/src/addon/mod/workshop/providers/module-handler.ts b/src/addon/mod/workshop/providers/module-handler.ts index addfe132d..4b25139ec 100644 --- a/src/addon/mod/workshop/providers/module-handler.ts +++ b/src/addon/mod/workshop/providers/module-handler.ts @@ -44,7 +44,7 @@ export class AddonModWorkshopModuleHandler implements CoreCourseModuleHandler { /** * Check if the handler is enabled on a site level. * - * @return {Promise} Whether or not the handler is enabled on a site level. + * @return Whether or not the handler is enabled on a site level. */ isEnabled(): Promise { return this.workshopProvider.isPluginEnabled(); @@ -53,10 +53,10 @@ export class AddonModWorkshopModuleHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { return { @@ -78,9 +78,9 @@ export class AddonModWorkshopModuleHandler implements CoreCourseModuleHandler { * Get the component to render the module. This is needed to support singleactivity course format. * The component returned must implement CoreCourseModuleMainComponent. * - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any} The component to use, undefined if not found. + * @param course The course object. + * @param module The module object. + * @return The component to use, undefined if not found. */ getMainComponent(course: any, module: any): any { return AddonModWorkshopIndexComponent; diff --git a/src/addon/mod/workshop/providers/offline.ts b/src/addon/mod/workshop/providers/offline.ts index dcd7f1adc..734611ae9 100644 --- a/src/addon/mod/workshop/providers/offline.ts +++ b/src/addon/mod/workshop/providers/offline.ts @@ -179,8 +179,8 @@ export class AddonModWorkshopOfflineProvider { /** * Get all the workshops ids that have something to be synced. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with workshops id that have something to be synced. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with workshops id that have something to be synced. */ getAllWorkshops(siteId?: string): Promise { const promises = [ @@ -207,9 +207,9 @@ export class AddonModWorkshopOfflineProvider { /** * Check if there is an offline data to be synced. * - * @param {number} workshopId Workshop ID to remove. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if has offline data, false otherwise. + * @param workshopId Workshop ID to remove. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if has offline data, false otherwise. */ hasWorkshopOfflineData(workshopId: number, siteId?: string): Promise { const promises = [ @@ -230,11 +230,11 @@ export class AddonModWorkshopOfflineProvider { /** * Delete workshop submission action. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId Submission ID. - * @param {string} action Action to be done. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param workshopId Workshop ID. + * @param submissionId Submission ID. + * @param action Action to be done. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ deleteSubmissionAction(workshopId: number, submissionId: number, action: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -251,10 +251,10 @@ export class AddonModWorkshopOfflineProvider { /** * Delete all workshop submission actions. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId Submission ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param workshopId Workshop ID. + * @param submissionId Submission ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ deleteAllSubmissionActions(workshopId: number, submissionId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -270,8 +270,8 @@ export class AddonModWorkshopOfflineProvider { /** * Get the all the submissions to be synced. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the objects to be synced. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the objects to be synced. */ getAllSubmissions(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -286,9 +286,9 @@ export class AddonModWorkshopOfflineProvider { /** * Get the submissions of a workshop to be synced. * - * @param {number} workshopId ID of the workshop. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the object to be synced. + * @param workshopId ID of the workshop. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the object to be synced. */ getSubmissions(workshopId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -307,10 +307,10 @@ export class AddonModWorkshopOfflineProvider { /** * Get all actions of a submission of a workshop to be synced. * - * @param {number} workshopId ID of the workshop. - * @param {number} submissionId ID of the submission. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the object to be synced. + * @param workshopId ID of the workshop. + * @param submissionId ID of the submission. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the object to be synced. */ getSubmissionActions(workshopId: number, submissionId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -330,11 +330,11 @@ export class AddonModWorkshopOfflineProvider { /** * Get an specific action of a submission of a workshop to be synced. * - * @param {number} workshopId ID of the workshop. - * @param {number} submissionId ID of the submission. - * @param {string} action Action to be done. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the object to be synced. + * @param workshopId ID of the workshop. + * @param submissionId ID of the submission. + * @param action Action to be done. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the object to be synced. */ getSubmissionAction(workshopId: number, submissionId: number, action: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -355,16 +355,16 @@ export class AddonModWorkshopOfflineProvider { /** * Offline version for adding a submission action to a workshop. * - * @param {number} workshopId Workshop ID. - * @param {number} courseId Course ID the workshop belongs to. - * @param {string} title The submission title. - * @param {string} content The submission text content. - * @param {any} attachmentsId Stored attachments. - * @param {number} submissionId Submission Id, if action is add, the time the submission was created. - * If set to 0, current time is used. - * @param {string} action Action to be done. ['add', 'update', 'delete'] - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when submission action is successfully saved. + * @param workshopId Workshop ID. + * @param courseId Course ID the workshop belongs to. + * @param title The submission title. + * @param content The submission text content. + * @param attachmentsId Stored attachments. + * @param submissionId Submission Id, if action is add, the time the submission was created. + * If set to 0, current time is used. + * @param action Action to be done. ['add', 'update', 'delete'] + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when submission action is successfully saved. */ saveSubmission(workshopId: number, courseId: number, title: string, content: string, attachmentsId: any, submissionId: number, action: string, siteId?: string): Promise { @@ -388,7 +388,7 @@ export class AddonModWorkshopOfflineProvider { /** * Parse "attachments" column of a submission record. * - * @param {any} record Submission record, modified in place. + * @param record Submission record, modified in place. */ protected parseSubmissionRecord(record: any): void { record.attachmentsid = this.textUtils.parseJSON(record.attachmentsid); @@ -397,10 +397,10 @@ export class AddonModWorkshopOfflineProvider { /** * Delete workshop assessment. * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ deleteAssessment(workshopId: number, assessmentId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -416,8 +416,8 @@ export class AddonModWorkshopOfflineProvider { /** * Get the all the assessments to be synced. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the objects to be synced. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the objects to be synced. */ getAllAssessments(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -432,9 +432,9 @@ export class AddonModWorkshopOfflineProvider { /** * Get the assessments of a workshop to be synced. * - * @param {number} workshopId ID of the workshop. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the object to be synced. + * @param workshopId ID of the workshop. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the object to be synced. */ getAssessments(workshopId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -453,10 +453,10 @@ export class AddonModWorkshopOfflineProvider { /** * Get an specific assessment of a workshop to be synced. * - * @param {number} workshopId ID of the workshop. - * @param {number} assessmentId Assessment ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the object to be synced. + * @param workshopId ID of the workshop. + * @param assessmentId Assessment ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the object to be synced. */ getAssessment(workshopId: number, assessmentId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -476,12 +476,12 @@ export class AddonModWorkshopOfflineProvider { /** * Offline version for adding an assessment to a workshop. * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @param {number} courseId Course ID the workshop belongs to. - * @param {any} inputData Assessment data. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when assessment is successfully saved. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @param courseId Course ID the workshop belongs to. + * @param inputData Assessment data. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when assessment is successfully saved. */ saveAssessment(workshopId: number, assessmentId: number, courseId: number, inputData: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -500,7 +500,7 @@ export class AddonModWorkshopOfflineProvider { /** * Parse "inpudata" column of an assessment record. * - * @param {any} record Assessnent record, modified in place. + * @param record Assessnent record, modified in place. */ protected parseAssessmentRecord(record: any): void { record.inputdata = this.textUtils.parseJSON(record.inputdata); @@ -509,10 +509,10 @@ export class AddonModWorkshopOfflineProvider { /** * Delete workshop evaluate submission. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId Submission ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param workshopId Workshop ID. + * @param submissionId Submission ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ deleteEvaluateSubmission(workshopId: number, submissionId: number, siteId?: string): Promise { const conditions = { @@ -528,8 +528,8 @@ export class AddonModWorkshopOfflineProvider { /** * Get the all the evaluate submissions to be synced. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the objects to be synced. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the objects to be synced. */ getAllEvaluateSubmissions(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -544,9 +544,9 @@ export class AddonModWorkshopOfflineProvider { /** * Get the evaluate submissions of a workshop to be synced. * - * @param {number} workshopId ID of the workshop. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the object to be synced. + * @param workshopId ID of the workshop. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the object to be synced. */ getEvaluateSubmissions(workshopId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -566,10 +566,10 @@ export class AddonModWorkshopOfflineProvider { /** * Get an specific evaluate submission of a workshop to be synced. * - * @param {number} workshopId ID of the workshop. - * @param {number} submissionId Submission ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the object to be synced. + * @param workshopId ID of the workshop. + * @param submissionId Submission ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the object to be synced. */ getEvaluateSubmission(workshopId: number, submissionId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -589,14 +589,14 @@ export class AddonModWorkshopOfflineProvider { /** * Offline version for evaluation a submission to a workshop. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId Submission ID. - * @param {number} courseId Course ID the workshop belongs to. - * @param {string} feedbackText The feedback for the author. - * @param {boolean} published Whether to publish the submission for other users. - * @param {any} gradeOver The new submission grade (empty for no overriding the grade). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when submission evaluation is successfully saved. + * @param workshopId Workshop ID. + * @param submissionId Submission ID. + * @param courseId Course ID the workshop belongs to. + * @param feedbackText The feedback for the author. + * @param published Whether to publish the submission for other users. + * @param gradeOver The new submission grade (empty for no overriding the grade). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when submission evaluation is successfully saved. */ saveEvaluateSubmission(workshopId: number, submissionId: number, courseId: number, feedbackText: string, published: boolean, gradeOver: any, siteId?: string): Promise { @@ -618,7 +618,7 @@ export class AddonModWorkshopOfflineProvider { /** * Parse "published" and "gradeover" columns of an evaluate submission record. * - * @param {any} record Evaluate submission record, modified in place. + * @param record Evaluate submission record, modified in place. */ protected parseEvaluateSubmissionRecord(record: any): void { record.published = Boolean(record.published); @@ -628,10 +628,10 @@ export class AddonModWorkshopOfflineProvider { /** * Delete workshop evaluate assessment. * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ deleteEvaluateAssessment(workshopId: number, assessmentId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -647,8 +647,8 @@ export class AddonModWorkshopOfflineProvider { /** * Get the all the evaluate assessments to be synced. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the objects to be synced. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the objects to be synced. */ getAllEvaluateAssessments(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -663,9 +663,9 @@ export class AddonModWorkshopOfflineProvider { /** * Get the evaluate assessments of a workshop to be synced. * - * @param {number} workshopId ID of the workshop. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the object to be synced. + * @param workshopId ID of the workshop. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the object to be synced. */ getEvaluateAssessments(workshopId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -685,10 +685,10 @@ export class AddonModWorkshopOfflineProvider { /** * Get an specific evaluate assessment of a workshop to be synced. * - * @param {number} workshopId ID of the workshop. - * @param {number} assessmentId Assessment ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the object to be synced. + * @param workshopId ID of the workshop. + * @param assessmentId Assessment ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the object to be synced. */ getEvaluateAssessment(workshopId: number, assessmentId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -708,14 +708,14 @@ export class AddonModWorkshopOfflineProvider { /** * Offline version for evaluating an assessment to a workshop. * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @param {number} courseId Course ID the workshop belongs to. - * @param {string} feedbackText The feedback for the reviewer. - * @param {number} weight The new weight for the assessment. - * @param {any} gradingGradeOver The new grading grade (empty for no overriding the grade). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when assessment evaluation is successfully saved. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @param courseId Course ID the workshop belongs to. + * @param feedbackText The feedback for the reviewer. + * @param weight The new weight for the assessment. + * @param gradingGradeOver The new grading grade (empty for no overriding the grade). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when assessment evaluation is successfully saved. */ saveEvaluateAssessment(workshopId: number, assessmentId: number, courseId: number, feedbackText: string, weight: number, gradingGradeOver: any, siteId?: string): Promise { @@ -737,7 +737,7 @@ export class AddonModWorkshopOfflineProvider { /** * Parse "gradinggradeover" column of an evaluate assessment record. * - * @param {any} record Evaluate assessment record, modified in place. + * @param record Evaluate assessment record, modified in place. */ protected parseEvaluateAssessmentRecord(record: any): void { record.gradinggradeover = this.textUtils.parseJSON(record.gradinggradeover); @@ -746,9 +746,9 @@ export class AddonModWorkshopOfflineProvider { /** * Get the path to the folder where to store files for offline attachments in a workshop. * - * @param {number} workshopId Workshop ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the path. + * @param workshopId Workshop ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the path. */ getWorkshopFolder(workshopId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -763,11 +763,11 @@ export class AddonModWorkshopOfflineProvider { /** * Get the path to the folder where to store files for offline submissions. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId If not editing, it will refer to timecreated. - * @param {boolean} editing If the submission is being edited or added otherwise. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the path. + * @param workshopId Workshop ID. + * @param submissionId If not editing, it will refer to timecreated. + * @param editing If the submission is being edited or added otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the path. */ getSubmissionFolder(workshopId: number, submissionId: number, editing: boolean, siteId?: string): Promise { return this.getWorkshopFolder(workshopId, siteId).then((folderPath) => { @@ -781,10 +781,10 @@ export class AddonModWorkshopOfflineProvider { /** * Get the path to the folder where to store files for offline assessment. * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the path. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the path. */ getAssessmentFolder(workshopId: number, assessmentId: number, siteId?: string): Promise { return this.getWorkshopFolder(workshopId, siteId).then((folderPath) => { diff --git a/src/addon/mod/workshop/providers/prefetch-handler.ts b/src/addon/mod/workshop/providers/prefetch-handler.ts index 49cc62055..460923c06 100644 --- a/src/addon/mod/workshop/providers/prefetch-handler.ts +++ b/src/addon/mod/workshop/providers/prefetch-handler.ts @@ -57,10 +57,10 @@ export class AddonModWorkshopPrefetchHandler extends CoreCourseActivityPrefetchH /** * Get list of files. If not defined, we'll assume they're in module.contents. * - * @param {any} module Module. - * @param {Number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise} Promise resolved with the list of files. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved with the list of files. */ getFiles(module: any, courseId: number, single?: boolean): Promise { return this.getWorkshopInfoHelper(module, courseId, true).then((info) => { @@ -71,13 +71,13 @@ export class AddonModWorkshopPrefetchHandler extends CoreCourseActivityPrefetchH /** * Helper function to get all workshop info just once. * - * @param {any} module Module to get the files. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [omitFail=false] True to always return even if fails. Default false. - * @param {boolean} [forceCache=false] True to always get the value from cache, false otherwise. Default false. - * @param {boolean} [ignoreCache=false] 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. - * @return {Promise} Promise resolved with the info fetched. + * @param module Module to get the files. + * @param courseId Course ID the module belongs to. + * @param omitFail True to always return even if fails. Default false. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the info fetched. */ protected getWorkshopInfoHelper(module: any, courseId: number, omitFail: boolean = false, forceCache: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { @@ -174,9 +174,9 @@ export class AddonModWorkshopPrefetchHandler extends CoreCourseActivityPrefetchH /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId The course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId The course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { return this.workshopProvider.invalidateContent(moduleId, courseId); @@ -185,9 +185,9 @@ export class AddonModWorkshopPrefetchHandler extends CoreCourseActivityPrefetchH /** * Check if a module can be downloaded. If the function is not defined, we assume that all modules are downloadable. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {boolean|Promise} Whether the module can be downloaded. The promise should never be rejected. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Whether the module can be downloaded. The promise should never be rejected. */ isDownloadable(module: any, courseId: number): boolean | Promise { return this.workshopProvider.getWorkshop(courseId, module.id, undefined, true).then((workshop) => { @@ -201,7 +201,7 @@ export class AddonModWorkshopPrefetchHandler extends CoreCourseActivityPrefetchH /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ isEnabled(): boolean | Promise { return this.workshopProvider.isPluginEnabled(); @@ -210,11 +210,11 @@ export class AddonModWorkshopPrefetchHandler extends CoreCourseActivityPrefetchH /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string): Promise { return this.prefetchPackage(module, courseId, single, this.prefetchWorkshop.bind(this)); @@ -223,10 +223,10 @@ export class AddonModWorkshopPrefetchHandler extends CoreCourseActivityPrefetchH /** * Retrieves all the grades reports for all the groups and then returns only unique grades. * - * @param {number} workshopId Workshop ID. - * @param {any[]} groups Array of groups in the activity. - * @param {string} siteId Site ID. If not defined, current site. - * @return {Promise} All unique entries. + * @param workshopId Workshop ID. + * @param groups Array of groups in the activity. + * @param siteId Site ID. If not defined, current site. + * @return All unique entries. */ protected getAllGradesReport(workshopId: number, groups: any[], siteId: string): Promise { const promises = []; @@ -254,11 +254,11 @@ export class AddonModWorkshopPrefetchHandler extends CoreCourseActivityPrefetchH /** * Prefetch a workshop. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} single True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when done. + * @param module The module object returned by WS. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. + * @return Promise resolved when done. */ protected prefetchWorkshop(module: any, courseId: number, single: boolean, siteId: string): Promise { const userIds = []; @@ -379,10 +379,10 @@ export class AddonModWorkshopPrefetchHandler extends CoreCourseActivityPrefetchH /** * Sync a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ sync(module: any, courseId: number, siteId?: any): Promise { return this.syncProvider.syncWorkshop(module.instance, siteId); diff --git a/src/addon/mod/workshop/providers/sync-cron-handler.ts b/src/addon/mod/workshop/providers/sync-cron-handler.ts index 3202ff253..94886e298 100644 --- a/src/addon/mod/workshop/providers/sync-cron-handler.ts +++ b/src/addon/mod/workshop/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class AddonModWorkshopSyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.workshopSync.syncAllWorkshops(siteId, force); @@ -40,7 +40,7 @@ export class AddonModWorkshopSyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return this.workshopSync.syncInterval; diff --git a/src/addon/mod/workshop/providers/sync.ts b/src/addon/mod/workshop/providers/sync.ts index e30f6c387..6e3366205 100644 --- a/src/addon/mod/workshop/providers/sync.ts +++ b/src/addon/mod/workshop/providers/sync.ts @@ -64,9 +64,9 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { /** * Check if an workshop has data to synchronize. * - * @param {number} workshopId Workshop ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if has data to sync, false otherwise. + * @param workshopId Workshop ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if has data to sync, false otherwise. */ hasDataToSync(workshopId: number, siteId?: string): Promise { return this.workshopOffline.hasWorkshopOfflineData(workshopId, siteId); @@ -75,9 +75,9 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { /** * Try to synchronize all workshops that need it and haven't been synchronized in a while. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved when the sync is done. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved when the sync is done. */ syncAllWorkshops(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all workshops', this.syncAllWorkshopsFunc.bind(this), [force], siteId); @@ -86,9 +86,9 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { /** * Sync all workshops on a site. * - * @param {string} siteId Site ID to sync. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ protected syncAllWorkshopsFunc(siteId: string, force?: boolean): Promise { return this.workshopOffline.getAllWorkshops(siteId).then((workshopIds) => { @@ -114,9 +114,9 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { /** * Sync a workshop only if a certain time has passed since the last time. * - * @param {number} workshopId Workshop ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the workshop is synced or if it doesn't need to be synced. + * @param workshopId Workshop ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the workshop is synced or if it doesn't need to be synced. */ syncWorkshopIfNeeded(workshopId: number, siteId?: string): Promise { return this.isSyncNeeded(workshopId, siteId).then((needed) => { @@ -129,9 +129,9 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { /** * Try to synchronize a workshop. * - * @param {number} workshopId Workshop ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param workshopId Workshop ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncWorkshop(workshopId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -269,11 +269,11 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { /** * Synchronize a submission. * - * @param {any} workshop Workshop. - * @param {any[]} submissionActions Submission actions offline data. - * @param {any} result Object with the result of the sync. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved if success, rejected otherwise. + * @param workshop Workshop. + * @param submissionActions Submission actions offline data. + * @param result Object with the result of the sync. + * @param siteId Site ID. + * @return Promise resolved if success, rejected otherwise. */ protected syncSubmission(workshop: any, submissionActions: any, result: any, siteId: string): Promise { let discardError; @@ -393,11 +393,11 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { /** * Synchronize an assessment. * - * @param {any} workshop Workshop. - * @param {any} assessment Assessment offline data. - * @param {any} result Object with the result of the sync. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved if success, rejected otherwise. + * @param workshop Workshop. + * @param assessment Assessment offline data. + * @param result Object with the result of the sync. + * @param siteId Site ID. + * @return Promise resolved if success, rejected otherwise. */ protected syncAssessment(workshop: any, assessmentData: any, result: any, siteId: string): Promise { let discardError; @@ -471,11 +471,11 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { /** * Synchronize a submission evaluation. * - * @param {any} workshop Workshop. - * @param {any} evaluate Submission evaluation offline data. - * @param {any} result Object with the result of the sync. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved if success, rejected otherwise. + * @param workshop Workshop. + * @param evaluate Submission evaluation offline data. + * @param result Object with the result of the sync. + * @param siteId Site ID. + * @return Promise resolved if success, rejected otherwise. */ protected syncEvaluateSubmission(workshop: any, evaluate: any, result: any, siteId: string): Promise { let discardError; @@ -530,11 +530,11 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider { /** * Synchronize a assessment evaluation. * - * @param {any} workshop Workshop. - * @param {any} evaluate Assessment evaluation offline data. - * @param {any} result Object with the result of the sync. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved if success, rejected otherwise. + * @param workshop Workshop. + * @param evaluate Assessment evaluation offline data. + * @param result Object with the result of the sync. + * @param siteId Site ID. + * @return Promise resolved if success, rejected otherwise. */ protected syncEvaluateAssessment(workshop: any, evaluate: any, result: any, siteId: string): Promise { let discardError; diff --git a/src/addon/mod/workshop/providers/workshop.ts b/src/addon/mod/workshop/providers/workshop.ts index bae7854f0..b356698ce 100644 --- a/src/addon/mod/workshop/providers/workshop.ts +++ b/src/addon/mod/workshop/providers/workshop.ts @@ -57,8 +57,8 @@ export class AddonModWorkshopProvider { /** * Get cache key for workshop data WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getWorkshopDataCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'workshop:' + courseId; @@ -67,8 +67,8 @@ export class AddonModWorkshopProvider { /** * Get prefix cache key for all workshop activity data WS calls. * - * @param {number} workshopId Workshop ID. - * @return {string} Cache key. + * @param workshopId Workshop ID. + * @return Cache key. */ protected getWorkshopDataPrefixCacheKey(workshopId: number): string { return this.ROOT_CACHE_KEY + workshopId; @@ -77,8 +77,8 @@ export class AddonModWorkshopProvider { /** * Get cache key for workshop access information data WS calls. * - * @param {number} workshopId Workshop ID. - * @return {string} Cache key. + * @param workshopId Workshop ID. + * @return Cache key. */ protected getWorkshopAccessInformationDataCacheKey(workshopId: number): string { return this.getWorkshopDataPrefixCacheKey(workshopId) + ':access'; @@ -87,8 +87,8 @@ export class AddonModWorkshopProvider { /** * Get cache key for workshop user plan data WS calls. * - * @param {number} workshopId Workshop ID. - * @return {string} Cache key. + * @param workshopId Workshop ID. + * @return Cache key. */ protected getUserPlanDataCacheKey(workshopId: number): string { return this.getWorkshopDataPrefixCacheKey(workshopId) + ':userplan'; @@ -97,10 +97,10 @@ export class AddonModWorkshopProvider { /** * Get cache key for workshop submissions data WS calls. * - * @param {number} workshopId Workshop ID. - * @param {number} [userId=0] User ID. - * @param {number} [groupId=0] Group ID. - * @return {string} Cache key. + * @param workshopId Workshop ID. + * @param userId User ID. + * @param groupId Group ID. + * @return Cache key. */ protected getSubmissionsDataCacheKey(workshopId: number, userId: number = 0, groupId: number = 0): string { return this.getWorkshopDataPrefixCacheKey(workshopId) + ':submissions:' + userId + ':' + groupId; @@ -109,9 +109,9 @@ export class AddonModWorkshopProvider { /** * Get cache key for a workshop submission data WS calls. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId Submission ID. - * @return {string} Cache key. + * @param workshopId Workshop ID. + * @param submissionId Submission ID. + * @return Cache key. */ protected getSubmissionDataCacheKey(workshopId: number, submissionId: number): string { return this.getWorkshopDataPrefixCacheKey(workshopId) + ':submission:' + submissionId; @@ -120,8 +120,8 @@ export class AddonModWorkshopProvider { /** * Get cache key for workshop grades data WS calls. * - * @param {number} workshopId Workshop ID. - * @return {string} Cache key. + * @param workshopId Workshop ID. + * @return Cache key. */ protected getGradesDataCacheKey(workshopId: number): string { return this.getWorkshopDataPrefixCacheKey(workshopId) + ':grades'; @@ -130,9 +130,9 @@ export class AddonModWorkshopProvider { /** * Get cache key for workshop grade report data WS calls. * - * @param {number} workshopId Workshop ID. - * @param {number} [groupId=0] Group ID. - * @return {string} Cache key. + * @param workshopId Workshop ID. + * @param groupId Group ID. + * @return Cache key. */ protected getGradesReportDataCacheKey(workshopId: number, groupId: number = 0): string { return this.getWorkshopDataPrefixCacheKey(workshopId) + ':report:' + groupId; @@ -141,9 +141,9 @@ export class AddonModWorkshopProvider { /** * Get cache key for workshop submission assessments data WS calls. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId Submission ID. - * @return {string} Cache key. + * @param workshopId Workshop ID. + * @param submissionId Submission ID. + * @return Cache key. */ protected getSubmissionAssessmentsDataCacheKey(workshopId: number, submissionId: number): string { return this.getWorkshopDataPrefixCacheKey(workshopId) + ':assessments:' + submissionId; @@ -152,9 +152,9 @@ export class AddonModWorkshopProvider { /** * Get cache key for workshop reviewer assessments data WS calls. * - * @param {number} workshopId Workshop ID. - * @param {number} [userId=0] User ID or current user. - * @return {string} Cache key. + * @param workshopId Workshop ID. + * @param userId User ID or current user. + * @return Cache key. */ protected getReviewerAssessmentsDataCacheKey(workshopId: number, userId: number = 0): string { return this.getWorkshopDataPrefixCacheKey(workshopId) + ':reviewerassessments:' + userId; @@ -163,9 +163,9 @@ export class AddonModWorkshopProvider { /** * Get cache key for a workshop assessment data WS calls. * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @return {string} Cache key. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @return Cache key. */ protected getAssessmentDataCacheKey(workshopId: number, assessmentId: number): string { return this.getWorkshopDataPrefixCacheKey(workshopId) + ':assessment:' + assessmentId; @@ -174,10 +174,10 @@ export class AddonModWorkshopProvider { /** * Get cache key for workshop assessment form data WS calls. * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @param {string} [mode='assessment'] Mode assessment (default) or preview. - * @return {string} Cache key. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @param mode Mode assessment (default) or preview. + * @return Cache key. */ protected getAssessmentFormDataCacheKey(workshopId: number, assessmentId: number, mode: string = 'assessment'): string { return this.getWorkshopDataPrefixCacheKey(workshopId) + ':assessmentsform:' + assessmentId + ':' + mode; @@ -186,8 +186,8 @@ export class AddonModWorkshopProvider { /** * Return whether or not the plugin is enabled in a certain site. Plugin is enabled if the workshop WS are available. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ isPluginEnabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -199,12 +199,12 @@ export class AddonModWorkshopProvider { /** * Get a workshop with key=value. If more than one is found, only the first will be returned. * - * @param {number} courseId Course ID. - * @param {string} key Name of the property to check. - * @param {any} value Value to search. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [forceCache=false] True to always get the value from cache, false otherwise. Default false. - * @return {Promise} Promise resolved when the workshop is retrieved. + * @param courseId Course ID. + * @param key Name of the property to check. + * @param value Value to search. + * @param siteId Site ID. If not defined, current site. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @return Promise resolved when the workshop is retrieved. */ protected getWorkshopByKey(courseId: number, key: string, value: any, siteId?: string, forceCache: boolean = false): Promise { @@ -250,11 +250,11 @@ export class AddonModWorkshopProvider { /** * Get a workshop by course module ID. * - * @param {number} courseId Course ID. - * @param {number} cmId Course module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [forceCache=false] True to always get the value from cache, false otherwise. Default false. - * @return {Promise} Promise resolved when the workshop is retrieved. + * @param courseId Course ID. + * @param cmId Course module ID. + * @param siteId Site ID. If not defined, current site. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @return Promise resolved when the workshop is retrieved. */ getWorkshop(courseId: number, cmId: number, siteId?: string, forceCache: boolean = false): Promise { return this.getWorkshopByKey(courseId, 'coursemodule', cmId, siteId, forceCache); @@ -263,11 +263,11 @@ export class AddonModWorkshopProvider { /** * Get a workshop by ID. * - * @param {number} courseId Course ID. - * @param {number} id Workshop ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [forceCache=false] True to always get the value from cache, false otherwise. Default false. - * @return {Promise} Promise resolved when the workshop is retrieved. + * @param courseId Course ID. + * @param id Workshop ID. + * @param siteId Site ID. If not defined, current site. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @return Promise resolved when the workshop is retrieved. */ getWorkshopById(courseId: number, id: number, siteId?: string, forceCache: boolean = false): Promise { return this.getWorkshopByKey(courseId, 'id', id, siteId, forceCache); @@ -276,9 +276,9 @@ export class AddonModWorkshopProvider { /** * Invalidates workshop data. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the workshop is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the workshop is invalidated. */ invalidateWorkshopData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -289,9 +289,9 @@ export class AddonModWorkshopProvider { /** * Invalidates workshop data except files and module info. * - * @param {number} workshopId Workshop ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the workshop is invalidated. + * @param workshopId Workshop ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the workshop is invalidated. */ invalidateWorkshopWSData(workshopId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -302,11 +302,11 @@ export class AddonModWorkshopProvider { /** * Get access information for a given workshop. * - * @param {number} workshopId Workshop ID. - * @param {boolean} [offline=false] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache=false] 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. - * @return {Promise} Promise resolved when the workshop is retrieved. + * @param workshopId Workshop ID. + * @param offline True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the workshop is retrieved. */ getWorkshopAccessInformation(workshopId: number, offline: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { @@ -332,9 +332,9 @@ export class AddonModWorkshopProvider { /** * Invalidates workshop access information data. * - * @param {number} workshopId Workshop ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param workshopId Workshop ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateWorkshopAccessInformationData(workshopId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -345,11 +345,11 @@ export class AddonModWorkshopProvider { /** * Return the planner information for the given user. * - * @param {number} workshopId Workshop ID. - * @param {boolean} [offline=false] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache=false] 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. - * @return {Promise} Promise resolved when the workshop data is retrieved. + * @param workshopId Workshop ID. + * @param offline True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the workshop data is retrieved. */ getUserPlanPhases(workshopId: number, offline: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -381,9 +381,9 @@ export class AddonModWorkshopProvider { /** * Invalidates workshop user plan data. * - * @param {number} workshopId Workshop ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param workshopId Workshop ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateUserPlanPhasesData(workshopId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -394,13 +394,13 @@ export class AddonModWorkshopProvider { /** * Retrieves all the workshop submissions visible by the current user or the one done by the given user. * - * @param {number} workshopId Workshop ID. - * @param {number} [userId=0] User ID, 0 means the current user. - * @param {number} [groupId=0] Group id, 0 means that the function will determine the user group. - * @param {boolean} [offline=false] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache=false] 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. - * @return {Promise} Promise resolved when the workshop submissions are retrieved. + * @param workshopId Workshop ID. + * @param userId User ID, 0 means the current user. + * @param groupId Group id, 0 means that the function will determine the user group. + * @param offline True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the workshop submissions are retrieved. */ getSubmissions(workshopId: number, userId: number = 0, groupId: number = 0, offline: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { @@ -435,11 +435,11 @@ export class AddonModWorkshopProvider { /** * Invalidates workshop submissions data. * - * @param {number} workshopId Workshop ID. - * @param {number} [userId=0] User ID. - * @param {number} [groupId=0] Group ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param workshopId Workshop ID. + * @param userId User ID. + * @param groupId Group ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateSubmissionsData(workshopId: number, userId: number = 0, groupId: number = 0, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -450,10 +450,10 @@ export class AddonModWorkshopProvider { /** * Retrieves the given submission. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId Submission ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the workshop submission data is retrieved. + * @param workshopId Workshop ID. + * @param submissionId Submission ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the workshop submission data is retrieved. */ getSubmission(workshopId: number, submissionId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -477,10 +477,10 @@ export class AddonModWorkshopProvider { /** * Invalidates workshop submission data. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId Submission ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param workshopId Workshop ID. + * @param submissionId Submission ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateSubmissionData(workshopId: number, submissionId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -491,9 +491,9 @@ export class AddonModWorkshopProvider { /** * Returns the grades information for the given workshop and user. * - * @param {number} workshopId Workshop ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the workshop grades data is retrieved. + * @param workshopId Workshop ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the workshop grades data is retrieved. */ getGrades(workshopId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -511,9 +511,9 @@ export class AddonModWorkshopProvider { /** * Invalidates workshop grades data. * - * @param {number} workshopId Workshop ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param workshopId Workshop ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateGradesData(workshopId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -524,14 +524,14 @@ export class AddonModWorkshopProvider { /** * Retrieves the assessment grades report. * - * @param {number} workshopId Workshop ID. - * @param {number} [groupId] Group id, 0 means that the function will determine the user group. - * @param {number} [page=0] Page of records to return. Default 0. - * @param {number} [perPage=0] Records per page to return. Default AddonModWorkshopProvider.PER_PAGE. - * @param {boolean} [offline=false] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache=false] 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. - * @return {Promise} Promise resolved when the workshop data is retrieved. + * @param workshopId Workshop ID. + * @param groupId Group id, 0 means that the function will determine the user group. + * @param page Page of records to return. Default 0. + * @param perPage Records per page to return. Default AddonModWorkshopProvider.PER_PAGE. + * @param offline True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the workshop data is retrieved. */ getGradesReport(workshopId: number, groupId: number = 0, page: number = 0, perPage: number = 0, offline: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { @@ -567,14 +567,14 @@ export class AddonModWorkshopProvider { /** * Performs the whole fetch of the grade reports in the workshop. * - * @param {number} workshopId Workshop ID. - * @param {number} [groupId=0] Group ID. - * @param {number} [perPage=0] Records per page to fetch. It has to match with the prefetch. - * Default on AddonModWorkshopProvider.PER_PAGE. - * @param {boolean} [forceCache=false] True to always get the value from cache, false otherwise. Default false. - * @param {boolean} [ignoreCache=false] 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. - * @return {Promise} Promise resolved when done. + * @param workshopId Workshop ID. + * @param groupId Group ID. + * @param perPage Records per page to fetch. It has to match with the prefetch. + * Default on AddonModWorkshopProvider.PER_PAGE. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ fetchAllGradeReports(workshopId: number, groupId: number = 0, perPage: number = 0, forceCache: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { @@ -587,15 +587,15 @@ export class AddonModWorkshopProvider { /** * Recursive call on fetch all grade reports. * - * @param {number} workshopId Workshop ID. - * @param {number} groupId Group ID. - * @param {number} perPage Records per page to fetch. It has to match with the prefetch. - * @param {boolean} forceCache True to always get the value from cache, false otherwise. Default false. - * @param {boolean} ignoreCache True if it should ignore cached data (it will always fail in offline or server down). - * @param {any[]} grades Grades already fetched (just to concatenate them). - * @param {number} page Page of records to return. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when done. + * @param workshopId Workshop ID. + * @param groupId Group ID. + * @param perPage Records per page to fetch. It has to match with the prefetch. + * @param forceCache True to always get the value from cache, false otherwise. Default false. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param grades Grades already fetched (just to concatenate them). + * @param page Page of records to return. + * @param siteId Site ID. + * @return Promise resolved when done. */ protected fetchGradeReportsRecursive(workshopId: number, groupId: number, perPage: number, forceCache: boolean, ignoreCache: boolean, grades: any[], page: number, siteId: string): Promise { @@ -615,10 +615,10 @@ export class AddonModWorkshopProvider { /** * Invalidates workshop grade report data. * - * @param {number} workshopId Workshop ID. - * @param {number} [groupId=0] Group ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param workshopId Workshop ID. + * @param groupId Group ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateGradeReportData(workshopId: number, groupId: number = 0, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -629,12 +629,12 @@ export class AddonModWorkshopProvider { /** * Retrieves the given submission assessment. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId Submission ID. - * @param {boolean} [offline=false] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache=false] 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. - * @return {Promise} Promise resolved when the workshop data is retrieved. + * @param workshopId Workshop ID. + * @param submissionId Submission ID. + * @param offline True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the workshop data is retrieved. */ getSubmissionAssessments(workshopId: number, submissionId: number, offline: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { @@ -666,10 +666,10 @@ export class AddonModWorkshopProvider { /** * Invalidates workshop submission assessments data. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId Submission ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param workshopId Workshop ID. + * @param submissionId Submission ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateSubmissionAssesmentsData(workshopId: number, submissionId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -680,15 +680,15 @@ export class AddonModWorkshopProvider { /** * Add a new submission to a given workshop. * - * @param {number} workshopId Workshop ID. - * @param {number} courseId Course ID the workshop belongs to. - * @param {string} title The submission title. - * @param {string} content The submission text content. - * @param {number} [attachmentsId] The draft file area id for attachments. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [timecreated] The time the submission was created. Only used when editing an offline discussion. - * @param {boolean} [allowOffline=false] True if it can be stored in offline, false otherwise. - * @return {Promise} Promise resolved with submission ID if sent online or false if stored offline. + * @param workshopId Workshop ID. + * @param courseId Course ID the workshop belongs to. + * @param title The submission title. + * @param content The submission text content. + * @param attachmentsId The draft file area id for attachments. + * @param siteId Site ID. If not defined, current site. + * @param timecreated The time the submission was created. Only used when editing an offline discussion. + * @param allowOffline True if it can be stored in offline, false otherwise. + * @return Promise resolved with submission ID if sent online or false if stored offline. */ addSubmission(workshopId: number, courseId: number, title: string, content: string, attachmentsId?: number, siteId?: string, timecreated?: number, allowOffline: boolean = false): Promise { @@ -727,12 +727,12 @@ export class AddonModWorkshopProvider { /** * Add a new submission to a given workshop. It will fail if offline or cannot connect. * - * @param {number} workshopId Workshop ID. - * @param {string} title The submission title. - * @param {string} content The submission text content. - * @param {number} [attachmentsId] The draft file area id for attachments. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the submission is created. + * @param workshopId Workshop ID. + * @param title The submission title. + * @param content The submission text content. + * @param attachmentsId The draft file area id for attachments. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the submission is created. */ addSubmissionOnline(workshopId: number, title: string, content: string, attachmentsId: number, siteId?: string): Promise { @@ -758,15 +758,15 @@ export class AddonModWorkshopProvider { /** * Updates the given submission. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId Submission ID. - * @param {number} courseId Course ID the workshop belongs to. - * @param {string} title The submission title. - * @param {string} content The submission text content. - * @param {number} [attachmentsId] The draft file area id for attachments. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [allowOffline=false] True if it can be stored in offline, false otherwise. - * @return {Promise} Promise resolved with submission ID if sent online or false if stored offline. + * @param workshopId Workshop ID. + * @param submissionId Submission ID. + * @param courseId Course ID the workshop belongs to. + * @param title The submission title. + * @param content The submission text content. + * @param attachmentsId The draft file area id for attachments. + * @param siteId Site ID. If not defined, current site. + * @param allowOffline True if it can be stored in offline, false otherwise. + * @return Promise resolved with submission ID if sent online or false if stored offline. */ updateSubmission(workshopId: number, submissionId: number, courseId: number, title: string, content: string, attachmentsId?: number, siteId?: string, allowOffline: boolean = false): Promise { @@ -802,12 +802,12 @@ export class AddonModWorkshopProvider { /** * Updates the given submission. It will fail if offline or cannot connect. * - * @param {number} submissionId Submission ID. - * @param {string} title The submission title. - * @param {string} content The submission text content. - * @param {number} [attachmentsId] The draft file area id for attachments. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the submission is updated. + * @param submissionId Submission ID. + * @param title The submission title. + * @param content The submission text content. + * @param attachmentsId The draft file area id for attachments. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the submission is updated. */ updateSubmissionOnline(submissionId: number, title: string, content: string, attachmentsId?: number, siteId?: string): Promise { @@ -834,11 +834,11 @@ export class AddonModWorkshopProvider { /** * Deletes the given submission. * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId Submission ID. - * @param {number} courseId Course ID the workshop belongs to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with submission ID if sent online, resolved with false if stored offline. + * @param workshopId Workshop ID. + * @param submissionId Submission ID. + * @param courseId Course ID the workshop belongs to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with submission ID if sent online, resolved with false if stored offline. */ deleteSubmission(workshopId: number, submissionId: number, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -872,9 +872,9 @@ export class AddonModWorkshopProvider { /** * Deletes the given submission. It will fail if offline or cannot connect. * - * @param {number} submissionId Submission ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the submission is deleted. + * @param submissionId Submission ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the submission is deleted. */ deleteSubmissionOnline(submissionId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -897,12 +897,12 @@ export class AddonModWorkshopProvider { /** * Retrieves all the assessments reviewed by the given user. * - * @param {number} workshopId Workshop ID. - * @param {number} [userId] User ID. If not defined, current user. - * @param {boolean} [offline=false] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache=false] 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. - * @return {Promise} Promise resolved when the workshop data is retrieved. + * @param workshopId Workshop ID. + * @param userId User ID. If not defined, current user. + * @param offline True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the workshop data is retrieved. */ getReviewerAssessments(workshopId: number, userId?: number, offline: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { @@ -938,10 +938,10 @@ export class AddonModWorkshopProvider { /** * Invalidates workshop user assessments data. * - * @param {number} workshopId Workshop ID. - * @param {number} [userId] User ID. If not defined, current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param workshopId Workshop ID. + * @param userId User ID. If not defined, current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateReviewerAssesmentsData(workshopId: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -952,10 +952,10 @@ export class AddonModWorkshopProvider { /** * Retrieves the given assessment. * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the workshop data is retrieved. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the workshop data is retrieved. */ getAssessment(workshopId: number, assessmentId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -979,10 +979,10 @@ export class AddonModWorkshopProvider { /** * Invalidates workshop assessment data. * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAssessmentData(workshopId: number, assessmentId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -993,13 +993,13 @@ export class AddonModWorkshopProvider { /** * Retrieves the assessment form definition (data required to be able to display the assessment form). * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @param {string} [mode='assessment'] Mode assessment (default) or preview. - * @param {boolean} [offline=false] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache=false] 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. - * @return {Promise} Promise resolved when the workshop data is retrieved. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @param mode Mode assessment (default) or preview. + * @param offline True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the workshop data is retrieved. */ getAssessmentForm(workshopId: number, assessmentId: number, mode: string = 'assessment', offline: boolean = false, ignoreCache: boolean = false, siteId?: string): Promise { @@ -1037,8 +1037,8 @@ export class AddonModWorkshopProvider { /** * Parse fieldes into a more handful format. * - * @param {any[]} fields Fields to parse - * @return {any[]} Parsed fields + * @param fields Fields to parse + * @return Parsed fields */ parseFields(fields: any[]): any[] { const parsedFields = []; @@ -1078,11 +1078,11 @@ export class AddonModWorkshopProvider { /** * Invalidates workshop assessments form data. * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @param {string} [mode='assessment'] Mode assessment (default) or preview. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @param mode Mode assessment (default) or preview. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAssessmentFormData(workshopId: number, assessmentId: number, mode: string = 'assessment', siteId?: string): Promise { @@ -1094,14 +1094,14 @@ export class AddonModWorkshopProvider { /** * Updates the given assessment. * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId Assessment ID. - * @param {number} courseId Course ID the workshop belongs to. - * @param {any} inputData Assessment data. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [allowOffline=false] True if it can be stored in offline, false otherwise. - * @return {Promise} Promise resolved with the grade of the submission if sent online, - * resolved with false if stored offline. + * @param workshopId Workshop ID. + * @param assessmentId Assessment ID. + * @param courseId Course ID the workshop belongs to. + * @param inputData Assessment data. + * @param siteId Site ID. If not defined, current site. + * @param allowOffline True if it can be stored in offline, false otherwise. + * @return Promise resolved with the grade of the submission if sent online, + * resolved with false if stored offline. */ updateAssessment(workshopId: number, assessmentId: number, courseId: number, inputData: any, siteId?: any, allowOffline: boolean = false): Promise { @@ -1136,10 +1136,10 @@ export class AddonModWorkshopProvider { /** * Updates the given assessment. It will fail if offline or cannot connect. * - * @param {number} assessmentId Assessment ID. - * @param {any} inputData Assessment data. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the grade of the submission. + * @param assessmentId Assessment ID. + * @param inputData Assessment data. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the grade of the submission. */ updateAssessmentOnline(assessmentId: number, inputData: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1163,15 +1163,15 @@ export class AddonModWorkshopProvider { /** * Evaluates a submission (used by teachers for provide feedback or override the submission grade). * - * @param {number} workshopId Workshop ID. - * @param {number} submissionId The submission id. - * @param {number} courseId Course ID the workshop belongs to. - * @param {string} feedbackText The feedback for the author. - * @param {boolean} published Whether to publish the submission for other users. - * @param {any} gradeOver The new submission grade (empty for no overriding the grade). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when submission is evaluated if sent online, - * resolved with false if stored offline. + * @param workshopId Workshop ID. + * @param submissionId The submission id. + * @param courseId Course ID the workshop belongs to. + * @param feedbackText The feedback for the author. + * @param published Whether to publish the submission for other users. + * @param gradeOver The new submission grade (empty for no overriding the grade). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when submission is evaluated if sent online, + * resolved with false if stored offline. */ evaluateSubmission(workshopId: number, submissionId: number, courseId: number, feedbackText: string, published: boolean, gradeOver: any, siteId?: string): Promise { @@ -1208,12 +1208,12 @@ export class AddonModWorkshopProvider { * Evaluates a submission (used by teachers for provide feedback or override the submission grade). * It will fail if offline or cannot connect. * - * @param {number} submissionId The submission id. - * @param {string} feedbackText The feedback for the author. - * @param {boolean} published Whether to publish the submission for other users. - * @param {any} gradeOver The new submission grade (empty for no overriding the grade). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the submission is evaluated. + * @param submissionId The submission id. + * @param feedbackText The feedback for the author. + * @param published Whether to publish the submission for other users. + * @param gradeOver The new submission grade (empty for no overriding the grade). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the submission is evaluated. */ evaluateSubmissionOnline(submissionId: number, feedbackText: string, published: boolean, gradeOver: any, siteId?: string): Promise { @@ -1241,15 +1241,15 @@ export class AddonModWorkshopProvider { /** * Evaluates an assessment (used by teachers for provide feedback to the reviewer). * - * @param {number} workshopId Workshop ID. - * @param {number} assessmentId The assessment id. - * @param {number} courseId Course ID the workshop belongs to. - * @param {string} feedbackText The feedback for the reviewer. - * @param {boolean} weight The new weight for the assessment. - * @param {any} gradingGradeOver The new grading grade (empty for no overriding the grade). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when assessment is evaluated if sent online, - * resolved with false if stored offline. + * @param workshopId Workshop ID. + * @param assessmentId The assessment id. + * @param courseId Course ID the workshop belongs to. + * @param feedbackText The feedback for the reviewer. + * @param weight The new weight for the assessment. + * @param gradingGradeOver The new grading grade (empty for no overriding the grade). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when assessment is evaluated if sent online, + * resolved with false if stored offline. */ evaluateAssessment(workshopId: number, assessmentId: number, courseId: number, feedbackText: string, weight: number, gradingGradeOver: any, siteId?: string): Promise { @@ -1285,12 +1285,12 @@ export class AddonModWorkshopProvider { /** * Evaluates an assessment (used by teachers for provide feedback to the reviewer). It will fail if offline or cannot connect. * - * @param {number} assessmentId The assessment id. - * @param {string} feedbackText The feedback for the reviewer. - * @param {number} weight The new weight for the assessment. - * @param {any} gradingGradeOver The new grading grade (empty for no overriding the grade). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the assessment is evaluated. + * @param assessmentId The assessment id. + * @param feedbackText The feedback for the reviewer. + * @param weight The new weight for the assessment. + * @param gradingGradeOver The new grading grade (empty for no overriding the grade). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the assessment is evaluated. */ evaluateAssessmentOnline(assessmentId: number, feedbackText: string, weight: number, gradingGradeOver: any, siteId?: string): Promise { @@ -1319,10 +1319,10 @@ export class AddonModWorkshopProvider { * Invalidate the prefetched content except files. * To invalidate files, use AddonModWorkshopProvider#invalidateFiles. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promised resolved when content is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promised resolved when content is invalidated. */ invalidateContent(moduleId: number, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -1336,10 +1336,10 @@ export class AddonModWorkshopProvider { * Invalidate the prefetched content except files using the activityId. * To invalidate files, use AdddonModWorkshop#invalidateFiles. * - * @param {number} workshopId Workshop ID. - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when content is invalidated. + * @param workshopId Workshop ID. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when content is invalidated. */ invalidateContentById(workshopId: number, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -1356,9 +1356,9 @@ export class AddonModWorkshopProvider { /** * Invalidate the prefetched files. * - * @param {number} moduleId The module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the files are invalidated. + * @param moduleId The module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the files are invalidated. */ invalidateFiles(moduleId: number, siteId?: string): Promise { return this.filepoolProvider.invalidateFilesByComponent(siteId, AddonModWorkshopProvider.COMPONENT, moduleId); @@ -1367,10 +1367,10 @@ export class AddonModWorkshopProvider { /** * Report the workshop as being viewed. * - * @param {number} id Workshop ID. - * @param {string} [name] Name of the workshop. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Workshop ID. + * @param name Name of the workshop. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(id: number, name?: string, siteId?: string): Promise { const params = { @@ -1384,11 +1384,11 @@ export class AddonModWorkshopProvider { /** * Report the workshop submission as being viewed. * - * @param {number} id Submission ID. - * @param {number} workshopId Workshop ID. - * @param {string} [name] Name of the workshop. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param id Submission ID. + * @param workshopId Workshop ID. + * @param name Name of the workshop. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logViewSubmission(id: number, workshopId: number, name?: string, siteId?: string): Promise { const params = { diff --git a/src/addon/notes/components/list/list.ts b/src/addon/notes/components/list/list.ts index cf6f54afa..2011957ed 100644 --- a/src/addon/notes/components/list/list.ts +++ b/src/addon/notes/components/list/list.ts @@ -90,9 +90,9 @@ export class AddonNotesListComponent implements OnInit, OnDestroy { /** * Fetch notes. * - * @param {boolean} sync When to resync notes. - * @param {boolean} [showErrors] When to display errors or not. - * @return {Promise} Promise with the notes. + * @param sync When to resync notes. + * @param showErrors When to display errors or not. + * @return Promise with the notes. */ private fetchNotes(sync: boolean, showErrors?: boolean): Promise { const promise = sync ? this.syncNotes(showErrors) : Promise.resolve(); @@ -141,8 +141,8 @@ export class AddonNotesListComponent implements OnInit, OnDestroy { /** * Refresh notes on PTR. * - * @param {boolean} showErrors Whether to display errors or not. - * @param {any} refresher Refresher instance. + * @param showErrors Whether to display errors or not. + * @param refresher Refresher instance. */ refreshNotes(showErrors: boolean, refresher?: any): void { this.refreshIcon = 'spinner'; @@ -173,7 +173,7 @@ export class AddonNotesListComponent implements OnInit, OnDestroy { /** * Add a new Note to user and course. * - * @param {Event} e Event. + * @param e Event. */ addNote(e: Event): void { e.preventDefault(); @@ -198,8 +198,8 @@ export class AddonNotesListComponent implements OnInit, OnDestroy { /** * Delete a note. * - * @param {Event} e Click event. - * @param {any} note Note to delete. + * @param e Click event. + * @param note Note to delete. */ deleteNote(e: Event, note: any): void { e.preventDefault(); @@ -223,8 +223,8 @@ export class AddonNotesListComponent implements OnInit, OnDestroy { /** * Restore a note. * - * @param {Event} e Click event. - * @param {any} note Note to delete. + * @param e Click event. + * @param note Note to delete. */ undoDeleteNote(e: Event, note: any): void { e.preventDefault(); @@ -245,8 +245,8 @@ export class AddonNotesListComponent implements OnInit, OnDestroy { /** * Tries to synchronize course notes. * - * @param {boolean} showErrors Whether to display errors or not. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param showErrors Whether to display errors or not. + * @return Promise resolved if sync is successful, rejected otherwise. */ private syncNotes(showErrors: boolean): Promise { return this.notesSync.syncNotes(this.courseId).then((warnings) => { @@ -263,7 +263,7 @@ export class AddonNotesListComponent implements OnInit, OnDestroy { /** * Show sync warnings if any. * - * @param {string[]} warnings the warnings + * @param warnings the warnings */ private showSyncWarnings(warnings: string[]): void { const message = this.textUtils.buildMessage(warnings); diff --git a/src/addon/notes/pages/add/add.ts b/src/addon/notes/pages/add/add.ts index 98c770c8f..aed8e5364 100644 --- a/src/addon/notes/pages/add/add.ts +++ b/src/addon/notes/pages/add/add.ts @@ -43,7 +43,7 @@ export class AddonNotesAddPage { /** * Send the note or store it offline. * - * @param {Event} e Event. + * @param e Event. */ addNote(e: Event): void { e.preventDefault(); diff --git a/src/addon/notes/providers/course-option-handler.ts b/src/addon/notes/providers/course-option-handler.ts index f00761ae8..9d5672961 100644 --- a/src/addon/notes/providers/course-option-handler.ts +++ b/src/addon/notes/providers/course-option-handler.ts @@ -31,7 +31,7 @@ export class AddonNotesCourseOptionHandler implements CoreCourseOptionsHandler { /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return this.notesProvider.isPluginEnabled(); @@ -40,11 +40,11 @@ export class AddonNotesCourseOptionHandler implements CoreCourseOptionsHandler { /** * Whether or not the handler is enabled for a certain course. * - * @param {number} courseId The course ID. - * @param {any} accessData Access type and data. Default, guest, ... - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @param courseId The course ID. + * @param accessData Access type and data. Default, guest, ... + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return True or promise resolved with true if enabled. */ isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise { if (accessData && accessData.type == CoreCourseProvider.ACCESS_GUEST) { @@ -61,8 +61,8 @@ export class AddonNotesCourseOptionHandler implements CoreCourseOptionsHandler { /** * Returns the data needed to render the handler. * - * @param {number} courseId The course ID. - * @return {CoreCourseOptionsHandlerData} Data. + * @param courseId The course ID. + * @return Data. */ getDisplayData?(injector: Injector, courseId: number): CoreCourseOptionsHandlerData { return { @@ -75,8 +75,8 @@ export class AddonNotesCourseOptionHandler implements CoreCourseOptionsHandler { /** * 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. - * @return {Promise} Promise resolved when done. + * @param course The course. + * @return Promise resolved when done. */ prefetch(course: any): Promise { return this.notesProvider.getNotes(course.id, undefined, true); diff --git a/src/addon/notes/providers/notes-offline.ts b/src/addon/notes/providers/notes-offline.ts index 28bae97bf..3b844062c 100644 --- a/src/addon/notes/providers/notes-offline.ts +++ b/src/addon/notes/providers/notes-offline.ts @@ -94,11 +94,11 @@ export class AddonNotesOfflineProvider { /** * Delete an offline note. * - * @param {number} userId User ID the note is about. - * @param {string} content The note content. - * @param {number} timecreated The time the note was created. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if deleted, rejected if failure. + * @param userId User ID the note is about. + * @param content The note content. + * @param timecreated The time the note was created. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if deleted, rejected if failure. */ deleteOfflineNote(userId: number, content: string, timecreated: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -113,8 +113,8 @@ export class AddonNotesOfflineProvider { /** * Get all offline deleted notes. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with notes. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with notes. */ getAllDeletedNotes(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -125,9 +125,9 @@ export class AddonNotesOfflineProvider { /** * Get course offline deleted notes. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with notes. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with notes. */ getCourseDeletedNotes(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -138,8 +138,8 @@ export class AddonNotesOfflineProvider { /** * Get all offline notes. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with notes. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with notes. */ getAllNotes(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -150,11 +150,11 @@ export class AddonNotesOfflineProvider { /** * Get an offline note. * - * @param {number} userId User ID the note is about. - * @param {string} content The note content. - * @param {number} timecreated The time the note was created. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the notes. + * @param userId User ID the note is about. + * @param content The note content. + * @param timecreated The time the note was created. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the notes. */ getNote(userId: number, content: string, timecreated: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -169,10 +169,10 @@ export class AddonNotesOfflineProvider { /** * Get offline notes for a certain course and user. * - * @param {number} courseId Course ID. - * @param {number} [userId] User ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with notes. + * @param courseId Course ID. + * @param userId User ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with notes. */ getNotesForCourseAndUser(courseId: number, userId?: number, siteId?: string): Promise { if (!userId) { @@ -187,9 +187,9 @@ export class AddonNotesOfflineProvider { /** * Get offline notes for a certain course. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with notes. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with notes. */ getNotesForCourse(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -200,9 +200,9 @@ export class AddonNotesOfflineProvider { /** * Get offline notes for a certain user. * - * @param {number} userId User ID the notes are about. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with notes. + * @param userId User ID the notes are about. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with notes. */ getNotesForUser(userId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -213,9 +213,9 @@ export class AddonNotesOfflineProvider { /** * Get offline notes with a certain publish state (Personal, Site or Course). * - * @param {string} state Publish state ('personal', 'site' or 'course'). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with notes. + * @param state Publish state ('personal', 'site' or 'course'). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with notes. */ getNotesWithPublishState(state: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -226,9 +226,9 @@ export class AddonNotesOfflineProvider { /** * Check if there are offline notes for a certain course. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if has offline notes, false otherwise. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if has offline notes, false otherwise. */ hasNotesForCourse(courseId: number, siteId?: string): Promise { return this.getNotesForCourse(courseId, siteId).then((notes) => { @@ -239,9 +239,9 @@ export class AddonNotesOfflineProvider { /** * Check if there are offline notes for a certain user. * - * @param {number} userId User ID the notes are about. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if has offline notes, false otherwise. + * @param userId User ID the notes are about. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if has offline notes, false otherwise. */ hasNotesForUser(userId: number, siteId?: string): Promise { return this.getNotesForUser(userId, siteId).then((notes) => { @@ -252,9 +252,9 @@ export class AddonNotesOfflineProvider { /** * Check if there are offline notes with a certain publish state (Personal, Site or Course). * - * @param {string} state Publish state ('personal', 'site' or 'course'). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if has offline notes, false otherwise. + * @param state Publish state ('personal', 'site' or 'course'). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if has offline notes, false otherwise. */ hasNotesWithPublishState(state: string, siteId?: string): Promise { return this.getNotesWithPublishState(state, siteId).then((notes) => { @@ -265,12 +265,12 @@ export class AddonNotesOfflineProvider { /** * Save a note to be sent later. * - * @param {number} userId User ID the note is about. - * @param {number} courseId Course ID. - * @param {string} state Publish state ('personal', 'site' or 'course'). - * @param {string} content The note content. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param userId User ID the note is about. + * @param courseId Course ID. + * @param state Publish state ('personal', 'site' or 'course'). + * @param content The note content. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ saveNote(userId: number, courseId: number, state: string, content: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -294,10 +294,10 @@ export class AddonNotesOfflineProvider { /** * Delete a note offline to be sent later. * - * @param {number} noteId Note ID. - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param noteId Note ID. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ deleteNote(noteId: number, courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -317,9 +317,9 @@ export class AddonNotesOfflineProvider { /** * Undo delete a note. * - * @param {number} noteId Note ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if deleted, rejected if failure. + * @param noteId Note ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if deleted, rejected if failure. */ undoDeleteNote(noteId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/notes/providers/notes-sync.ts b/src/addon/notes/providers/notes-sync.ts index cebf92d73..2cf8538c8 100644 --- a/src/addon/notes/providers/notes-sync.ts +++ b/src/addon/notes/providers/notes-sync.ts @@ -47,9 +47,9 @@ export class AddonNotesSyncProvider extends CoreSyncBaseProvider { /** * Try to synchronize all the notes in a certain site or in all sites. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncAllNotes(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all notes', this.syncAllNotesFunc.bind(this), [force], siteId); @@ -58,9 +58,9 @@ export class AddonNotesSyncProvider extends CoreSyncBaseProvider { /** * Synchronize all the notes in a certain site * - * @param {string} siteId Site ID to sync. - * @param {boolean} force Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ private syncAllNotesFunc(siteId: string, force: boolean): Promise { const proms = []; @@ -100,9 +100,9 @@ export class AddonNotesSyncProvider extends CoreSyncBaseProvider { /** * Sync course notes only if a certain time has passed since the last time. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the notes are synced or if they don't need to be synced. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the notes are synced or if they don't need to be synced. */ private syncNotesIfNeeded(courseId: number, siteId?: string): Promise { return this.isSyncNeeded(courseId, siteId).then((needed) => { @@ -115,9 +115,9 @@ export class AddonNotesSyncProvider extends CoreSyncBaseProvider { /** * Synchronize notes of a course. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncNotes(courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); diff --git a/src/addon/notes/providers/notes.ts b/src/addon/notes/providers/notes.ts index 82f095e41..3753f9404 100644 --- a/src/addon/notes/providers/notes.ts +++ b/src/addon/notes/providers/notes.ts @@ -41,12 +41,12 @@ export class AddonNotesProvider { /** * Add a note. * - * @param {number} userId User ID of the person to add the note. - * @param {number} courseId Course ID where the note belongs. - * @param {string} publishState Personal, Site or Course. - * @param {string} noteText The note text. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if note was sent to server, false if stored in device. + * @param userId User ID of the person to add the note. + * @param courseId Course ID where the note belongs. + * @param publishState Personal, Site or Course. + * @param noteText The note text. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if note was sent to server, false if stored in device. */ addNote(userId: number, courseId: number, publishState: string, noteText: string, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -80,12 +80,12 @@ export class AddonNotesProvider { /** * Add a note. It will fail if offline or cannot connect. * - * @param {number} userId User ID of the person to add the note. - * @param {number} courseId Course ID where the note belongs. - * @param {string} publishState Personal, Site or Course. - * @param {string} noteText The note text. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when added, rejected otherwise. + * @param userId User ID of the person to add the note. + * @param courseId Course ID where the note belongs. + * @param publishState Personal, Site or Course. + * @param noteText The note text. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when added, rejected otherwise. */ addNoteOnline(userId: number, courseId: number, publishState: string, noteText: string, siteId?: string): Promise { const notes = [ @@ -114,10 +114,10 @@ export class AddonNotesProvider { /** * Add several notes. It will fail if offline or cannot connect. * - * @param {any[]} notes Notes to save. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when added, rejected otherwise. Promise resolved doesn't mean that notes - * have been added, the resolve param can contain errors for notes not sent. + * @param notes Notes to save. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when added, rejected otherwise. Promise resolved doesn't mean that notes + * have been added, the resolve param can contain errors for notes not sent. */ addNotesOnline(notes: any[], siteId?: string): Promise { if (!notes || !notes.length) { @@ -136,11 +136,11 @@ export class AddonNotesProvider { /** * Delete a note. * - * @param {any} note Note object to delete. - * @param {number} courseId Course ID where the note belongs. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when deleted, rejected otherwise. Promise resolved doesn't mean that notes - * have been deleted, the resolve param can contain errors for notes not deleted. + * @param note Note object to delete. + * @param courseId Course ID where the note belongs. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when deleted, rejected otherwise. Promise resolved doesn't mean that notes + * have been deleted, the resolve param can contain errors for notes not deleted. */ deleteNote(note: any, courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -178,11 +178,11 @@ export class AddonNotesProvider { /** * Delete a note. It will fail if offline or cannot connect. * - * @param {number[]} noteIds Note IDs to delete. - * @param {number} courseId Course ID where the note belongs. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when deleted, rejected otherwise. Promise resolved doesn't mean that notes - * have been deleted, the resolve param can contain errors for notes not deleted. + * @param noteIds Note IDs to delete. + * @param courseId Course ID where the note belongs. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when deleted, rejected otherwise. Promise resolved doesn't mean that notes + * have been deleted, the resolve param can contain errors for notes not deleted. */ deleteNotesOnline(noteIds: number[], courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -205,8 +205,8 @@ export class AddonNotesProvider { * This method is called quite often and thus should only perform a quick * check, we should not be calling WS from here. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if enabled, resolved with false or rejected otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if enabled, resolved with false or rejected otherwise. */ isPluginEnabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -217,9 +217,9 @@ export class AddonNotesProvider { /** * Returns whether or not the add note plugin is enabled for a certain course. * - * @param {number} courseId ID of the course. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if enabled, resolved with false or rejected otherwise. + * @param courseId ID of the course. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if enabled, resolved with false or rejected otherwise. */ isPluginAddNoteEnabledForCourse(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -249,9 +249,9 @@ export class AddonNotesProvider { /** * Returns whether or not the read notes plugin is enabled for a certain course. * - * @param {number} courseId ID of the course. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if enabled, resolved with false or rejected otherwise. + * @param courseId ID of the course. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if enabled, resolved with false or rejected otherwise. */ isPluginViewNotesEnabledForCourse(courseId: number, siteId?: string): Promise { return this.utils.promiseWorks(this.getNotes(courseId, undefined, false, true, siteId)); @@ -260,8 +260,8 @@ export class AddonNotesProvider { /** * Get prefix cache key for course notes. * - * @param {number} courseId ID of the course to get the notes from. - * @return {string} Cache key. + * @param courseId ID of the course to get the notes from. + * @return Cache key. */ getNotesPrefixCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'notes:' + courseId + ':'; @@ -270,9 +270,9 @@ export class AddonNotesProvider { /** * Get the cache key for the get notes call. * - * @param {number} courseId ID of the course to get the notes from. - * @param {number} [userId] ID of the user to get the notes from if requested. - * @return {string} Cache key. + * @param courseId ID of the course to get the notes from. + * @param userId ID of the user to get the notes from if requested. + * @return Cache key. */ getNotesCacheKey(courseId: number, userId?: number): string { return this.getNotesPrefixCacheKey(courseId) + (userId ? userId : ''); @@ -281,12 +281,12 @@ export class AddonNotesProvider { /** * Get users notes for a certain site, course and personal notes. * - * @param {number} courseId ID of the course to get the notes from. - * @param {number} [userId] ID of the user to get the notes from if requested. - * @param {boolean} [ignoreCache] True when we should not get the value from the cache. - * @param {boolean} [onlyOnline] True to return only online notes, false to return both online and offline. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise to be resolved when the notes are retrieved. + * @param courseId ID of the course to get the notes from. + * @param userId ID of the user to get the notes from if requested. + * @param ignoreCache True when we should not get the value from the cache. + * @param onlyOnline True to return only online notes, false to return both online and offline. + * @param siteId Site ID. If not defined, current site. + * @return Promise to be resolved when the notes are retrieved. */ getNotes(courseId: number, userId?: number, ignoreCache?: boolean, onlyOnline?: boolean, siteId?: string): Promise { this.logger.debug('Get notes for course ' + courseId); @@ -336,10 +336,10 @@ export class AddonNotesProvider { /** * Get offline deleted notes and set the state. * - * @param {any[]} notes Array of notes. - * @param {number} courseId ID of the course the notes belong to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} [description] + * @param notes Array of notes. + * @param courseId ID of the course the notes belong to. + * @param siteId Site ID. If not defined, current site. + * @return [description] */ setOfflineDeletedNotes(notes: any[], courseId: number, siteId?: string): Promise { return this.notesOffline.getCourseDeletedNotes(courseId, siteId).then((deletedNotes) => { @@ -354,9 +354,9 @@ export class AddonNotesProvider { /** * Get user data for notes since they only have userid. * - * @param {any[]} notes Notes to get the data for. - * @param {number} courseId ID of the course the notes belong to. - * @return {Promise} Promise always resolved. Resolve param is the formatted notes. + * @param notes Notes to get the data for. + * @param courseId ID of the course the notes belong to. + * @return Promise always resolved. Resolve param is the formatted notes. */ getNotesUserData(notes: any[], courseId: number): Promise { const promises = notes.map((note) => { @@ -377,10 +377,10 @@ export class AddonNotesProvider { /** * Invalidate get notes WS call. * - * @param {number} courseId Course ID. - * @param {number} [userId] User ID if needed. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when data is invalidated. + * @param courseId Course ID. + * @param userId User ID if needed. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when data is invalidated. */ invalidateNotes(courseId: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -395,10 +395,10 @@ export class AddonNotesProvider { /** * Report notes as being viewed. * - * @param {number} courseId ID of the course. - * @param {number} [userId] User ID if needed. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the WS call is successful. + * @param courseId ID of the course. + * @param userId User ID if needed. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the WS call is successful. */ logView(courseId: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/addon/notes/providers/sync-cron-handler.ts b/src/addon/notes/providers/sync-cron-handler.ts index dcd1ad5d6..97f50167c 100644 --- a/src/addon/notes/providers/sync-cron-handler.ts +++ b/src/addon/notes/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class AddonNotesSyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.notesSync.syncAllNotes(siteId, force); @@ -40,7 +40,7 @@ export class AddonNotesSyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return 300000; // 5 minutes. diff --git a/src/addon/notes/providers/user-handler.ts b/src/addon/notes/providers/user-handler.ts index cd9ce8015..fe713086d 100644 --- a/src/addon/notes/providers/user-handler.ts +++ b/src/addon/notes/providers/user-handler.ts @@ -42,7 +42,7 @@ export class AddonNotesUserHandler implements CoreUserProfileHandler { * Clear note cache. * If a courseId is specified, it will only delete the entry for that course. * - * @param {number} [courseId] Course ID. + * @param courseId Course ID. */ private clearNoteCache(courseId?: number): void { if (courseId) { @@ -54,7 +54,7 @@ export class AddonNotesUserHandler implements CoreUserProfileHandler { /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return this.notesProvider.isPluginEnabled(); @@ -63,11 +63,11 @@ export class AddonNotesUserHandler implements CoreUserProfileHandler { /** * Check if handler is enabled for this user in this context. * - * @param {any} user User to check. - * @param {number} courseId Course ID. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} Promise resolved with true if enabled, resolved with false otherwise. + * @param user User to check. + * @param courseId Course ID. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved with true if enabled, resolved with false otherwise. */ isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise { // Active course required. @@ -89,7 +89,7 @@ export class AddonNotesUserHandler implements CoreUserProfileHandler { /** * 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 { return { diff --git a/src/addon/notifications/components/actions/actions.ts b/src/addon/notifications/components/actions/actions.ts index c2a6f23bb..da5eece16 100644 --- a/src/addon/notifications/components/actions/actions.ts +++ b/src/addon/notifications/components/actions/actions.ts @@ -77,8 +77,8 @@ export class AddonNotificationsActionsComponent implements OnInit { /** * Default action. Open in browser. * - * @param {string} siteId Site ID to use. - * @param {NavController} [navCtrl] NavController. + * @param siteId Site ID to use. + * @param navCtrl NavController. */ protected defaultAction(siteId: string, navCtrl?: NavController): void { const url = (this.data && this.data.appurl) || this.contextUrl; diff --git a/src/addon/notifications/pages/list/list.ts b/src/addon/notifications/pages/list/list.ts index 1ab97b2be..db9153bd8 100644 --- a/src/addon/notifications/pages/list/list.ts +++ b/src/addon/notifications/pages/list/list.ts @@ -82,8 +82,8 @@ export class AddonNotificationsListPage { /** * Convenience function to get notifications. Gets unread notifications first. * - * @param {boolean} refreh Whether we're refreshing data. - * @return {Promise} Resolved when done. + * @param refreh Whether we're refreshing data. + * @return Resolved when done. */ protected fetchNotifications(refresh?: boolean): Promise { this.loadMoreError = false; @@ -128,7 +128,7 @@ export class AddonNotificationsListPage { /** * Mark notifications as read. * - * @param {any[]} notifications Array of notification objects. + * @param notifications Array of notification objects. */ protected markNotificationsAsRead(notifications: any[]): void { let promise; @@ -173,7 +173,7 @@ export class AddonNotificationsListPage { /** * Refresh notifications. * - * @param {any} [refresher] Refresher. + * @param refresher Refresher. * @return Promise Promise resolved when done. */ refreshNotifications(refresher?: any): Promise { @@ -189,7 +189,7 @@ export class AddonNotificationsListPage { /** * Load more results. * - * @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. */ loadMoreNotifications(infiniteComplete?: any): void { this.fetchNotifications().finally(() => { @@ -200,7 +200,7 @@ export class AddonNotificationsListPage { /** * Formats the text of a notification. * - * @param {any} notification The notification object. + * @param notification The notification object. */ protected formatText(notification: any): void { const text = notification.mobiletext.replace(/-{4,}/ig, ''); diff --git a/src/addon/notifications/pages/settings/settings.ts b/src/addon/notifications/pages/settings/settings.ts index 58ab72395..5754f18a2 100644 --- a/src/addon/notifications/pages/settings/settings.ts +++ b/src/addon/notifications/pages/settings/settings.ts @@ -78,7 +78,7 @@ export class AddonNotificationsSettingsPage implements OnDestroy { /** * Fetches preference data. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected fetchPreferences(): Promise { return this.notificationsProvider.getNotificationPreferences().then((preferences) => { @@ -116,7 +116,7 @@ export class AddonNotificationsSettingsPage implements OnDestroy { /** * Load a processor. * - * @param {any} processor Processor object. + * @param processor Processor object. */ protected loadProcessor(processor: any): void { if (!processor) { @@ -151,7 +151,7 @@ export class AddonNotificationsSettingsPage implements OnDestroy { /** * The selected processor was changed. * - * @param {string} name Name of the selected processor. + * @param name Name of the selected processor. */ changeProcessor(name: string): void { this.preferences.processors.forEach((processor) => { @@ -164,7 +164,7 @@ export class AddonNotificationsSettingsPage implements OnDestroy { /** * Refresh the list of preferences. * - * @param {any} [refresher] Refresher. + * @param refresher Refresher. */ refreshPreferences(refresher?: any): void { this.notificationsProvider.invalidateNotificationPreferences().finally(() => { @@ -177,7 +177,7 @@ export class AddonNotificationsSettingsPage implements OnDestroy { /** * Open extra preferences. * - * @param {AddonMessageOutputHandlerData} handlerData + * @param handlerData */ openExtraPreferences(handlerData: AddonMessageOutputHandlerData): void { // Decide which navCtrl to use. If this page is inside a split view, use the split view's master nav. @@ -188,8 +188,8 @@ export class AddonNotificationsSettingsPage implements OnDestroy { /** * Change the value of a certain preference. * - * @param {any} notification Notification object. - * @param {string} state State name, ['loggedin', 'loggedoff']. + * @param notification Notification object. + * @param state State name, ['loggedin', 'loggedoff']. */ changePreference(notification: any, state: string): void { const processorState = notification.currentProcessor[state]; @@ -243,7 +243,7 @@ export class AddonNotificationsSettingsPage implements OnDestroy { /** * Change the notification sound setting. * - * @param {enabled} enabled True to enable the notification sound, false to disable it. + * @param enabled True to enable the notification sound, false to disable it. */ changeNotificationSound(enabled: boolean): void { this.configProvider.set(CoreConstants.SETTINGS_NOTIFICATION_SOUND, enabled ? 1 : 0).finally(() => { diff --git a/src/addon/notifications/providers/cron-handler.ts b/src/addon/notifications/providers/cron-handler.ts index e7ae59f17..d191985b0 100644 --- a/src/addon/notifications/providers/cron-handler.ts +++ b/src/addon/notifications/providers/cron-handler.ts @@ -38,7 +38,7 @@ export class AddonNotificationsCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return this.appProvider.isDesktop() ? 60000 : 600000; // 1 or 10 minutes. @@ -47,7 +47,7 @@ export class AddonNotificationsCronHandler implements CoreCronHandler { /** * Check whether it's a synchronization process or not. True if not defined. * - * @return {boolean} Whether it's a synchronization process or not. + * @return Whether it's a synchronization process or not. */ isSync(): boolean { // This is done to use only wifi if using the fallback function. @@ -58,7 +58,7 @@ export class AddonNotificationsCronHandler implements CoreCronHandler { /** * Check whether the sync can be executed manually. Call isSync if not defined. * - * @return {boolean} Whether the sync can be executed manually. + * @return Whether the sync can be executed manually. */ canManualSync(): boolean { return true; @@ -68,10 +68,10 @@ export class AddonNotificationsCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. If the promise is rejected, this function - * will be called again often, it shouldn't be abused. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. If the promise is rejected, this function + * will be called again often, it shouldn't be abused. */ execute(siteId?: string, force?: boolean): Promise { if (this.sitesProvider.isCurrentSite(siteId)) { @@ -90,8 +90,8 @@ export class AddonNotificationsCronHandler implements CoreCronHandler { /** * Get the latest unread notifications from a site. * - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved with the notifications. + * @param siteId Site ID. + * @return Promise resolved with the notifications. */ protected fetchNotifications(siteId: string): Promise { return this.notificationsHelper.getNotifications([], undefined, true, false, true, siteId).then((result) => { @@ -102,8 +102,8 @@ export class AddonNotificationsCronHandler implements CoreCronHandler { /** * Given a notification, return the title and the text for the notification. * - * @param {any} notification Notification. - * @return {Promise} Promise resvoled with an object with title and text. + * @param notification Notification. + * @return Promise resvoled with an object with title and text. */ protected getTitleAndText(notification: any): Promise { const data = { diff --git a/src/addon/notifications/providers/helper.ts b/src/addon/notifications/providers/helper.ts index f9c9e80bf..442a0b1e1 100644 --- a/src/addon/notifications/providers/helper.ts +++ b/src/addon/notifications/providers/helper.ts @@ -28,13 +28,13 @@ export class AddonNotificationsHelperProvider { /** * Get some notifications. It will try to use the new WS if available. * - * @param {any[]} notifications Current list of loaded notifications. It's used to calculate the offset. - * @param {number} [limit] Number of notifications to get. Defaults to LIST_LIMIT. - * @param {boolean} [toDisplay=true] True if notifications will be displayed to the user, either in view or in a notification. - * @param {boolean} [forceCache] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [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, use current site. - * @return {Promise<{notifications: any[], canLoadMore: boolean}>} Promise resolved with notifications and if can load more. + * @param notifications Current list of loaded notifications. It's used to calculate the offset. + * @param limit Number of notifications to get. Defaults to LIST_LIMIT. + * @param toDisplay True if notifications will be displayed to the user, either in view or in a notification. + * @param forceCache True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with notifications and if can load more. */ getNotifications(notifications: any[], limit?: number, toDisplay: boolean = true, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise<{notifications: any[], canLoadMore: boolean}> { diff --git a/src/addon/notifications/providers/mainmenu-handler.ts b/src/addon/notifications/providers/mainmenu-handler.ts index a73fd6065..056ce4650 100644 --- a/src/addon/notifications/providers/mainmenu-handler.ts +++ b/src/addon/notifications/providers/mainmenu-handler.ts @@ -73,7 +73,7 @@ export class AddonNotificationsMainMenuHandler implements CoreMainMenuHandler { /** * 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 { return true; @@ -82,7 +82,7 @@ export class AddonNotificationsMainMenuHandler implements CoreMainMenuHandler { /** * 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 { if (this.handler.loading) { @@ -95,7 +95,7 @@ export class AddonNotificationsMainMenuHandler implements CoreMainMenuHandler { /** * Triggers an update for the badge number and loading status. Mandatory if showBadge is enabled. * - * @param {string} [siteId] Site ID or current Site if undefined. + * @param siteId Site ID or current Site if undefined. */ updateBadge(siteId?: string): void { siteId = siteId || this.sitesProvider.getCurrentSiteId(); diff --git a/src/addon/notifications/providers/notifications.ts b/src/addon/notifications/providers/notifications.ts index db8b5b62b..6e0af0129 100644 --- a/src/addon/notifications/providers/notifications.ts +++ b/src/addon/notifications/providers/notifications.ts @@ -47,9 +47,9 @@ export class AddonNotificationsProvider { /** * Function to format notification data. * - * @param {any[]} notifications List of notifications. - * @param {boolean} [read] Whether the notifications are read or unread. - * @return {Promise} Promise resolved with notifications. + * @param notifications List of notifications. + * @param read Whether the notifications are read or unread. + * @return Promise resolved with notifications. */ protected formatNotificationsData(notifications: any[], read?: boolean): Promise { const promises = notifications.map((notification) => { @@ -105,7 +105,7 @@ export class AddonNotificationsProvider { /** * Get the cache key for the get notification preferences call. * - * @return {string} Cache key. + * @return Cache key. */ protected getNotificationPreferencesCacheKey(): string { return this.ROOT_CACHE_KEY + 'notificationPreferences'; @@ -114,8 +114,8 @@ export class AddonNotificationsProvider { /** * Get notification preferences. * - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved with the notification preferences. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with the notification preferences. */ getNotificationPreferences(siteId?: string): Promise { this.logger.debug('Get notification preferences'); @@ -135,7 +135,7 @@ export class AddonNotificationsProvider { /** * Get cache key for notification list WS calls. * - * @return {string} Cache key. + * @return Cache key. */ protected getNotificationsCacheKey(): string { return this.ROOT_CACHE_KEY + 'list'; @@ -144,14 +144,14 @@ export class AddonNotificationsProvider { /** * Get notifications from site. * - * @param {boolean} read True if should get read notifications, false otherwise. - * @param {number} limitFrom Position of the first notification to get. - * @param {number} limitNumber Number of notifications to get or 0 to use the default limit. - * @param {boolean} [toDisplay=true] True if notifications will be displayed to the user, either in view or in a notification. - * @param {boolean} [forceCache] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [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, use current site. - * @return {Promise} Promise resolved with notifications. + * @param read True if should get read notifications, false otherwise. + * @param limitFrom Position of the first notification to get. + * @param limitNumber Number of notifications to get or 0 to use the default limit. + * @param toDisplay True if notifications will be displayed to the user, either in view or in a notification. + * @param forceCache True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with notifications. */ getNotifications(read: boolean, limitFrom: number, limitNumber: number = 0, toDisplay: boolean = true, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise { @@ -199,13 +199,13 @@ export class AddonNotificationsProvider { /** * Get notifications from site using the new WebService. * - * @param {number} offset Position of the first notification to get. - * @param {number} [limit] Number of notifications to get. Defaults to LIST_LIMIT. - * @param {boolean} [toDisplay=true] True if notifications will be displayed to the user, either in view or in a notification. - * @param {boolean} [forceCache] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [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, use current site. - * @return {Promise<{notifications: any[], canLoadMore: boolean}>} Promise resolved with notifications and if can load more. + * @param offset Position of the first notification to get. + * @param limit Number of notifications to get. Defaults to LIST_LIMIT. + * @param toDisplay True if notifications will be displayed to the user, either in view or in a notification. + * @param forceCache True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with notifications and if can load more. * @since 3.2 */ getPopupNotifications(offset: number, limit?: number, toDisplay: boolean = true, forceCache?: boolean, ignoreCache?: boolean, @@ -260,13 +260,13 @@ export class AddonNotificationsProvider { /** * Get read notifications from site. * - * @param {number} limitFrom Position of the first notification to get. - * @param {number} limitNumber Number of notifications to get. - * @param {boolean} [toDisplay=true] True if notifications will be displayed to the user, either in view or in a notification. - * @param {boolean} [forceCache] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [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, use current site. - * @return {Promise} Promise resolved with notifications. + * @param limitFrom Position of the first notification to get. + * @param limitNumber Number of notifications to get. + * @param toDisplay True if notifications will be displayed to the user, either in view or in a notification. + * @param forceCache True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with notifications. */ getReadNotifications(limitFrom: number, limitNumber: number, toDisplay: boolean = true, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise { @@ -276,13 +276,13 @@ export class AddonNotificationsProvider { /** * Get unread notifications from site. * - * @param {number} limitFrom Position of the first notification to get. - * @param {number} limitNumber Number of notifications to get. - * @param {boolean} [toDisplay=true] True if notifications will be displayed to the user, either in view or in a notification. - * @param {boolean} [forceCache] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [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, use current site. - * @return {Promise} Promise resolved with notifications. + * @param limitFrom Position of the first notification to get. + * @param limitNumber Number of notifications to get. + * @param toDisplay True if notifications will be displayed to the user, either in view or in a notification. + * @param forceCache True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with notifications. */ getUnreadNotifications(limitFrom: number, limitNumber: number, toDisplay: boolean = true, forceCache?: boolean, ignoreCache?: boolean, siteId?: string): Promise { @@ -292,9 +292,9 @@ export class AddonNotificationsProvider { /** * Get unread notifications count. Do not cache calls. * - * @param {number} [userId] The user id who received the notification. If not defined, use current user. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved with the message notifications count. + * @param userId The user id who received the notification. If not defined, use current user. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with the message notifications count. */ getUnreadNotificationsCount(userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -334,8 +334,8 @@ export class AddonNotificationsProvider { /** * Returns whether or not popup WS is available for a certain site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if available, resolved with false or rejected otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if available, resolved with false or rejected otherwise. */ isPopupAvailable(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -346,7 +346,7 @@ export class AddonNotificationsProvider { /** * Mark all message notification as read. * - * @returns {Promise} Resolved when done. + * @return Resolved when done. * @since 3.2 */ markAllNotificationsAsRead(): Promise { @@ -360,9 +360,9 @@ export class AddonNotificationsProvider { /** * Mark a single notification as read. * - * @param {number} notificationId ID of notification to mark as read - * @param {string} [siteId] Site ID. If not defined, current site. - * @returns {Promise} Resolved when done. + * @param notificationId ID of notification to mark as read + * @param siteId Site ID. If not defined, current site. + * @return Resolved when done. * @since 3.5 */ markNotificationRead(notificationId: number, siteId?: string): Promise { @@ -385,8 +385,8 @@ export class AddonNotificationsProvider { /** * Invalidate get notification preferences. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when data is invalidated. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when data is invalidated. */ invalidateNotificationPreferences(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -397,8 +397,8 @@ export class AddonNotificationsProvider { /** * Invalidates notifications list WS calls. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the list is invalidated. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the list is invalidated. */ invalidateNotificationsList(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -409,7 +409,7 @@ export class AddonNotificationsProvider { /** * Returns whether or not we can mark all notifications as read. * - * @return {boolean} True if enabled, false otherwise. + * @return True if enabled, false otherwise. * @since 3.2 */ isMarkAllNotificationsAsReadEnabled(): boolean { @@ -419,7 +419,7 @@ export class AddonNotificationsProvider { /** * Returns whether or not we can count unread notifications precisely. * - * @return {boolean} True if enabled, false otherwise. + * @return True if enabled, false otherwise. * @since 3.2 */ isPreciseNotificationCountEnabled(): boolean { @@ -429,7 +429,7 @@ export class AddonNotificationsProvider { /** * Returns whether or not the notification preferences are enabled for the current site. * - * @return {boolean} True if enabled, false otherwise. + * @return True if enabled, false otherwise. * @since 3.2 */ isNotificationPreferencesEnabled(): boolean { diff --git a/src/addon/notifications/providers/push-click-handler.ts b/src/addon/notifications/providers/push-click-handler.ts index ce39f5d17..546d151fb 100644 --- a/src/addon/notifications/providers/push-click-handler.ts +++ b/src/addon/notifications/providers/push-click-handler.ts @@ -34,8 +34,8 @@ export class AddonNotificationsPushClickHandler implements CorePushNotifications /** * Check if a notification click is handled by this handler. * - * @param {any} notification The notification to check. - * @return {boolean} Whether the notification click is handled by this handler + * @param notification The notification to check. + * @return Whether the notification click is handled by this handler */ handles(notification: any): boolean | Promise { if (this.utils.isTrueOrOne(notification.notif)) { @@ -57,8 +57,8 @@ export class AddonNotificationsPushClickHandler implements CorePushNotifications /** * Handle the notification click. * - * @param {any} notification The notification to check. - * @return {Promise} Promise resolved when done. + * @param notification The notification to check. + * @return Promise resolved when done. */ handleClick(notification: any): Promise { let promise; diff --git a/src/addon/notifications/providers/settings-handler.ts b/src/addon/notifications/providers/settings-handler.ts index 1bb8002f7..dea003ab7 100644 --- a/src/addon/notifications/providers/settings-handler.ts +++ b/src/addon/notifications/providers/settings-handler.ts @@ -33,7 +33,7 @@ export class AddonNotificationsSettingsHandler implements CoreSettingsHandler { /** * Check if the handler is enabled on a site level. * - * @return {boolean | Promise} 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 { // Preferences or notification sound setting available. @@ -44,7 +44,7 @@ export class AddonNotificationsSettingsHandler implements CoreSettingsHandler { /** * Returns the data needed to render the handler. * - * @return {CoreSettingsHandlerData} Data needed to render the handler. + * @return Data needed to render the handler. */ getDisplayData(): CoreSettingsHandlerData { return { diff --git a/src/addon/qbehaviour/adaptive/providers/handler.ts b/src/addon/qbehaviour/adaptive/providers/handler.ts index 90ad015b8..1d40c1c4f 100644 --- a/src/addon/qbehaviour/adaptive/providers/handler.ts +++ b/src/addon/qbehaviour/adaptive/providers/handler.ts @@ -34,10 +34,10 @@ export class AddonQbehaviourAdaptiveHandler implements CoreQuestionBehaviourHand * If the behaviour requires a submit button, it should add it to question.behaviourButtons. * If the behaviour requires to show some extra data, it should return the components to render it. * - * @param {Injector} injector Injector. - * @param {any} question The question. - * @return {any[]|Promise} Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @param injector Injector. + * @param question The question. + * @return Components (or promise resolved with components) to render some extra data in the question + * (e.g. certainty options). Don't return anything if no extra data is required. */ handleQuestion(injector: Injector, question: any): any[] | Promise { // Just extract the button, it doesn't need any specific component. @@ -49,7 +49,7 @@ export class AddonQbehaviourAdaptiveHandler implements CoreQuestionBehaviourHand /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/qbehaviour/adaptivenopenalty/providers/handler.ts b/src/addon/qbehaviour/adaptivenopenalty/providers/handler.ts index a8ebebb0b..f8e3ba977 100644 --- a/src/addon/qbehaviour/adaptivenopenalty/providers/handler.ts +++ b/src/addon/qbehaviour/adaptivenopenalty/providers/handler.ts @@ -34,10 +34,10 @@ export class AddonQbehaviourAdaptiveNoPenaltyHandler implements CoreQuestionBeha * If the behaviour requires a submit button, it should add it to question.behaviourButtons. * If the behaviour requires to show some extra data, it should return the components to render it. * - * @param {Injector} injector Injector. - * @param {any} question The question. - * @return {any[]|Promise} Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @param injector Injector. + * @param question The question. + * @return Components (or promise resolved with components) to render some extra data in the question + * (e.g. certainty options). Don't return anything if no extra data is required. */ handleQuestion(injector: Injector, question: any): any[] | Promise { // Just extract the button, it doesn't need any specific component. @@ -49,7 +49,7 @@ export class AddonQbehaviourAdaptiveNoPenaltyHandler implements CoreQuestionBeha /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/qbehaviour/deferredcbm/providers/handler.ts b/src/addon/qbehaviour/deferredcbm/providers/handler.ts index fb11cb208..fcb15cf3f 100644 --- a/src/addon/qbehaviour/deferredcbm/providers/handler.ts +++ b/src/addon/qbehaviour/deferredcbm/providers/handler.ts @@ -37,11 +37,11 @@ export class AddonQbehaviourDeferredCBMHandler implements CoreQuestionBehaviourH /** * Determine a question new state based on its answer(s). * - * @param {string} component Component the question belongs to. - * @param {number} attemptId Attempt ID the question belongs to. - * @param {any} question The question. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {CoreQuestionState|Promise} New state (or promise resolved with state). + * @param component Component the question belongs to. + * @param attemptId Attempt ID the question belongs to. + * @param question The question. + * @param siteId Site ID. If not defined, current site. + * @return New state (or promise resolved with state). */ determineNewState(component: string, attemptId: number, question: any, siteId?: string) : CoreQuestionState | Promise { @@ -55,10 +55,10 @@ export class AddonQbehaviourDeferredCBMHandler implements CoreQuestionBehaviourH * If the behaviour requires a submit button, it should add it to question.behaviourButtons. * If the behaviour requires to show some extra data, it should return the components to render it. * - * @param {Injector} injector Injector. - * @param {any} question The question. - * @return {any[]|Promise} Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @param injector Injector. + * @param question The question. + * @return Components (or promise resolved with components) to render some extra data in the question + * (e.g. certainty options). Don't return anything if no extra data is required. */ handleQuestion(injector: Injector, question: any): any[] | Promise { if (this.questionHelper.extractQbehaviourCBM(question)) { @@ -69,9 +69,9 @@ export class AddonQbehaviourDeferredCBMHandler implements CoreQuestionBehaviourH /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ protected isCompleteResponse(question: any, answers: any): number { // First check if the question answer is complete. @@ -87,7 +87,7 @@ export class AddonQbehaviourDeferredCBMHandler implements CoreQuestionBehaviourH /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -96,12 +96,12 @@ export class AddonQbehaviourDeferredCBMHandler implements CoreQuestionBehaviourH /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} prevBasicAnswers Object with the previous basic" answers (without sequencecheck, certainty, ...). - * @param {any} newAnswers Object with the new question answers. - * @param {any} newBasicAnswers Object with the previous basic" answers (without sequencecheck, certainty, ...). - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param prevBasicAnswers Object with the previous basic" answers (without sequencecheck, certainty, ...). + * @param newAnswers Object with the new question answers. + * @param newBasicAnswers Object with the previous basic" answers (without sequencecheck, certainty, ...). + * @return Whether they're the same. */ protected isSameResponse(question: any, prevAnswers: any, prevBasicAnswers: any, newAnswers: any, newBasicAnswers: any) : boolean { diff --git a/src/addon/qbehaviour/deferredfeedback/providers/handler.ts b/src/addon/qbehaviour/deferredfeedback/providers/handler.ts index da9052a14..e2d39cb2b 100644 --- a/src/addon/qbehaviour/deferredfeedback/providers/handler.ts +++ b/src/addon/qbehaviour/deferredfeedback/providers/handler.ts @@ -21,21 +21,21 @@ import { CoreQuestionProvider, CoreQuestionState } from '@core/question/provider /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ export type isCompleteResponseFunction = (question: any, answers: any) => number; /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} prevBasicAnswers Object with the previous basic" answers (without sequencecheck, certainty, ...). - * @param {any} newAnswers Object with the new question answers. - * @param {any} newBasicAnswers Object with the previous basic" answers (without sequencecheck, certainty, ...). - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param prevBasicAnswers Object with the previous basic" answers (without sequencecheck, certainty, ...). + * @param newAnswers Object with the new question answers. + * @param newBasicAnswers Object with the previous basic" answers (without sequencecheck, certainty, ...). + * @return Whether they're the same. */ export type isSameResponseFunction = (question: any, prevAnswers: any, prevBasicAnswers: any, newAnswers: any, newBasicAnswers: any) => boolean; @@ -55,11 +55,11 @@ export class AddonQbehaviourDeferredFeedbackHandler implements CoreQuestionBehav /** * Determine a question new state based on its answer(s). * - * @param {string} component Component the question belongs to. - * @param {number} attemptId Attempt ID the question belongs to. - * @param {any} question The question. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {CoreQuestionState|Promise} New state (or promise resolved with state). + * @param component Component the question belongs to. + * @param attemptId Attempt ID the question belongs to. + * @param question The question. + * @param siteId Site ID. If not defined, current site. + * @return New state (or promise resolved with state). */ determineNewState(component: string, attemptId: number, question: any, siteId?: string) : CoreQuestionState | Promise { @@ -69,13 +69,13 @@ export class AddonQbehaviourDeferredFeedbackHandler implements CoreQuestionBehav /** * Determine a question new state based on its answer(s) for deferred question behaviour. * - * @param {string} component Component the question belongs to. - * @param {number} attemptId Attempt ID the question belongs to. - * @param {any} question The question. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {isCompleteResponseFunction} [isCompleteFn] Function to override the default isCompleteResponse check. - * @param {isSameResponseFunction} [isSameFn] Function to override the default isSameResponse check. - * @return {Promise} Promise resolved with state. + * @param component Component the question belongs to. + * @param attemptId Attempt ID the question belongs to. + * @param question The question. + * @param siteId Site ID. If not defined, current site. + * @param isCompleteFn Function to override the default isCompleteResponse check. + * @param isSameFn Function to override the default isSameResponse check. + * @return Promise resolved with state. */ determineNewStateDeferred(component: string, attemptId: number, question: any, siteId?: string, isCompleteFn?: isCompleteResponseFunction, isSameFn?: isSameResponseFunction): Promise { @@ -146,7 +146,7 @@ export class AddonQbehaviourDeferredFeedbackHandler implements CoreQuestionBehav /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/qbehaviour/immediatecbm/providers/handler.ts b/src/addon/qbehaviour/immediatecbm/providers/handler.ts index 4e1aa9ce4..4d26069ed 100644 --- a/src/addon/qbehaviour/immediatecbm/providers/handler.ts +++ b/src/addon/qbehaviour/immediatecbm/providers/handler.ts @@ -35,10 +35,10 @@ export class AddonQbehaviourImmediateCBMHandler implements CoreQuestionBehaviour * If the behaviour requires a submit button, it should add it to question.behaviourButtons. * If the behaviour requires to show some extra data, it should return the components to render it. * - * @param {Injector} injector Injector. - * @param {any} question The question. - * @return {any[]|Promise} Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @param injector Injector. + * @param question The question. + * @return Components (or promise resolved with components) to render some extra data in the question + * (e.g. certainty options). Don't return anything if no extra data is required. */ handleQuestion(injector: Injector, question: any): any[] | Promise { // Just extract the button, it doesn't need any specific component. @@ -52,7 +52,7 @@ export class AddonQbehaviourImmediateCBMHandler implements CoreQuestionBehaviour /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/qbehaviour/immediatefeedback/providers/handler.ts b/src/addon/qbehaviour/immediatefeedback/providers/handler.ts index 2103bba6c..0040878ea 100644 --- a/src/addon/qbehaviour/immediatefeedback/providers/handler.ts +++ b/src/addon/qbehaviour/immediatefeedback/providers/handler.ts @@ -34,10 +34,10 @@ export class AddonQbehaviourImmediateFeedbackHandler implements CoreQuestionBeha * If the behaviour requires a submit button, it should add it to question.behaviourButtons. * If the behaviour requires to show some extra data, it should return the components to render it. * - * @param {Injector} injector Injector. - * @param {any} question The question. - * @return {any[]|Promise} Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @param injector Injector. + * @param question The question. + * @return Components (or promise resolved with components) to render some extra data in the question + * (e.g. certainty options). Don't return anything if no extra data is required. */ handleQuestion(injector: Injector, question: any): any[] | Promise { // Just extract the button, it doesn't need any specific component. @@ -49,7 +49,7 @@ export class AddonQbehaviourImmediateFeedbackHandler implements CoreQuestionBeha /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/qbehaviour/informationitem/providers/handler.ts b/src/addon/qbehaviour/informationitem/providers/handler.ts index 21d7181ed..f8f46f6e6 100644 --- a/src/addon/qbehaviour/informationitem/providers/handler.ts +++ b/src/addon/qbehaviour/informationitem/providers/handler.ts @@ -32,11 +32,11 @@ export class AddonQbehaviourInformationItemHandler implements CoreQuestionBehavi /** * Determine a question new state based on its answer(s). * - * @param {string} component Component the question belongs to. - * @param {number} attemptId Attempt ID the question belongs to. - * @param {any} question The question. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {CoreQuestionState|Promise} New state (or promise resolved with state). + * @param component Component the question belongs to. + * @param attemptId Attempt ID the question belongs to. + * @param question The question. + * @param siteId Site ID. If not defined, current site. + * @return New state (or promise resolved with state). */ determineNewState(component: string, attemptId: number, question: any, siteId?: string) : CoreQuestionState | Promise { @@ -52,10 +52,10 @@ export class AddonQbehaviourInformationItemHandler implements CoreQuestionBehavi * If the behaviour requires a submit button, it should add it to question.behaviourButtons. * If the behaviour requires to show some extra data, it should return the components to render it. * - * @param {Injector} injector Injector. - * @param {any} question The question. - * @return {any[]|Promise} Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @param injector Injector. + * @param question The question. + * @return Components (or promise resolved with components) to render some extra data in the question + * (e.g. certainty options). Don't return anything if no extra data is required. */ handleQuestion(injector: Injector, question: any): any[] | Promise { if (this.questionHelper.extractQbehaviourSeenInput(question)) { @@ -66,7 +66,7 @@ export class AddonQbehaviourInformationItemHandler implements CoreQuestionBehavi /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/qbehaviour/interactive/providers/handler.ts b/src/addon/qbehaviour/interactive/providers/handler.ts index 5504da1cc..6c25c2923 100644 --- a/src/addon/qbehaviour/interactive/providers/handler.ts +++ b/src/addon/qbehaviour/interactive/providers/handler.ts @@ -34,10 +34,10 @@ export class AddonQbehaviourInteractiveHandler implements CoreQuestionBehaviourH * If the behaviour requires a submit button, it should add it to question.behaviourButtons. * If the behaviour requires to show some extra data, it should return the components to render it. * - * @param {Injector} injector Injector. - * @param {any} question The question. - * @return {any[]|Promise} Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @param injector Injector. + * @param question The question. + * @return Components (or promise resolved with components) to render some extra data in the question + * (e.g. certainty options). Don't return anything if no extra data is required. */ handleQuestion(injector: Injector, question: any): any[] | Promise { // Just extract the button, it doesn't need any specific component. @@ -49,7 +49,7 @@ export class AddonQbehaviourInteractiveHandler implements CoreQuestionBehaviourH /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/qbehaviour/interactivecountback/providers/handler.ts b/src/addon/qbehaviour/interactivecountback/providers/handler.ts index 54646e427..0cebc7103 100644 --- a/src/addon/qbehaviour/interactivecountback/providers/handler.ts +++ b/src/addon/qbehaviour/interactivecountback/providers/handler.ts @@ -34,10 +34,10 @@ export class AddonQbehaviourInteractiveCountbackHandler implements CoreQuestionB * If the behaviour requires a submit button, it should add it to question.behaviourButtons. * If the behaviour requires to show some extra data, it should return the components to render it. * - * @param {Injector} injector Injector. - * @param {any} question The question. - * @return {any[]|Promise} Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @param injector Injector. + * @param question The question. + * @return Components (or promise resolved with components) to render some extra data in the question + * (e.g. certainty options). Don't return anything if no extra data is required. */ handleQuestion(injector: Injector, question: any): any[] | Promise { // Just extract the button, it doesn't need any specific component. @@ -49,7 +49,7 @@ export class AddonQbehaviourInteractiveCountbackHandler implements CoreQuestionB /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/qbehaviour/manualgraded/providers/handler.ts b/src/addon/qbehaviour/manualgraded/providers/handler.ts index 91d767af4..62c08d2b1 100644 --- a/src/addon/qbehaviour/manualgraded/providers/handler.ts +++ b/src/addon/qbehaviour/manualgraded/providers/handler.ts @@ -21,21 +21,21 @@ import { CoreQuestionProvider, CoreQuestionState } from '@core/question/provider /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ export type isCompleteResponseFunction = (question: any, answers: any) => number; /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} prevBasicAnswers Object with the previous basic" answers (without sequencecheck, certainty, ...). - * @param {any} newAnswers Object with the new question answers. - * @param {any} newBasicAnswers Object with the previous basic" answers (without sequencecheck, certainty, ...). - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param prevBasicAnswers Object with the previous basic" answers (without sequencecheck, certainty, ...). + * @param newAnswers Object with the new question answers. + * @param newBasicAnswers Object with the previous basic" answers (without sequencecheck, certainty, ...). + * @return Whether they're the same. */ export type isSameResponseFunction = (question: any, prevAnswers: any, prevBasicAnswers: any, newAnswers: any, newBasicAnswers: any) => boolean; @@ -55,11 +55,11 @@ export class AddonQbehaviourManualGradedHandler implements CoreQuestionBehaviour /** * Determine a question new state based on its answer(s). * - * @param {string} component Component the question belongs to. - * @param {number} attemptId Attempt ID the question belongs to. - * @param {any} question The question. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {CoreQuestionState|Promise} New state (or promise resolved with state). + * @param component Component the question belongs to. + * @param attemptId Attempt ID the question belongs to. + * @param question The question. + * @param siteId Site ID. If not defined, current site. + * @return New state (or promise resolved with state). */ determineNewState(component: string, attemptId: number, question: any, siteId?: string) : CoreQuestionState | Promise { @@ -69,13 +69,13 @@ export class AddonQbehaviourManualGradedHandler implements CoreQuestionBehaviour /** * Determine a question new state based on its answer(s) for manual graded question behaviour. * - * @param {string} component Component the question belongs to. - * @param {number} attemptId Attempt ID the question belongs to. - * @param {any} question The question. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {isCompleteResponseFunction} [isCompleteFn] Function to override the default isCompleteResponse check. - * @param {isSameResponseFunction} [isSameFn] Function to override the default isSameResponse check. - * @return {Promise} Promise resolved with state. + * @param component Component the question belongs to. + * @param attemptId Attempt ID the question belongs to. + * @param question The question. + * @param siteId Site ID. If not defined, current site. + * @param isCompleteFn Function to override the default isCompleteResponse check. + * @param isSameFn Function to override the default isSameResponse check. + * @return Promise resolved with state. */ determineNewStateManualGraded(component: string, attemptId: number, question: any, siteId?: string, isCompleteFn?: isCompleteResponseFunction, isSameFn?: isSameResponseFunction): Promise { @@ -139,7 +139,7 @@ export class AddonQbehaviourManualGradedHandler implements CoreQuestionBehaviour /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/addon/qtype/calculated/providers/handler.ts b/src/addon/qtype/calculated/providers/handler.ts index 0874fbc82..12ab450e8 100644 --- a/src/addon/qtype/calculated/providers/handler.ts +++ b/src/addon/qtype/calculated/providers/handler.ts @@ -33,9 +33,9 @@ export class AddonQtypeCalculatedHandler implements CoreQuestionHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise { return AddonQtypeCalculatedComponent; @@ -44,9 +44,9 @@ export class AddonQtypeCalculatedHandler implements CoreQuestionHandler { /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse(question: any, answers: any): number { if (this.isGradableResponse(question, answers) === 0 || !this.validateUnits(answers['answer'])) { @@ -63,7 +63,7 @@ export class AddonQtypeCalculatedHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -73,9 +73,9 @@ export class AddonQtypeCalculatedHandler implements CoreQuestionHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse(question: any, answers: any): number { let isGradable = this.isValidValue(answers['answer']); @@ -90,10 +90,10 @@ export class AddonQtypeCalculatedHandler implements CoreQuestionHandler { /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse(question: any, prevAnswers: any, newAnswers: any): boolean { return this.utils.sameAtKeyMissingIsBlank(prevAnswers, newAnswers, 'answer') && @@ -103,8 +103,8 @@ export class AddonQtypeCalculatedHandler implements CoreQuestionHandler { /** * Check if a value is valid (not empty). * - * @param {string|number} value Value to check. - * @return {boolean} Whether the value is valid. + * @param value Value to check. + * @return Whether the value is valid. */ isValidValue(value: string | number): boolean { return !!value || value === '0' || value === 0; @@ -113,8 +113,8 @@ export class AddonQtypeCalculatedHandler implements CoreQuestionHandler { /** * Check if a question requires units in a separate input. * - * @param {any} question The question. - * @return {boolean} Whether the question requires units. + * @param question The question. + * @return Whether the question requires units. */ requiresUnits(question: any): boolean { const element = this.domUtils.convertToElement(question.html); @@ -126,8 +126,8 @@ export class AddonQtypeCalculatedHandler implements CoreQuestionHandler { * Validate a number with units. We don't have the list of valid units and conversions, so we can't perform * a full validation. If this function returns true it means we can't be sure it's valid. * - * @param {string} answer Answer. - * @return {boolean} False if answer isn't valid, true if we aren't sure if it's valid. + * @param answer Answer. + * @return False if answer isn't valid, true if we aren't sure if it's valid. */ validateUnits(answer: string): boolean { if (!answer) { diff --git a/src/addon/qtype/calculatedmulti/providers/handler.ts b/src/addon/qtype/calculatedmulti/providers/handler.ts index 3cbe18057..9baf71fc0 100644 --- a/src/addon/qtype/calculatedmulti/providers/handler.ts +++ b/src/addon/qtype/calculatedmulti/providers/handler.ts @@ -32,9 +32,9 @@ export class AddonQtypeCalculatedMultiHandler implements CoreQuestionHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise { // Calculated multi behaves like a multichoice, use the same component. @@ -44,9 +44,9 @@ export class AddonQtypeCalculatedMultiHandler implements CoreQuestionHandler { /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse(question: any, answers: any): number { // This question type depends on multichoice. @@ -56,7 +56,7 @@ export class AddonQtypeCalculatedMultiHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -66,9 +66,9 @@ export class AddonQtypeCalculatedMultiHandler implements CoreQuestionHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse(question: any, answers: any): number { // This question type depends on multichoice. @@ -78,10 +78,10 @@ export class AddonQtypeCalculatedMultiHandler implements CoreQuestionHandler { /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse(question: any, prevAnswers: any, newAnswers: any): boolean { // This question type depends on multichoice. diff --git a/src/addon/qtype/calculatedsimple/providers/handler.ts b/src/addon/qtype/calculatedsimple/providers/handler.ts index 2aaaf1c9c..2e9e85062 100644 --- a/src/addon/qtype/calculatedsimple/providers/handler.ts +++ b/src/addon/qtype/calculatedsimple/providers/handler.ts @@ -32,9 +32,9 @@ export class AddonQtypeCalculatedSimpleHandler implements CoreQuestionHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise { // Calculated simple behaves like a calculated, use the same component. @@ -44,9 +44,9 @@ export class AddonQtypeCalculatedSimpleHandler implements CoreQuestionHandler { /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse(question: any, answers: any): number { // This question type depends on calculated. @@ -56,7 +56,7 @@ export class AddonQtypeCalculatedSimpleHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -66,9 +66,9 @@ export class AddonQtypeCalculatedSimpleHandler implements CoreQuestionHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse(question: any, answers: any): number { // This question type depends on calculated. @@ -78,10 +78,10 @@ export class AddonQtypeCalculatedSimpleHandler implements CoreQuestionHandler { /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse(question: any, prevAnswers: any, newAnswers: any): boolean { // This question type depends on calculated. diff --git a/src/addon/qtype/ddimageortext/classes/ddimageortext.ts b/src/addon/qtype/ddimageortext/classes/ddimageortext.ts index 88f5c9e18..df0b3eb89 100644 --- a/src/addon/qtype/ddimageortext/classes/ddimageortext.ts +++ b/src/addon/qtype/ddimageortext/classes/ddimageortext.ts @@ -50,12 +50,12 @@ export class AddonQtypeDdImageOrTextQuestion { /** * Create the this. * - * @param {CoreLoggerProvider} logger Logger provider. - * @param {CoreDomUtilsProvider} domUtils Dom Utils provider. - * @param {HTMLElement} container The container HTMLElement of the question. - * @param {any} question The question this. - * @param {boolean} readOnly Whether it's read only. - * @param {any[]} drops The drop zones received in the init object of the question. + * @param logger Logger provider. + * @param domUtils Dom Utils provider. + * @param container The container HTMLElement of the question. + * @param question The question this. + * @param readOnly Whether it's read only. + * @param drops The drop zones received in the init object of the question. */ constructor(logger: CoreLoggerProvider, protected domUtils: CoreDomUtilsProvider, protected container: HTMLElement, protected question: any, protected readOnly: boolean, protected drops: any[]) { @@ -80,8 +80,8 @@ export class AddonQtypeDdImageOrTextQuestion { /** * Convert the X and Y position of the BG IMG to a position relative to the window. * - * @param {number[]} bgImgXY X and Y of the BG IMG relative position. - * @return {number[]} Position relative to the window. + * @param bgImgXY X and Y of the BG IMG relative position. + * @return Position relative to the window. */ convertToWindowXY(bgImgXY: number[]): number[] { const bgImg = this.doc.bgImg(), @@ -192,8 +192,8 @@ export class AddonQtypeDdImageOrTextQuestion { /** * Returns an object to encapsulate operations on dd area. * - * @param {number} slot The question slot. - * @return {AddonQtypeDdImageOrTextQuestionDocStructure} The object. + * @param slot The question slot. + * @return The object. */ docStructure(slot: number): AddonQtypeDdImageOrTextQuestionDocStructure { const topNode = this.container.querySelector('.addon-qtype-ddimageortext-container'), @@ -323,9 +323,9 @@ export class AddonQtypeDdImageOrTextQuestion { /** * Make an element draggable. * - * @param {HTMLElement} drag Element to make draggable. - * @param {number} group Group the element belongs to. - * @param {number} choice Choice the element belongs to. + * @param drag Element to make draggable. + * @param group Group the element belongs to. + * @param choice Choice the element belongs to. */ draggableForQuestion(drag: HTMLElement, group: number, choice: number): void { // Set attributes. @@ -348,7 +348,7 @@ export class AddonQtypeDdImageOrTextQuestion { /** * Function called when a drop zone is clicked. * - * @param {HTMLElement} dropNode Drop element. + * @param dropNode Drop element. */ dropClick(dropNode: HTMLElement): void { const drag = this.selected; @@ -368,9 +368,9 @@ export class AddonQtypeDdImageOrTextQuestion { /** * Get all the draggable elements for a choice and a drop zone. * - * @param {number} choice Choice number. - * @param {HTMLElement} drop Drop zone. - * @return {HTMLElement[]} Draggable elements. + * @param choice Choice number. + * @param drop Drop zone. + * @return Draggable elements. */ getChoicesForDrop(choice: number, drop: HTMLElement): HTMLElement[] { return Array.from(this.doc.topNode().querySelectorAll( @@ -380,9 +380,9 @@ export class AddonQtypeDdImageOrTextQuestion { /** * Get an unplaced draggable element that belongs to a certain choice and drop zone. * - * @param {number} choice Choice number. - * @param {HTMLElement} drop Drop zone. - * @return {HTMLElement} Unplaced draggable element. + * @param choice Choice number. + * @param drop Drop zone. + * @return Unplaced draggable element. */ getUnplacedChoiceForDrop(choice: number, drop: HTMLElement): HTMLElement { const dragItems = this.getChoicesForDrop(choice, drop); @@ -443,7 +443,7 @@ export class AddonQtypeDdImageOrTextQuestion { /** * Initialize the question. * - * @param {any} question Question. + * @param question Question. */ initializer(question: any): void { this.doc = this.docStructure(question.slot); @@ -517,8 +517,8 @@ export class AddonQtypeDdImageOrTextQuestion { /** * Place a draggable element into a certain drop zone. * - * @param {HTMLElement} drag Draggable element. - * @param {HTMLElement} drop Drop zone element. + * @param drag Draggable element. + * @param drop Drop zone element. */ placeDragInDrop(drag: HTMLElement, drop: HTMLElement): void { // Search the input related to the drop zone. @@ -568,7 +568,7 @@ export class AddonQtypeDdImageOrTextQuestion { /** * Remove a draggable element from the drop zone where it is. * - * @param {HTMLElement} drag Draggable element to remove. + * @param drag Draggable element to remove. */ removeDragFromDrop(drag: HTMLElement): void { // Check if the draggable element is assigned to an input. If so, empty the input's value. @@ -670,7 +670,7 @@ export class AddonQtypeDdImageOrTextQuestion { /** * Mark a draggable element as selected. * - * @param {HTMLElement} drag Element to select. + * @param drag Element to select. */ selectDrag(drag: HTMLElement): void { // Deselect previous ones. @@ -690,7 +690,7 @@ export class AddonQtypeDdImageOrTextQuestion { /** * Update the padding of all items in a group to make them all have the same width and height. * - * @param {number} groupNo The group number. + * @param groupNo The group number. */ updatePaddingSizeForGroup(groupNo: number): void { diff --git a/src/addon/qtype/ddimageortext/providers/handler.ts b/src/addon/qtype/ddimageortext/providers/handler.ts index 6cdf63057..73b571027 100644 --- a/src/addon/qtype/ddimageortext/providers/handler.ts +++ b/src/addon/qtype/ddimageortext/providers/handler.ts @@ -32,9 +32,9 @@ export class AddonQtypeDdImageOrTextHandler implements CoreQuestionHandler { * Return the name of the behaviour to use for the question. * If the question should use the default behaviour you shouldn't implement this function. * - * @param {any} question The question. - * @param {string} behaviour The default behaviour. - * @return {string} The behaviour to use. + * @param question The question. + * @param behaviour The default behaviour. + * @return The behaviour to use. */ getBehaviour(question: any, behaviour: string): string { if (behaviour === 'interactive') { @@ -48,9 +48,9 @@ export class AddonQtypeDdImageOrTextHandler implements CoreQuestionHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise { return AddonQtypeDdImageOrTextComponent; @@ -59,9 +59,9 @@ export class AddonQtypeDdImageOrTextHandler implements CoreQuestionHandler { /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse(question: any, answers: any): number { // An answer is complete if all drop zones have an answer. @@ -79,7 +79,7 @@ export class AddonQtypeDdImageOrTextHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -89,9 +89,9 @@ export class AddonQtypeDdImageOrTextHandler implements CoreQuestionHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse(question: any, answers: any): number { for (const name in answers) { @@ -107,10 +107,10 @@ export class AddonQtypeDdImageOrTextHandler implements CoreQuestionHandler { /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse(question: any, prevAnswers: any, newAnswers: any): boolean { return this.questionProvider.compareAllAnswers(prevAnswers, newAnswers); diff --git a/src/addon/qtype/ddmarker/classes/ddmarker.ts b/src/addon/qtype/ddmarker/classes/ddmarker.ts index f303d5c1b..2e279a5fb 100644 --- a/src/addon/qtype/ddmarker/classes/ddmarker.ts +++ b/src/addon/qtype/ddmarker/classes/ddmarker.ts @@ -58,14 +58,14 @@ export class AddonQtypeDdMarkerQuestion { /** * Create the instance. * - * @param {CoreLoggerProvider} logger Logger provider. - * @param {CoreDomUtilsProvider} domUtils Dom Utils provider. - * @param {CoreTextUtilsProvider} textUtils Text Utils provider. - * @param {HTMLElement} container The container HTMLElement of the question. - * @param {any} question The question instance. - * @param {boolean} readOnly Whether it's read only. - * @param {any[]} dropZones The drop zones received in the init object of the question. - * @param {string} [imgSrc] Background image source (3.6+ sites). + * @param logger Logger provider. + * @param domUtils Dom Utils provider. + * @param textUtils Text Utils provider. + * @param container The container HTMLElement of the question. + * @param question The question instance. + * @param readOnly Whether it's read only. + * @param dropZones The drop zones received in the init object of the question. + * @param imgSrc Background image source (3.6+ sites). */ constructor(logger: CoreLoggerProvider, protected domUtils: CoreDomUtilsProvider, protected textUtils: CoreTextUtilsProvider, protected container: HTMLElement, protected question: any, protected readOnly: boolean, protected dropZones: any[], @@ -93,9 +93,9 @@ export class AddonQtypeDdMarkerQuestion { /** * Create a new draggable element cloning a certain element. * - * @param {HTMLElement} dragHome The element to clone. - * @param {number} itemNo The number of the new item. - * @return {HTMLElement} The new element. + * @param dragHome The element to clone. + * @param itemNo The number of the new item. + * @return The new element. */ cloneNewDragItem(dragHome: HTMLElement, itemNo: number): HTMLElement { const marker = dragHome.querySelector('span.markertext'); @@ -119,8 +119,8 @@ export class AddonQtypeDdMarkerQuestion { /** * Convert the X and Y position of the BG IMG to a position relative to the window. * - * @param {number[]} bgImgXY X and Y of the BG IMG relative position. - * @return {number[]} Position relative to the window. + * @param bgImgXY X and Y of the BG IMG relative position. + * @return Position relative to the window. */ convertToWindowXY(bgImgXY: number[]): number[] { const bgImg = this.doc.bgImg(), @@ -136,8 +136,8 @@ export class AddonQtypeDdMarkerQuestion { /** * Check if some coordinates (X, Y) are inside the background image. * - * @param {number[]} coords Coordinates to check. - * @return {boolean} Whether they're inside the background image. + * @param coords Coordinates to check. + * @return Whether they're inside the background image. */ coordsInImg(coords: number[]): boolean { const bgImg = this.doc.bgImg(); @@ -168,8 +168,8 @@ export class AddonQtypeDdMarkerQuestion { /** * Returns an object to encapsulate operations on dd area. * - * @param {number} slot The question slot. - * @return {AddonQtypeDdMarkerQuestionDocStructure} The object. + * @param slot The question slot. + * @return The object. */ docStructure(slot: number): AddonQtypeDdMarkerQuestionDocStructure { const topNode = this.container.querySelector('.addon-qtype-ddmarker-container'), @@ -235,7 +235,7 @@ export class AddonQtypeDdMarkerQuestion { /** * Make an element "draggable". In the mobile app, items are "dragged" using tap and drop. * - * @param {HTMLElement} drag Element. + * @param drag Element. */ draggable(drag: HTMLElement): void { drag.addEventListener('click', (e) => { @@ -272,8 +272,8 @@ export class AddonQtypeDdMarkerQuestion { /** * Get the coordinates of the drag home of a certain choice. * - * @param {number} choiceNo Choice number. - * @return {number[]} Coordinates. + * @param choiceNo Choice number. + * @return Coordinates. */ dragHomeXY(choiceNo: number): number[] { const dragItemHome = this.doc.dragItemHome(choiceNo), @@ -285,11 +285,11 @@ export class AddonQtypeDdMarkerQuestion { /** * Draw a drop zone. * - * @param {number} dropZoneNo Number of the drop zone. - * @param {string} markerText The marker text to set. - * @param {string} shape Name of the shape of the drop zone (circle, rectangle, polygon). - * @param {string} coords Coordinates of the shape. - * @param {string} colour Colour of the shape. + * @param dropZoneNo Number of the drop zone. + * @param markerText The marker text to set. + * @param shape Name of the shape of the drop zone (circle, rectangle, polygon). + * @param coords Coordinates of the shape. + * @param colour Colour of the shape. */ drawDropZone(dropZoneNo: number, markerText: string, shape: string, coords: string, colour: string): void { let existingMarkerText: HTMLElement; @@ -363,10 +363,10 @@ export class AddonQtypeDdMarkerQuestion { /** * Draw a circle in a drop zone. * - * @param {number} dropZoneNo Number of the drop zone. - * @param {string} coords Coordinates of the circle. - * @param {string} colour Colour of the circle. - * @return {number[]} X and Y position of the center of the circle. + * @param dropZoneNo Number of the drop zone. + * @param coords Coordinates of the circle. + * @param colour Colour of the circle. + * @return X and Y position of the center of the circle. */ drawShapeCircle(dropZoneNo: number, coords: string, colour: string): number[] { // Extract the numbers in the coordinates. @@ -404,10 +404,10 @@ export class AddonQtypeDdMarkerQuestion { /** * Draw a rectangle in a drop zone. * - * @param {number} dropZoneNo Number of the drop zone. - * @param {string} coords Coordinates of the rectangle. - * @param {string} colour Colour of the rectangle. - * @return {number[]} X and Y position of the center of the rectangle. + * @param dropZoneNo Number of the drop zone. + * @param coords Coordinates of the rectangle. + * @param colour Colour of the rectangle. + * @return X and Y position of the center of the rectangle. */ drawShapeRectangle(dropZoneNo: number, coords: string, colour: string): number[] { // Extract the numbers in the coordinates. @@ -446,10 +446,10 @@ export class AddonQtypeDdMarkerQuestion { /** * Draw a polygon in a drop zone. * - * @param {number} dropZoneNo Number of the drop zone. - * @param {string} coords Coordinates of the polygon. - * @param {string} colour Colour of the polygon. - * @return {number[]} X and Y position of the center of the polygon. + * @param dropZoneNo Number of the drop zone. + * @param coords Coordinates of the polygon. + * @param colour Colour of the polygon. + * @return X and Y position of the center of the polygon. */ drawShapePolygon(dropZoneNo: number, coords: string, colour: string): number[] { const coordsParts = coords.split(';'), @@ -497,8 +497,8 @@ export class AddonQtypeDdMarkerQuestion { /** * Drop a drag element into a certain position. * - * @param {HTMLElement} drag The element to drop. - * @param {number[]} position Position to drop to (X, Y). + * @param drag The element to drop. + * @param position Position to drop to (X, Y). */ dropDrag(drag: HTMLElement, position: number[]): void { const choiceNo = this.getChoiceNoForNode(drag); @@ -522,8 +522,8 @@ export class AddonQtypeDdMarkerQuestion { * Determine which drag items need to be shown and return coords of all drag items except any that are currently being * dragged based on contents of hidden inputs and whether drags are 'infinite' or how many drags should be shown. * - * @param {HTMLElement} input The input element. - * @return {number[][]} List of coordinates. + * @param input The input element. + * @return List of coordinates. */ getCoords(input: HTMLElement): number[][] { const choiceNo = this.getChoiceNoForNode(input), @@ -557,8 +557,8 @@ export class AddonQtypeDdMarkerQuestion { /** * Get the choice number from an HTML element. * - * @param {HTMLElement} node Element to check. - * @return {number} Choice number. + * @param node Element to check. + * @return Choice number. */ getChoiceNoForNode(node: HTMLElement): number { return Number(this.doc.getClassnameNumericSuffix(node, 'choice')); @@ -567,8 +567,8 @@ export class AddonQtypeDdMarkerQuestion { /** * Get the coordinates (X, Y) of a draggable element. * - * @param {HTMLElement} dragItem The draggable item. - * @return {number[]} Coordinates. + * @param dragItem The draggable item. + * @return Coordinates. */ getDragXY(dragItem: HTMLElement): number[] { const position = this.domUtils.getElementXY(dragItem, null, 'ddarea'), @@ -593,8 +593,8 @@ export class AddonQtypeDdMarkerQuestion { /** * Get the item number from an HTML element. * - * @param {HTMLElement} node Element to check. - * @return {number} Choice number. + * @param node Element to check. + * @return Choice number. */ getItemNoForNode(node: HTMLElement): number { return Number(this.doc.getClassnameNumericSuffix(node, 'item')); @@ -603,7 +603,7 @@ export class AddonQtypeDdMarkerQuestion { /** * Get the next colour. * - * @return {string} Colour. + * @return Colour. */ getNextColour(): string { const colour = this.COLOURS[this.nextColourIndex]; @@ -620,8 +620,8 @@ export class AddonQtypeDdMarkerQuestion { /** * Get the number of drags from an HTML element. * - * @param {HTMLElement} node Element to check. - * @return {number} Choice number. + * @param node Element to check. + * @return Choice number. */ getNoOfDragsForNode(node: HTMLElement): number { return Number(this.doc.getClassnameNumericSuffix(node, 'noofdrags')); @@ -630,7 +630,7 @@ export class AddonQtypeDdMarkerQuestion { /** * Initialize the question. * - * @param {any} question Question. + * @param question Question. */ initializer(question: any): void { this.doc = this.docStructure(question.slot); @@ -800,7 +800,7 @@ export class AddonQtypeDdMarkerQuestion { /** * Reset the coordinates stored for a choice. * - * @param {number} choiceNo Choice number. + * @param choiceNo Choice number. */ resetDragXY(choiceNo: number): void { this.setFormValue(choiceNo, ''); @@ -816,9 +816,9 @@ export class AddonQtypeDdMarkerQuestion { /** * Save all the coordinates of a choice into the right input. * - * @param {number} choiceNo Number of the choice. - * @param {HTMLElement} dropped Element being dropped. - * @param {number[]} position Position where the element is dropped. + * @param choiceNo Number of the choice. + * @param dropped Element being dropped. + * @param position Position where the element is dropped. */ saveAllXYForChoice(choiceNo: number, dropped: HTMLElement, position: number[]): void { const coords = []; @@ -860,8 +860,8 @@ export class AddonQtypeDdMarkerQuestion { /** * Save a certain value in the input of a choice. * - * @param {number} choiceNo Choice number. - * @param {string} value The value to set. + * @param choiceNo Choice number. + * @param value The value to set. */ setFormValue(choiceNo: number, value: string): void { this.doc.inputForChoice(choiceNo).setAttribute('value', value); @@ -870,7 +870,7 @@ export class AddonQtypeDdMarkerQuestion { /** * Select a draggable element. * - * @param {HTMLElement} drag Element. + * @param drag Element. */ selectDrag(drag: HTMLElement): void { // Deselect previous drags. diff --git a/src/addon/qtype/ddmarker/classes/graphics_api.ts b/src/addon/qtype/ddmarker/classes/graphics_api.ts index a03df9a76..ae75138fc 100644 --- a/src/addon/qtype/ddmarker/classes/graphics_api.ts +++ b/src/addon/qtype/ddmarker/classes/graphics_api.ts @@ -26,17 +26,17 @@ export class AddonQtypeDdMarkerGraphicsApi { /** * Create the instance. * - * @param {AddonQtypeDdMarkerQuestion} instance Question instance. - * @param {CoreDomUtilsProvider} domUtils Dom Utils provider. + * @param instance Question instance. + * @param domUtils Dom Utils provider. */ constructor(protected instance: AddonQtypeDdMarkerQuestion, protected domUtils: CoreDomUtilsProvider) { } /** * Add a shape. * - * @param {{type: string, color: string}} shapeAttribs Attributes for the shape: type and color. - * @param {{[name: string]: number|string} styles Object with the styles for the shape (name -> value). - * @return {Element} The new shape. + * @param shapeAttribs Attributes for the shape: type and color. + * @param styles Object with the styles for the shape (name -> value). + * @return The new shape. */ addShape(shapeAttribs: {type: string, color: string}, styles: {[name: string]: number | string}): Element { const shape = document.createElementNS(this.NS, shapeAttribs.type); diff --git a/src/addon/qtype/ddmarker/providers/handler.ts b/src/addon/qtype/ddmarker/providers/handler.ts index 38ecfd1ba..c2220a45e 100644 --- a/src/addon/qtype/ddmarker/providers/handler.ts +++ b/src/addon/qtype/ddmarker/providers/handler.ts @@ -33,9 +33,9 @@ export class AddonQtypeDdMarkerHandler implements CoreQuestionHandler { * Return the name of the behaviour to use for the question. * If the question should use the default behaviour you shouldn't implement this function. * - * @param {any} question The question. - * @param {string} behaviour The default behaviour. - * @return {string} The behaviour to use. + * @param question The question. + * @param behaviour The default behaviour. + * @return The behaviour to use. */ getBehaviour(question: any, behaviour: string): string { if (behaviour === 'interactive') { @@ -49,9 +49,9 @@ export class AddonQtypeDdMarkerHandler implements CoreQuestionHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise { return AddonQtypeDdMarkerComponent; @@ -60,9 +60,9 @@ export class AddonQtypeDdMarkerHandler implements CoreQuestionHandler { /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse(question: any, answers: any): number { // If 1 dragitem is set we assume the answer is complete (like Moodle does). @@ -78,7 +78,7 @@ export class AddonQtypeDdMarkerHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -88,9 +88,9 @@ export class AddonQtypeDdMarkerHandler implements CoreQuestionHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse(question: any, answers: any): number { return this.isCompleteResponse(question, answers); @@ -99,10 +99,10 @@ export class AddonQtypeDdMarkerHandler implements CoreQuestionHandler { /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse(question: any, prevAnswers: any, newAnswers: any): boolean { return this.questionProvider.compareAllAnswers(prevAnswers, newAnswers); @@ -111,9 +111,9 @@ export class AddonQtypeDdMarkerHandler implements CoreQuestionHandler { /** * Get the list of files that needs to be downloaded in addition to the files embedded in the HTML. * - * @param {any} question Question. - * @param {number} usageId Usage ID. - * @return {string[]} List of URLs. + * @param question Question. + * @param usageId Usage ID. + * @return List of URLs. */ getAdditionalDownloadableFiles(question: any, usageId: number): string[] { this.questionHelper.extractQuestionScripts(question, usageId); diff --git a/src/addon/qtype/ddwtos/classes/ddwtos.ts b/src/addon/qtype/ddwtos/classes/ddwtos.ts index 14928b681..48f869ec3 100644 --- a/src/addon/qtype/ddwtos/classes/ddwtos.ts +++ b/src/addon/qtype/ddwtos/classes/ddwtos.ts @@ -52,12 +52,12 @@ export class AddonQtypeDdwtosQuestion { /** * Create the instance. * - * @param {CoreLoggerProvider} logger Logger provider. - * @param {CoreDomUtilsProvider} domUtils Dom Utils provider. - * @param {HTMLElement} container The container HTMLElement of the question. - * @param {any} question The question instance. - * @param {boolean} readOnly Whether it's read only. - * @param {string[]} inputIds Ids of the inputs of the question (where the answers will be stored). + * @param logger Logger provider. + * @param domUtils Dom Utils provider. + * @param container The container HTMLElement of the question. + * @param question The question instance. + * @param readOnly Whether it's read only. + * @param inputIds Ids of the inputs of the question (where the answers will be stored). */ constructor(logger: CoreLoggerProvider, protected domUtils: CoreDomUtilsProvider, protected container: HTMLElement, protected question: any, protected readOnly: boolean, protected inputIds: string[], @@ -70,7 +70,7 @@ export class AddonQtypeDdwtosQuestion { /** * Clone a drag item and add it to the drag container. * - * @param {HTMLElement} dragHome Item to clone + * @param dragHome Item to clone */ cloneDragItem(dragHome: HTMLElement): void { const drag = dragHome.cloneNode(true); @@ -106,7 +106,7 @@ export class AddonQtypeDdwtosQuestion { /** * Clone a certain 'drag home'. If it's an "infinite" drag, clone it several times. * - * @param {HTMLElement} dragHome Element to clone. + * @param dragHome Element to clone. */ cloneDragItemsForOneChoice(dragHome: HTMLElement): void { if (dragHome.classList.contains('infinite')) { @@ -124,8 +124,8 @@ export class AddonQtypeDdwtosQuestion { /** * Get an object with a set of functions to get the CSS selectors. * - * @param {number} slot Question slot. - * @return {AddonQtypeDdwtosQuestionCSSSelectors} Object with the functions to get the selectors. + * @param slot Question slot. + * @return Object with the functions to get the selectors. */ cssSelectors(slot: number): AddonQtypeDdwtosQuestionCSSSelectors { const topNode = '.addon-qtype-ddwtos-container', @@ -204,8 +204,8 @@ export class AddonQtypeDdwtosQuestion { /** * Get the choice number of an element. It is extracted from the classes. * - * @param {HTMLElement} node Element to check. - * @return {number} Choice number. + * @param node Element to check. + * @return Choice number. */ getChoice(node: HTMLElement): number { return this.getClassnameNumericSuffix(node, 'choice'); @@ -214,9 +214,9 @@ export class AddonQtypeDdwtosQuestion { /** * Get the number in a certain class name of an element. * - * @param {HTMLElement} node The element to check. - * @param {string} prefix Prefix of the class to check. - * @return {number} The number in the class. + * @param node The element to check. + * @param prefix Prefix of the class to check. + * @return The number in the class. */ getClassnameNumericSuffix(node: HTMLElement, prefix: string): number { if (node.classList && node.classList.length) { @@ -238,8 +238,8 @@ export class AddonQtypeDdwtosQuestion { /** * Get the group number of an element. It is extracted from the classes. * - * @param {HTMLElement} node Element to check. - * @return {number} Group number. + * @param node Element to check. + * @return Group number. */ getGroup(node: HTMLElement): number { return this.getClassnameNumericSuffix(node, 'group'); @@ -248,8 +248,8 @@ export class AddonQtypeDdwtosQuestion { /** * Get the number of an element ('no'). It is extracted from the classes. * - * @param {HTMLElement} node Element to check. - * @return {number} Number. + * @param node Element to check. + * @return Number. */ getNo(node: HTMLElement): number { return this.getClassnameNumericSuffix(node, 'no'); @@ -258,8 +258,8 @@ export class AddonQtypeDdwtosQuestion { /** * Get the place number of an element. It is extracted from the classes. * - * @param {HTMLElement} node Element to check. - * @return {number} Place number. + * @param node Element to check. + * @return Place number. */ getPlace(node: HTMLElement): number { return this.getClassnameNumericSuffix(node, 'place'); @@ -268,7 +268,7 @@ export class AddonQtypeDdwtosQuestion { /** * Initialize the question. * - * @param {any} question Question. + * @param question Question. */ initializer(question: any): void { this.selectors = this.cssSelectors(question.slot); @@ -326,7 +326,7 @@ export class AddonQtypeDdwtosQuestion { /** * Make an element "draggable". In the mobile app, items are "dragged" using tap and drop. * - * @param {HTMLElement} drag Element. + * @param drag Element. */ makeDraggable(drag: HTMLElement): void { drag.addEventListener('click', () => { @@ -341,7 +341,7 @@ export class AddonQtypeDdwtosQuestion { /** * Convert an element into a drop zone. * - * @param {HTMLElement} drop Element. + * @param drop Element. */ makeDropZone(drop: HTMLElement): void { drop.addEventListener('click', () => { @@ -401,9 +401,9 @@ export class AddonQtypeDdwtosQuestion { /** * Set the width and height of an element. * - * @param {HTMLElement} node Element. - * @param {number} width Width to set. - * @param {number} height Height to set. + * @param node Element. + * @param width Width to set. + * @param height Height to set. */ protected padToWidthHeight(node: HTMLElement, width: number, height: number): void { node.style.width = width + 'px'; @@ -414,8 +414,8 @@ export class AddonQtypeDdwtosQuestion { /** * Place a draggable element inside a drop zone. * - * @param {HTMLElement} drag Draggable element. - * @param {HTMLElement} drop Drop zone. + * @param drag Draggable element. + * @param drop Drop zone. */ placeDragInDrop(drag: HTMLElement, drop: HTMLElement): void { @@ -446,7 +446,7 @@ export class AddonQtypeDdwtosQuestion { /** * Position a drag element in the right drop zone or in the home zone. * - * @param {HTMLElement} drag Drag element. + * @param drag Drag element. */ positionDragItem(drag: HTMLElement): void { let position; @@ -485,7 +485,7 @@ export class AddonQtypeDdwtosQuestion { /** * Remove a draggable element from a drop zone. * - * @param {HTMLElement} drag The draggable element. + * @param drag The draggable element. */ removeDragFromDrop(drag: HTMLElement): void { const placeNo = this.placed[this.getNo(drag)], @@ -497,7 +497,7 @@ export class AddonQtypeDdwtosQuestion { /** * Select a certain element as being "dragged". * - * @param {HTMLElement} drag Element. + * @param drag Element. */ selectDrag(drag: HTMLElement): void { // Deselect previous drags, only 1 can be selected. @@ -519,7 +519,7 @@ export class AddonQtypeDdwtosQuestion { /** * Set the padding size for a certain group. * - * @param {number} groupNo Group number. + * @param groupNo Group number. */ setPaddingSizeForGroup(groupNo: number): void { const groupItems = Array.from(this.container.querySelectorAll(this.selectors.dragHomesGroup(groupNo))); diff --git a/src/addon/qtype/ddwtos/providers/handler.ts b/src/addon/qtype/ddwtos/providers/handler.ts index 6a8a6eae4..2f1a9ded0 100644 --- a/src/addon/qtype/ddwtos/providers/handler.ts +++ b/src/addon/qtype/ddwtos/providers/handler.ts @@ -32,9 +32,9 @@ export class AddonQtypeDdwtosHandler implements CoreQuestionHandler { * Return the name of the behaviour to use for the question. * If the question should use the default behaviour you shouldn't implement this function. * - * @param {any} question The question. - * @param {string} behaviour The default behaviour. - * @return {string} The behaviour to use. + * @param question The question. + * @param behaviour The default behaviour. + * @return The behaviour to use. */ getBehaviour(question: any, behaviour: string): string { if (behaviour === 'interactive') { @@ -48,9 +48,9 @@ export class AddonQtypeDdwtosHandler implements CoreQuestionHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise { return AddonQtypeDdwtosComponent; @@ -59,9 +59,9 @@ export class AddonQtypeDdwtosHandler implements CoreQuestionHandler { /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse(question: any, answers: any): number { for (const name in answers) { @@ -77,7 +77,7 @@ export class AddonQtypeDdwtosHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -87,9 +87,9 @@ export class AddonQtypeDdwtosHandler implements CoreQuestionHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse(question: any, answers: any): number { for (const name in answers) { @@ -105,10 +105,10 @@ export class AddonQtypeDdwtosHandler implements CoreQuestionHandler { /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse(question: any, prevAnswers: any, newAnswers: any): boolean { return this.questionProvider.compareAllAnswers(prevAnswers, newAnswers); diff --git a/src/addon/qtype/description/providers/handler.ts b/src/addon/qtype/description/providers/handler.ts index 49bba134c..fbb98071c 100644 --- a/src/addon/qtype/description/providers/handler.ts +++ b/src/addon/qtype/description/providers/handler.ts @@ -33,9 +33,9 @@ export class AddonQtypeDescriptionHandler implements CoreQuestionHandler { * Return the name of the behaviour to use for the question. * If the question should use the default behaviour you shouldn't implement this function. * - * @param {any} question The question. - * @param {string} behaviour The default behaviour. - * @return {string} The behaviour to use. + * @param question The question. + * @param behaviour The default behaviour. + * @return The behaviour to use. */ getBehaviour(question: any, behaviour: string): string { return 'informationitem'; @@ -45,9 +45,9 @@ export class AddonQtypeDescriptionHandler implements CoreQuestionHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise { return AddonQtypeDescriptionComponent; @@ -56,7 +56,7 @@ export class AddonQtypeDescriptionHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -66,9 +66,9 @@ export class AddonQtypeDescriptionHandler implements CoreQuestionHandler { * Validate if an offline sequencecheck is valid compared with the online one. * This function only needs to be implemented if a specific compare is required. * - * @param {any} question The question. - * @param {string} offlineSequenceCheck Sequence check stored in offline. - * @return {boolean} Whether sequencecheck is valid. + * @param question The question. + * @param offlineSequenceCheck Sequence check stored in offline. + * @return Whether sequencecheck is valid. */ validateSequenceCheck(question: any, offlineSequenceCheck: string): boolean { // Descriptions don't have any answer so we'll always treat them as valid. diff --git a/src/addon/qtype/essay/providers/handler.ts b/src/addon/qtype/essay/providers/handler.ts index 3babbd6e1..61aa89c44 100644 --- a/src/addon/qtype/essay/providers/handler.ts +++ b/src/addon/qtype/essay/providers/handler.ts @@ -36,9 +36,9 @@ export class AddonQtypeEssayHandler implements CoreQuestionHandler { * Return the name of the behaviour to use for the question. * If the question should use the default behaviour you shouldn't implement this function. * - * @param {any} question The question. - * @param {string} behaviour The default behaviour. - * @return {string} The behaviour to use. + * @param question The question. + * @param behaviour The default behaviour. + * @return The behaviour to use. */ getBehaviour(question: any, behaviour: string): string { return 'manualgraded'; @@ -48,9 +48,9 @@ export class AddonQtypeEssayHandler implements CoreQuestionHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise { return AddonQtypeEssayComponent; @@ -60,8 +60,8 @@ export class AddonQtypeEssayHandler implements CoreQuestionHandler { * Check if a question can be submitted. * If a question cannot be submitted it should return a message explaining why (translated or not). * - * @param {any} question The question. - * @return {string} Prevent submit message. Undefined or empty if can be submitted. + * @param question The question. + * @return Prevent submit message. Undefined or empty if can be submitted. */ getPreventSubmitMessage(question: any): string { const element = this.domUtils.convertToElement(question.html); @@ -79,9 +79,9 @@ export class AddonQtypeEssayHandler implements CoreQuestionHandler { /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse(question: any, answers: any): number { const element = this.domUtils.convertToElement(question.html); @@ -100,7 +100,7 @@ export class AddonQtypeEssayHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -110,9 +110,9 @@ export class AddonQtypeEssayHandler implements CoreQuestionHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse(question: any, answers: any): number { return 0; @@ -121,10 +121,10 @@ export class AddonQtypeEssayHandler implements CoreQuestionHandler { /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse(question: any, prevAnswers: any, newAnswers: any): boolean { return this.utils.sameAtKeyMissingIsBlank(prevAnswers, newAnswers, 'answer'); @@ -133,11 +133,11 @@ export class AddonQtypeEssayHandler implements CoreQuestionHandler { /** * Prepare and add to answers the data to send to server based in the input. Return promise if async. * - * @param {any} question Question. - * @param {any} answers The answers retrieved from the form. Prepared answers must be stored in this object. - * @param {boolean} [offline] Whether the data should be saved in offline. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} Return a promise resolved when done if async, void if sync. + * @param question Question. + * @param answers The answers retrieved from the form. Prepared answers must be stored in this object. + * @param offline Whether the data should be saved in offline. + * @param siteId Site ID. If not defined, current site. + * @return Return a promise resolved when done if async, void if sync. */ prepareAnswers(question: any, answers: any, offline: boolean, siteId?: string): void | Promise { const element = this.domUtils.convertToElement(question.html); diff --git a/src/addon/qtype/gapselect/providers/handler.ts b/src/addon/qtype/gapselect/providers/handler.ts index e18b357cd..c0afd80b1 100644 --- a/src/addon/qtype/gapselect/providers/handler.ts +++ b/src/addon/qtype/gapselect/providers/handler.ts @@ -32,9 +32,9 @@ export class AddonQtypeGapSelectHandler implements CoreQuestionHandler { * Return the name of the behaviour to use for the question. * If the question should use the default behaviour you shouldn't implement this function. * - * @param {any} question The question. - * @param {string} behaviour The default behaviour. - * @return {string} The behaviour to use. + * @param question The question. + * @param behaviour The default behaviour. + * @return The behaviour to use. */ getBehaviour(question: any, behaviour: string): string { if (behaviour === 'interactive') { @@ -48,9 +48,9 @@ export class AddonQtypeGapSelectHandler implements CoreQuestionHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise { return AddonQtypeGapSelectComponent; @@ -59,9 +59,9 @@ export class AddonQtypeGapSelectHandler implements CoreQuestionHandler { /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse(question: any, answers: any): number { // We should always get a value for each select so we can assume we receive all the possible answers. @@ -78,7 +78,7 @@ export class AddonQtypeGapSelectHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -88,9 +88,9 @@ export class AddonQtypeGapSelectHandler implements CoreQuestionHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse(question: any, answers: any): number { // We should always get a value for each select so we can assume we receive all the possible answers. @@ -107,10 +107,10 @@ export class AddonQtypeGapSelectHandler implements CoreQuestionHandler { /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse(question: any, prevAnswers: any, newAnswers: any): boolean { return this.questionProvider.compareAllAnswers(prevAnswers, newAnswers); diff --git a/src/addon/qtype/match/providers/handler.ts b/src/addon/qtype/match/providers/handler.ts index d9519ad04..9b52e4979 100644 --- a/src/addon/qtype/match/providers/handler.ts +++ b/src/addon/qtype/match/providers/handler.ts @@ -32,9 +32,9 @@ export class AddonQtypeMatchHandler implements CoreQuestionHandler { * Return the name of the behaviour to use for the question. * If the question should use the default behaviour you shouldn't implement this function. * - * @param {any} question The question. - * @param {string} behaviour The default behaviour. - * @return {string} The behaviour to use. + * @param question The question. + * @param behaviour The default behaviour. + * @return The behaviour to use. */ getBehaviour(question: any, behaviour: string): string { if (behaviour === 'interactive') { @@ -48,9 +48,9 @@ export class AddonQtypeMatchHandler implements CoreQuestionHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise { return AddonQtypeMatchComponent; @@ -59,9 +59,9 @@ export class AddonQtypeMatchHandler implements CoreQuestionHandler { /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse(question: any, answers: any): number { // We should always get a value for each select so we can assume we receive all the possible answers. @@ -78,7 +78,7 @@ export class AddonQtypeMatchHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -88,9 +88,9 @@ export class AddonQtypeMatchHandler implements CoreQuestionHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse(question: any, answers: any): number { // We should always get a value for each select so we can assume we receive all the possible answers. @@ -107,10 +107,10 @@ export class AddonQtypeMatchHandler implements CoreQuestionHandler { /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse(question: any, prevAnswers: any, newAnswers: any): boolean { return this.questionProvider.compareAllAnswers(prevAnswers, newAnswers); diff --git a/src/addon/qtype/multianswer/providers/handler.ts b/src/addon/qtype/multianswer/providers/handler.ts index b02a4eb70..a05fdbc59 100644 --- a/src/addon/qtype/multianswer/providers/handler.ts +++ b/src/addon/qtype/multianswer/providers/handler.ts @@ -33,9 +33,9 @@ export class AddonQtypeMultiAnswerHandler implements CoreQuestionHandler { * Return the name of the behaviour to use for the question. * If the question should use the default behaviour you shouldn't implement this function. * - * @param {any} question The question. - * @param {string} behaviour The default behaviour. - * @return {string} The behaviour to use. + * @param question The question. + * @param behaviour The default behaviour. + * @return The behaviour to use. */ getBehaviour(question: any, behaviour: string): string { if (behaviour === 'interactive') { @@ -49,9 +49,9 @@ export class AddonQtypeMultiAnswerHandler implements CoreQuestionHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise { return AddonQtypeMultiAnswerComponent; @@ -60,9 +60,9 @@ export class AddonQtypeMultiAnswerHandler implements CoreQuestionHandler { /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse(question: any, answers: any): number { // Get all the inputs in the question to check if they've all been answered. @@ -80,7 +80,7 @@ export class AddonQtypeMultiAnswerHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -90,9 +90,9 @@ export class AddonQtypeMultiAnswerHandler implements CoreQuestionHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse(question: any, answers: any): number { // We should always get a value for each select so we can assume we receive all the possible answers. @@ -109,10 +109,10 @@ export class AddonQtypeMultiAnswerHandler implements CoreQuestionHandler { /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse(question: any, prevAnswers: any, newAnswers: any): boolean { return this.questionProvider.compareAllAnswers(prevAnswers, newAnswers); @@ -122,9 +122,9 @@ export class AddonQtypeMultiAnswerHandler implements CoreQuestionHandler { * Validate if an offline sequencecheck is valid compared with the online one. * This function only needs to be implemented if a specific compare is required. * - * @param {any} question The question. - * @param {string} offlineSequenceCheck Sequence check stored in offline. - * @return {boolean} Whether sequencecheck is valid. + * @param question The question. + * @param offlineSequenceCheck Sequence check stored in offline. + * @return Whether sequencecheck is valid. */ validateSequenceCheck(question: any, offlineSequenceCheck: string): boolean { if (question.sequencecheck == offlineSequenceCheck) { diff --git a/src/addon/qtype/multichoice/providers/handler.ts b/src/addon/qtype/multichoice/providers/handler.ts index 440ab80e8..ca4d0f413 100644 --- a/src/addon/qtype/multichoice/providers/handler.ts +++ b/src/addon/qtype/multichoice/providers/handler.ts @@ -32,9 +32,9 @@ export class AddonQtypeMultichoiceHandler implements CoreQuestionHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise { return AddonQtypeMultichoiceComponent; @@ -43,9 +43,9 @@ export class AddonQtypeMultichoiceHandler implements CoreQuestionHandler { /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse(question: any, answers: any): number { let isSingle = true, @@ -73,8 +73,8 @@ export class AddonQtypeMultichoiceHandler implements CoreQuestionHandler { /** * Check if a response is complete. Only for single answer. * - * @param {any} question The question.uestion answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question.uestion answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponseSingle(answers: any): number { return (answers['answer'] && answers['answer'] !== '') ? 1 : 0; @@ -83,7 +83,7 @@ export class AddonQtypeMultichoiceHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -93,9 +93,9 @@ export class AddonQtypeMultichoiceHandler implements CoreQuestionHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse(question: any, answers: any): number { return this.isCompleteResponse(question, answers); @@ -105,8 +105,8 @@ export class AddonQtypeMultichoiceHandler implements CoreQuestionHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. Only for single answer. * - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponseSingle(answers: any): number { return this.isCompleteResponseSingle(answers); @@ -115,10 +115,10 @@ export class AddonQtypeMultichoiceHandler implements CoreQuestionHandler { /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse(question: any, prevAnswers: any, newAnswers: any): boolean { let isSingle = true, @@ -144,9 +144,9 @@ export class AddonQtypeMultichoiceHandler implements CoreQuestionHandler { /** * Check if two responses are the same. Only for single answer. * - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponseSingle(prevAnswers: any, newAnswers: any): boolean { return this.utils.sameAtKeyMissingIsBlank(prevAnswers, newAnswers, 'answer'); @@ -155,11 +155,11 @@ export class AddonQtypeMultichoiceHandler implements CoreQuestionHandler { /** * Prepare and add to answers the data to send to server based in the input. Return promise if async. * - * @param {any} question Question. - * @param {any} answers The answers retrieved from the form. Prepared answers must be stored in this object. - * @param {boolean} [offline] Whether the data should be saved in offline. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} Return a promise resolved when done if async, void if sync. + * @param question Question. + * @param answers The answers retrieved from the form. Prepared answers must be stored in this object. + * @param offline Whether the data should be saved in offline. + * @param siteId Site ID. If not defined, current site. + * @return Return a promise resolved when done if async, void if sync. */ prepareAnswers(question: any, answers: any, offline: boolean, siteId?: string): void | Promise { if (question && !question.multi && typeof answers[question.optionsName] != 'undefined' && !answers[question.optionsName]) { diff --git a/src/addon/qtype/randomsamatch/providers/handler.ts b/src/addon/qtype/randomsamatch/providers/handler.ts index eca943805..67d8d23ae 100644 --- a/src/addon/qtype/randomsamatch/providers/handler.ts +++ b/src/addon/qtype/randomsamatch/providers/handler.ts @@ -32,9 +32,9 @@ export class AddonQtypeRandomSaMatchHandler implements CoreQuestionHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise { // Random behaves like a match question, use the same component. @@ -44,9 +44,9 @@ export class AddonQtypeRandomSaMatchHandler implements CoreQuestionHandler { /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse(question: any, answers: any): number { // This question behaves like a match question. @@ -56,7 +56,7 @@ export class AddonQtypeRandomSaMatchHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -66,9 +66,9 @@ export class AddonQtypeRandomSaMatchHandler implements CoreQuestionHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse(question: any, answers: any): number { // This question behaves like a match question. @@ -78,10 +78,10 @@ export class AddonQtypeRandomSaMatchHandler implements CoreQuestionHandler { /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse(question: any, prevAnswers: any, newAnswers: any): boolean { // This question behaves like a match question. diff --git a/src/addon/qtype/shortanswer/providers/handler.ts b/src/addon/qtype/shortanswer/providers/handler.ts index abbb694dc..a4daa2823 100644 --- a/src/addon/qtype/shortanswer/providers/handler.ts +++ b/src/addon/qtype/shortanswer/providers/handler.ts @@ -32,9 +32,9 @@ export class AddonQtypeShortAnswerHandler implements CoreQuestionHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise { return AddonQtypeShortAnswerComponent; @@ -43,9 +43,9 @@ export class AddonQtypeShortAnswerHandler implements CoreQuestionHandler { /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse(question: any, answers: any): number { return (answers['answer'] || answers['answer'] === 0) ? 1 : 0; @@ -54,7 +54,7 @@ export class AddonQtypeShortAnswerHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -64,9 +64,9 @@ export class AddonQtypeShortAnswerHandler implements CoreQuestionHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse(question: any, answers: any): number { return this.isCompleteResponse(question, answers); @@ -75,10 +75,10 @@ export class AddonQtypeShortAnswerHandler implements CoreQuestionHandler { /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse(question: any, prevAnswers: any, newAnswers: any): boolean { return this.utils.sameAtKeyMissingIsBlank(prevAnswers, newAnswers, 'answer'); diff --git a/src/addon/qtype/truefalse/providers/handler.ts b/src/addon/qtype/truefalse/providers/handler.ts index 3be03abde..24f2efdfe 100644 --- a/src/addon/qtype/truefalse/providers/handler.ts +++ b/src/addon/qtype/truefalse/providers/handler.ts @@ -32,9 +32,9 @@ export class AddonQtypeTrueFalseHandler implements CoreQuestionHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise { // True/false behaves like a multichoice, use the same component. @@ -44,9 +44,9 @@ export class AddonQtypeTrueFalseHandler implements CoreQuestionHandler { /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse(question: any, answers: any): number { return answers['answer'] ? 1 : 0; @@ -55,7 +55,7 @@ export class AddonQtypeTrueFalseHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -65,9 +65,9 @@ export class AddonQtypeTrueFalseHandler implements CoreQuestionHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse(question: any, answers: any): number { return this.isCompleteResponse(question, answers); @@ -76,10 +76,10 @@ export class AddonQtypeTrueFalseHandler implements CoreQuestionHandler { /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse(question: any, prevAnswers: any, newAnswers: any): boolean { return this.utils.sameAtKeyMissingIsBlank(prevAnswers, newAnswers, 'answer'); @@ -88,11 +88,11 @@ export class AddonQtypeTrueFalseHandler implements CoreQuestionHandler { /** * Prepare and add to answers the data to send to server based in the input. Return promise if async. * - * @param {any} question Question. - * @param {any} answers The answers retrieved from the form. Prepared answers must be stored in this object. - * @param {boolean} [offline] Whether the data should be saved in offline. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} Return a promise resolved when done if async, void if sync. + * @param question Question. + * @param answers The answers retrieved from the form. Prepared answers must be stored in this object. + * @param offline Whether the data should be saved in offline. + * @param siteId Site ID. If not defined, current site. + * @return Return a promise resolved when done if async, void if sync. */ prepareAnswers(question: any, answers: any, offline: boolean, siteId?: string): void | Promise { if (question && typeof answers[question.optionsName] != 'undefined' && !answers[question.optionsName]) { diff --git a/src/addon/remotethemes/providers/remotethemes.ts b/src/addon/remotethemes/providers/remotethemes.ts index 7b30b31ce..f4d863740 100644 --- a/src/addon/remotethemes/providers/remotethemes.ts +++ b/src/addon/remotethemes/providers/remotethemes.ts @@ -43,8 +43,8 @@ export class AddonRemoteThemesProvider { /** * Add a style element for a site and load the styles for that element. The style will be disabled. * - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when added and loaded. + * @param siteId Site ID. + * @return Promise resolved when added and loaded. */ addSite(siteId: string): Promise { if (!siteId || this.stylesEls[siteId]) { @@ -85,8 +85,8 @@ export class AddonRemoteThemesProvider { /** * Enabled or disable a certain style element. * - * @param {HTMLStyleElement} element The element to enable or disable. - * @param {boolean} disable Whether to disable or enable the element. + * @param element The element to enable or disable. + * @param disable Whether to disable or enable the element. */ disableElement(element: HTMLStyleElement, disable: boolean): void { // Setting disabled should be enough, but we also set the attribute so it can be seen in the DOM which ones are disabled. @@ -106,9 +106,9 @@ export class AddonRemoteThemesProvider { /** * Downloads a CSS file and remove old files if needed. * - * @param {string} siteId Site ID. - * @param {string} url File URL. - * @return {Promise} Promise resolved when the file is downloaded. + * @param siteId Site ID. + * @param url File URL. + * @return Promise resolved when the file is downloaded. */ protected downloadFileAndRemoveOld(siteId: string, url: string): Promise { // Check if the file is downloaded. @@ -130,7 +130,7 @@ export class AddonRemoteThemesProvider { /** * Enable the styles of a certain site. * - * @param {string} [siteId] Site ID. If not defined, current site. + * @param siteId Site ID. If not defined, current site. */ enable(siteId?: string): void { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -143,9 +143,9 @@ export class AddonRemoteThemesProvider { /** * Get remote styles of a certain site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise<{fileUrl: string, styles: string}>} Promise resolved with the styles and the URL of the CSS file, - * resolved with undefined if no styles to load. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the styles and the URL of the CSS file, + * resolved with undefined if no styles to load. */ get(siteId?: string): Promise<{fileUrl: string, styles: string}> { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -193,8 +193,8 @@ export class AddonRemoteThemesProvider { /** * Check if the CSS code has a separator for 3.5 styles. If it does, get only the styles after the separator. * - * @param {string} cssCode The CSS code to check. - * @return {string} The filtered styles. + * @param cssCode The CSS code to check. + * @return The filtered styles. */ protected get35Styles(cssCode: string): string { const separatorPos = cssCode.search(this.SEPARATOR_35); @@ -208,9 +208,9 @@ export class AddonRemoteThemesProvider { /** * Load styles for a certain site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [disabled] Whether loaded styles should be disabled. - * @return {Promise} Promise resolved when styles are loaded. + * @param siteId Site ID. If not defined, current site. + * @param disabled Whether loaded styles should be disabled. + * @return Promise resolved when styles are loaded. */ load(siteId?: string, disabled?: boolean): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -255,8 +255,8 @@ export class AddonRemoteThemesProvider { /** * Load styles for a temporary site. These styles aren't prefetched. * - * @param {string} url URL to get the styles from. - * @return {Promise} Promise resolved when loaded. + * @param url URL to get the styles from. + * @return Promise resolved when loaded. */ loadTmpStyles(url: string): Promise { if (!url) { @@ -286,7 +286,7 @@ export class AddonRemoteThemesProvider { /** * Preload the styles of the current site (stored in DB). * - * @return {Promise} Promise resolved when loaded. + * @return Promise resolved when loaded. */ preloadCurrentSite(): Promise { return this.sitesProvider.getStoredCurrentSiteId().then((siteId) => { @@ -299,7 +299,7 @@ export class AddonRemoteThemesProvider { /** * Preload the styles of all the stored sites. * - * @return {Promise} Promise resolved when loaded. + * @return Promise resolved when loaded. */ preloadSites(): Promise { return this.sitesProvider.getSitesIds().then((ids) => { @@ -315,7 +315,7 @@ export class AddonRemoteThemesProvider { /** * Remove the styles of a certain site. * - * @param {string} siteId Site ID. + * @param siteId Site ID. */ removeSite(siteId: string): void { if (siteId && this.stylesEls[siteId]) { diff --git a/src/addon/storagemanager/pages/course-storage/course-storage.ts b/src/addon/storagemanager/pages/course-storage/course-storage.ts index 18769c1c9..800ac1edf 100644 --- a/src/addon/storagemanager/pages/course-storage/course-storage.ts +++ b/src/addon/storagemanager/pages/course-storage/course-storage.ts @@ -111,7 +111,7 @@ export class AddonStorageManagerCourseStoragePage { * * (This works by deleting data for each module in the section that has data.) * - * @param {any} section Section object with information about section and modules + * @param section Section object with information about section and modules */ deleteForSection(section: any): void { const modules = []; @@ -127,7 +127,7 @@ export class AddonStorageManagerCourseStoragePage { /** * The user has requested a delete for a module's data * - * @param {any} module Module details + * @param module Module details */ deleteForModule(module: any): void { if (module.totalSize > 0) { @@ -138,7 +138,7 @@ export class AddonStorageManagerCourseStoragePage { /** * Deletes the specified modules, showing the loading overlay while it happens. * - * @param {any[]} modules Modules to delete + * @param modules Modules to delete * @return Promise Once deleting has finished */ protected deleteModules(modules: any[]): Promise { diff --git a/src/addon/storagemanager/providers/coursemenu-handler.ts b/src/addon/storagemanager/providers/coursemenu-handler.ts index 69a578fe0..b3e0f6b57 100644 --- a/src/addon/storagemanager/providers/coursemenu-handler.ts +++ b/src/addon/storagemanager/providers/coursemenu-handler.ts @@ -27,11 +27,11 @@ export class AddonStorageManagerCourseMenuHandler implements CoreCourseOptionsMe /** * Checks if the handler is enabled for specified course. This handler is always available. * - * @param {number} courseId Course id - * @param {any} accessData Access data - * @param {any} [navOptions] Navigation options if any - * @param {any} [admOptions] Admin options if any - * @return {boolean | Promise} True + * @param courseId Course id + * @param accessData Access data + * @param navOptions Navigation options if any + * @param admOptions Admin options if any + * @return True */ isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise { return true; @@ -40,7 +40,7 @@ export class AddonStorageManagerCourseMenuHandler implements CoreCourseOptionsMe /** * Check if the handler is enabled on a site level. * - * @return {boolean | Promise} 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 { return true; @@ -49,9 +49,9 @@ export class AddonStorageManagerCourseMenuHandler implements CoreCourseOptionsMe /** * Returns the data needed to render the handler. * - * @param {Injector} injector Injector. - * @param {any} course The course. - * @return {CoreCourseOptionsMenuHandlerData} Data needed to render the handler. + * @param injector Injector. + * @param course The course. + * @return Data needed to render the handler. */ getMenuDisplayData(injector: Injector, course: any): CoreCourseOptionsMenuHandlerData { return { diff --git a/src/addon/userprofilefield/checkbox/providers/handler.ts b/src/addon/userprofilefield/checkbox/providers/handler.ts index 42297a1a2..5981f6f95 100644 --- a/src/addon/userprofilefield/checkbox/providers/handler.ts +++ b/src/addon/userprofilefield/checkbox/providers/handler.ts @@ -31,7 +31,7 @@ export class AddonUserProfileFieldCheckboxHandler implements CoreUserProfileFiel /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -40,11 +40,11 @@ export class AddonUserProfileFieldCheckboxHandler implements CoreUserProfileFiel /** * Get the data to send for the field based on the input data. * - * @param {any} field User field to get the data for. - * @param {boolean} signup True if user is in signup page. - * @param {string} [registerAuth] Register auth method. E.g. 'email'. - * @param {any} formValues Form Values. - * @return {CoreUserProfileFieldHandlerData} Data to send for the field. + * @param field User field to get the data for. + * @param signup True if user is in signup page. + * @param registerAuth Register auth method. E.g. 'email'. + * @param formValues Form Values. + * @return Data to send for the field. */ getData(field: any, signup: boolean, registerAuth: string, formValues: any): CoreUserProfileFieldHandlerData { const name = 'profile_field_' + field.shortname; @@ -62,8 +62,8 @@ export class AddonUserProfileFieldCheckboxHandler implements CoreUserProfileFiel * Return the Component to use to display the user profile field. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return AddonUserProfileFieldCheckboxComponent; diff --git a/src/addon/userprofilefield/datetime/providers/handler.ts b/src/addon/userprofilefield/datetime/providers/handler.ts index 29d3d321e..6076dd63c 100644 --- a/src/addon/userprofilefield/datetime/providers/handler.ts +++ b/src/addon/userprofilefield/datetime/providers/handler.ts @@ -32,7 +32,7 @@ export class AddonUserProfileFieldDatetimeHandler implements CoreUserProfileFiel /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -41,11 +41,11 @@ export class AddonUserProfileFieldDatetimeHandler implements CoreUserProfileFiel /** * Get the data to send for the field based on the input data. * - * @param {any} field User field to get the data for. - * @param {boolean} signup True if user is in signup page. - * @param {string} [registerAuth] Register auth method. E.g. 'email'. - * @param {any} formValues Form Values. - * @return {CoreUserProfileFieldHandlerData} Data to send for the field. + * @param field User field to get the data for. + * @param signup True if user is in signup page. + * @param registerAuth Register auth method. E.g. 'email'. + * @param formValues Form Values. + * @return Data to send for the field. */ getData(field: any, signup: boolean, registerAuth: string, formValues: any): CoreUserProfileFieldHandlerData { const name = 'profile_field_' + field.shortname; @@ -63,8 +63,8 @@ export class AddonUserProfileFieldDatetimeHandler implements CoreUserProfileFiel * Return the Component to use to display the user profile field. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return AddonUserProfileFieldDatetimeComponent; diff --git a/src/addon/userprofilefield/menu/providers/handler.ts b/src/addon/userprofilefield/menu/providers/handler.ts index 6516c0559..928d84db7 100644 --- a/src/addon/userprofilefield/menu/providers/handler.ts +++ b/src/addon/userprofilefield/menu/providers/handler.ts @@ -31,7 +31,7 @@ export class AddonUserProfileFieldMenuHandler implements CoreUserProfileFieldHan /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -40,11 +40,11 @@ export class AddonUserProfileFieldMenuHandler implements CoreUserProfileFieldHan /** * Get the data to send for the field based on the input data. * - * @param {any} field User field to get the data for. - * @param {boolean} signup True if user is in signup page. - * @param {string} [registerAuth] Register auth method. E.g. 'email'. - * @param {any} formValues Form Values. - * @return {CoreUserProfileFieldHandlerData} Data to send for the field. + * @param field User field to get the data for. + * @param signup True if user is in signup page. + * @param registerAuth Register auth method. E.g. 'email'. + * @param formValues Form Values. + * @return Data to send for the field. */ getData(field: any, signup: boolean, registerAuth: string, formValues: any): CoreUserProfileFieldHandlerData { const name = 'profile_field_' + field.shortname; @@ -62,8 +62,8 @@ export class AddonUserProfileFieldMenuHandler implements CoreUserProfileFieldHan * Return the Component to use to display the user profile field. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return AddonUserProfileFieldMenuComponent; diff --git a/src/addon/userprofilefield/text/providers/handler.ts b/src/addon/userprofilefield/text/providers/handler.ts index 2cdcac9ee..644faf0df 100644 --- a/src/addon/userprofilefield/text/providers/handler.ts +++ b/src/addon/userprofilefield/text/providers/handler.ts @@ -30,7 +30,7 @@ export class AddonUserProfileFieldTextHandler implements CoreUserProfileFieldHan /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -39,11 +39,11 @@ export class AddonUserProfileFieldTextHandler implements CoreUserProfileFieldHan /** * Get the data to send for the field based on the input data. * - * @param {any} field User field to get the data for. - * @param {boolean} signup True if user is in signup page. - * @param {string} [registerAuth] Register auth method. E.g. 'email'. - * @param {any} formValues Form Values. - * @return {CoreUserProfileFieldHandlerData} Data to send for the field. + * @param field User field to get the data for. + * @param signup True if user is in signup page. + * @param registerAuth Register auth method. E.g. 'email'. + * @param formValues Form Values. + * @return Data to send for the field. */ getData(field: any, signup: boolean, registerAuth: string, formValues: any): CoreUserProfileFieldHandlerData { const name = 'profile_field_' + field.shortname; @@ -59,8 +59,8 @@ export class AddonUserProfileFieldTextHandler implements CoreUserProfileFieldHan * Return the Component to use to display the user profile field. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return AddonUserProfileFieldTextComponent; diff --git a/src/addon/userprofilefield/textarea/providers/handler.ts b/src/addon/userprofilefield/textarea/providers/handler.ts index fc079ffb7..a3ae461ce 100644 --- a/src/addon/userprofilefield/textarea/providers/handler.ts +++ b/src/addon/userprofilefield/textarea/providers/handler.ts @@ -30,7 +30,7 @@ export class AddonUserProfileFieldTextareaHandler implements CoreUserProfileFiel /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -39,11 +39,11 @@ export class AddonUserProfileFieldTextareaHandler implements CoreUserProfileFiel /** * Get the data to send for the field based on the input data. * - * @param {any} field User field to get the data for. - * @param {boolean} signup True if user is in signup page. - * @param {string} [registerAuth] Register auth method. E.g. 'email'. - * @param {any} formValues Form Values. - * @return {CoreUserProfileFieldHandlerData} Data to send for the field. + * @param field User field to get the data for. + * @param signup True if user is in signup page. + * @param registerAuth Register auth method. E.g. 'email'. + * @param formValues Form Values. + * @return Data to send for the field. */ getData(field: any, signup: boolean, registerAuth: string, formValues: any): CoreUserProfileFieldHandlerData { const name = 'profile_field_' + field.shortname; @@ -68,8 +68,8 @@ export class AddonUserProfileFieldTextareaHandler implements CoreUserProfileFiel * Return the Component to use to display the user profile field. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return AddonUserProfileFieldTextareaComponent; diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 7df4951b2..e9bd35add 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -266,7 +266,7 @@ export class MoodleMobileApp implements OnInit { /** * Convenience function to add version to body classes. * - * @param {string} release Current release number of the site. + * @param release Current release number of the site. */ protected addVersionClass(release: string): void { const parts = release.split('.'); @@ -298,7 +298,7 @@ export class MoodleMobileApp implements OnInit { /** * Close one modal if any. * - * @return {boolean} True if one modal was present. + * @return True if one modal was present. */ closeModal(): boolean { // Following function is hidden in Ionic Code, however there's no solution for that. diff --git a/src/classes/base-sync.ts b/src/classes/base-sync.ts index d247783da..dbf8358bf 100644 --- a/src/classes/base-sync.ts +++ b/src/classes/base-sync.ts @@ -27,19 +27,16 @@ export class CoreSyncBaseProvider { /** * Logger instance get from CoreLoggerProvider. - * @type {any} */ protected logger; /** * Component of the sync provider. - * @type {string} */ component = 'core'; /** * Sync provider's interval. - * @type {number} */ syncInterval = 300000; @@ -58,10 +55,10 @@ export class CoreSyncBaseProvider { /** * Add an ongoing sync to the syncPromises list. On finish the promise will be removed. * - * @param {string | number} id Unique sync identifier per component. - * @param {Promise} promise The promise of the sync to add. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} The sync promise. + * @param id Unique sync identifier per component. + * @param promise The promise of the sync to add. + * @param siteId Site ID. If not defined, current site. + * @return The sync promise. */ addOngoingSync(id: string | number, promise: Promise, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -82,9 +79,9 @@ export class CoreSyncBaseProvider { /** * If there's an ongoing sync for a certain identifier return it. * - * @param {string | number} id Unique sync identifier per component. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise of the current sync or undefined if there isn't any. + * @param id Unique sync identifier per component. + * @param siteId Site ID. If not defined, current site. + * @return Promise of the current sync or undefined if there isn't any. */ getOngoingSync(id: string | number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -100,9 +97,9 @@ export class CoreSyncBaseProvider { /** * Get the synchronization time in a human readable format. * - * @param {string | number} id Unique sync identifier per component. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the readable time. + * @param id Unique sync identifier per component. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the readable time. */ getReadableSyncTime(id: string | number, siteId?: string): Promise { return this.getSyncTime(id, siteId).then((time) => { @@ -113,8 +110,8 @@ export class CoreSyncBaseProvider { /** * Given a timestamp return it in a human readable format. * - * @param {number} timestamp Timestamp - * @return {string} Human readable time. + * @param timestamp Timestamp + * @return Human readable time. */ getReadableTimeFromTimestamp(timestamp: number): string { if (!timestamp) { @@ -127,9 +124,9 @@ export class CoreSyncBaseProvider { /** * Get the synchronization time. Returns 0 if no time stored. * - * @param {string | number} id Unique sync identifier per component. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the time. + * @param id Unique sync identifier per component. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the time. */ getSyncTime(id: string | number, siteId?: string): Promise { return this.syncProvider.getSyncRecord(this.component, id, siteId).then((entry) => { @@ -142,9 +139,9 @@ export class CoreSyncBaseProvider { /** * Get the synchronization warnings of an instance. * - * @param {string | number} id Unique sync identifier per component. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the warnings. + * @param id Unique sync identifier per component. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the warnings. */ getSyncWarnings(id: string | number, siteId?: string): Promise { return this.syncProvider.getSyncRecord(this.component, id, siteId).then((entry) => { @@ -157,8 +154,8 @@ export class CoreSyncBaseProvider { /** * Create a unique identifier from component and id. * - * @param {string | number} id Unique sync identifier per component. - * @return {string} Unique identifier from component and id. + * @param id Unique sync identifier per component. + * @return Unique identifier from component and id. */ protected getUniqueSyncId(id: string | number): string { return this.component + '#' + id; @@ -167,9 +164,9 @@ export class CoreSyncBaseProvider { /** * Check if a there's an ongoing syncronization for the given id. * - * @param {string | number} id Unique sync identifier per component. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean} Whether it's synchronizing. + * @param id Unique sync identifier per component. + * @param siteId Site ID. If not defined, current site. + * @return Whether it's synchronizing. */ isSyncing(id: string | number, siteId?: string): boolean { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -182,9 +179,9 @@ export class CoreSyncBaseProvider { /** * Check if a sync is needed: if a certain time has passed since the last time. * - * @param {string | number} id Unique sync identifier per component. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether sync is needed. + * @param id Unique sync identifier per component. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether sync is needed. */ isSyncNeeded(id: string | number, siteId?: string): Promise { return this.getSyncTime(id, siteId).then((time) => { @@ -195,10 +192,10 @@ export class CoreSyncBaseProvider { /** * Set the synchronization time. * - * @param {string | number} id Unique sync identifier per component. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [time] Time to set. If not defined, current time. - * @return {Promise} Promise resolved when the time is set. + * @param id Unique sync identifier per component. + * @param siteId Site ID. If not defined, current site. + * @param time Time to set. If not defined, current time. + * @return Promise resolved when the time is set. */ setSyncTime(id: string | number, siteId?: string, time?: number): Promise { time = typeof time != 'undefined' ? time : Date.now(); @@ -209,10 +206,10 @@ export class CoreSyncBaseProvider { /** * Set the synchronization warnings. * - * @param {string | number} id Unique sync identifier per component. - * @param {string[]} warnings Warnings to set. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param id Unique sync identifier per component. + * @param warnings Warnings to set. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ setSyncWarnings(id: string | number, warnings: string[], siteId?: string): Promise { const warningsText = JSON.stringify(warnings || []); @@ -223,11 +220,11 @@ export class CoreSyncBaseProvider { /** * Execute a sync function on selected sites. * - * @param {string} syncFunctionLog Log message to explain the sync function purpose. - * @param {Function} syncFunction Sync function to execute. - * @param {any[]} [params] Array that defines the params that admit the funcion. - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @return {Promise} Resolved with siteIds selected. Rejected if offline. + * @param syncFunctionLog Log message to explain the sync function purpose. + * @param syncFunction Sync function to execute. + * @param params Array that defines the params that admit the funcion. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @return Resolved with siteIds selected. Rejected if offline. */ syncOnSites(syncFunctionLog: string, syncFunction: Function, params?: any[], siteId?: string): Promise { if (!this.appProvider.isOnline()) { @@ -263,9 +260,9 @@ export class CoreSyncBaseProvider { * If there's an ongoing sync for a certain identifier, wait for it to end. * If there's no sync ongoing the promise will be resolved right away. * - * @param {string | number} id Unique sync identifier per component. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when there's no sync going on for the identifier. + * @param id Unique sync identifier per component. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when there's no sync going on for the identifier. */ waitForSync(id: string | number, siteId?: string): Promise { const promise = this.getOngoingSync(id, siteId); diff --git a/src/classes/cache.ts b/src/classes/cache.ts index 38ba1f3c8..f4989b2d6 100644 --- a/src/classes/cache.ts +++ b/src/classes/cache.ts @@ -37,8 +37,8 @@ export class CoreCache { /** * Get all the data stored in the cache for a certain id. * - * @param {any} id The ID to identify the entry. - * @return {any} The data from the cache. Undefined if not found. + * @param id The ID to identify the entry. + * @return The data from the cache. Undefined if not found. */ getEntry(id: any): any { if (!this.cacheStore[id]) { @@ -51,10 +51,10 @@ export class CoreCache { /** * Get the status of a module from the "cache". * - * @param {any} id The ID to identify the entry. - * @param {string} name Name of the value to get. - * @param {boolean} [ignoreInvalidate] Whether it should always return the cached data, even if it's expired. - * @return {any} Cached value. Undefined if not cached or expired. + * @param id The ID to identify the entry. + * @param name Name of the value to get. + * @param ignoreInvalidate Whether it should always return the cached data, even if it's expired. + * @return Cached value. Undefined if not cached or expired. */ getValue(id: any, name: string, ignoreInvalidate?: boolean): any { const entry = this.getEntry(id); @@ -73,7 +73,7 @@ export class CoreCache { /** * Invalidate all the cached data for a certain entry. * - * @param {any} id The ID to identify the entry. + * @param id The ID to identify the entry. */ invalidate(id: any): void { const entry = this.getEntry(id); @@ -85,10 +85,10 @@ export class CoreCache { /** * Update the status of a module in the "cache". * - * @param {any} id The ID to identify the entry. - * @param {string} name Name of the value to set. - * @param {any} value Value to set. - * @return {any} The set value. + * @param id The ID to identify the entry. + * @param name Name of the value to set. + * @param value Value to set. + * @return The set value. */ setValue(id: any, name: string, value: any): any { const entry = this.getEntry(id); diff --git a/src/classes/delegate.ts b/src/classes/delegate.ts index 5710cbdd9..560e81645 100644 --- a/src/classes/delegate.ts +++ b/src/classes/delegate.ts @@ -21,13 +21,12 @@ export interface CoreDelegateHandler { /** * Name of the handler, or name and sub context (AddonMessages, AddonMessages:blockContact, ...). * This name will be used to check if the feature is disabled. - * @type {string} */ name: string; /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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; } @@ -39,38 +38,32 @@ export class CoreDelegate { /** * Logger instance get from CoreLoggerProvider. - * @type {any} */ protected logger; /** * List of registered handlers. - * @type {any} */ protected handlers: { [s: string]: CoreDelegateHandler } = {}; /** * List of registered handlers enabled for the current site. - * @type {any} */ protected enabledHandlers: { [s: string]: CoreDelegateHandler } = {}; /** * Default handler - * @type {CoreDelegateHandler} */ protected defaultHandler: CoreDelegateHandler; /** * Time when last updateHandler functions started. - * @type {number} */ protected lastUpdateHandlersStart: number; /** * Feature prefix to check is feature is enabled or disabled in site. * This check is only made if not false. Override on the subclass or override isFeatureDisabled function. - * @type {string} */ protected featurePrefix: string; @@ -78,24 +71,22 @@ export class CoreDelegate { * Name of the property to be used to index the handlers. By default, the handler's name will be used. * If your delegate uses a Moodle component name to identify the handlers, please override this property. * E.g. CoreCourseModuleDelegate uses 'modName' to index the handlers. - * @type {string} */ protected handlerNameProperty = 'name'; /** * Set of promises to update a handler, to prevent doing the same operation twice. - * @type {{[siteId: string]: {[name: string]: Promise}}} */ protected updatePromises: {[siteId: string]: {[name: string]: Promise}} = {}; /** * Constructor of the Delegate. * - * @param {string} delegateName Delegate name used for logging purposes. - * @param {CoreLoggerProvider} loggerProvider CoreLoggerProvider instance, cannot be directly injected. - * @param {CoreSitesProvider} sitesProvider CoreSitesProvider instance, cannot be directly injected. - * @param {CoreEventsProvider} [eventsProvider] CoreEventsProvider instance, cannot be directly injected. - * If not set, no events will be fired. + * @param delegateName Delegate name used for logging purposes. + * @param loggerProvider CoreLoggerProvider instance, cannot be directly injected. + * @param sitesProvider CoreSitesProvider instance, cannot be directly injected. + * @param eventsProvider CoreEventsProvider instance, cannot be directly injected. + * If not set, no events will be fired. */ constructor(delegateName: string, protected loggerProvider: CoreLoggerProvider, protected sitesProvider: CoreSitesProvider, protected eventsProvider?: CoreEventsProvider) { @@ -113,10 +104,10 @@ export class CoreDelegate { * Execute a certain function in a enabled handler. * If the handler isn't found or function isn't defined, call the same function in the default handler. * - * @param {string} handlerName The handler name. - * @param {string} fnName Name of the function to execute. - * @param {any[]} params Parameters to pass to the function. - * @return {any} Function returned value or default value. + * @param handlerName The handler name. + * @param fnName Name of the function to execute. + * @param params Parameters to pass to the function. + * @return Function returned value or default value. */ protected executeFunctionOnEnabled(handlerName: string, fnName: string, params?: any[]): any { return this.execute(this.enabledHandlers[handlerName], fnName, params); @@ -126,10 +117,10 @@ export class CoreDelegate { * Execute a certain function in a handler. * If the handler isn't found or function isn't defined, call the same function in the default handler. * - * @param {string} handlerName The handler name. - * @param {string} fnName Name of the function to execute. - * @param {any[]} params Parameters to pass to the function. - * @return {any} Function returned value or default value. + * @param handlerName The handler name. + * @param fnName Name of the function to execute. + * @param params Parameters to pass to the function. + * @return Function returned value or default value. */ protected executeFunction(handlerName: string, fnName: string, params?: any[]): any { return this.execute(this.handlers[handlerName], fnName, params); @@ -139,10 +130,10 @@ export class CoreDelegate { * Execute a certain function in a handler. * If the handler isn't found or function isn't defined, call the same function in the default handler. * - * @param {any} handler The handler. - * @param {string} fnName Name of the function to execute. - * @param {any[]} params Parameters to pass to the function. - * @return {any} Function returned value or default value. + * @param handler The handler. + * @param fnName Name of the function to execute. + * @param params Parameters to pass to the function. + * @return Function returned value or default value. */ private execute(handler: any, fnName: string, params?: any[]): any { if (handler && handler[fnName]) { @@ -155,9 +146,9 @@ export class CoreDelegate { /** * Get a handler. * - * @param {string} handlerName The handler name. - * @param {boolean} [enabled] Only enabled, or any. - * @return {CoreDelegateHandler} Handler. + * @param handlerName The handler name. + * @param enabled Only enabled, or any. + * @return Handler. */ protected getHandler(handlerName: string, enabled: boolean = false): CoreDelegateHandler { return enabled ? this.enabledHandlers[handlerName] : this.handlers[handlerName]; @@ -167,8 +158,8 @@ export class CoreDelegate { * Gets the handler full name for a given name. This is useful when the handlerNameProperty is different than "name". * E.g. blocks are indexed by blockName. If you call this function passing the blockName it will return the name. * - * @param {string} name Name used to indentify the handler. - * @return {string} Full name of corresponding handler. + * @param name Name used to indentify the handler. + * @return Full name of corresponding handler. */ getHandlerName(name: string): string { const handler = this.getHandler(name, true); @@ -183,10 +174,10 @@ export class CoreDelegate { /** * Check if function exists on a handler. * - * @param {string} handlerName The handler name. - * @param {string} fnName Name of the function to execute. - * @param {booealn} [onlyEnabled=true] If check only enabled handlers or all. - * @return {any} Function returned value or default value. + * @param handlerName The handler name. + * @param fnName Name of the function to execute. + * @param onlyEnabled If check only enabled handlers or all. + * @return Function returned value or default value. */ protected hasFunction(handlerName: string, fnName: string, onlyEnabled: boolean = true): any { const handler = onlyEnabled ? this.enabledHandlers[handlerName] : this.handlers[handlerName]; @@ -197,9 +188,9 @@ export class CoreDelegate { /** * Check if a handler name has a registered handler (not necessarily enabled). * - * @param {string} name The handler name. - * @param {boolean} [enabled] Only enabled, or any. - * @return {boolean} If the handler is registered or not. + * @param name The handler name. + * @param enabled Only enabled, or any. + * @return If the handler is registered or not. */ hasHandler(name: string, enabled: boolean = false): boolean { return enabled ? typeof this.enabledHandlers[name] !== 'undefined' : typeof this.handlers[name] !== 'undefined'; @@ -209,8 +200,8 @@ export class CoreDelegate { * Check if a time belongs to the last update handlers call. * This is to handle the cases where updateHandlers don't finish in the same order as they're called. * - * @param {number} time Time to check. - * @return {boolean} Whether it's the last call. + * @param time Time to check. + * @return Whether it's the last call. */ isLastUpdateCall(time: number): boolean { if (!this.lastUpdateHandlersStart) { @@ -223,8 +214,8 @@ export class CoreDelegate { /** * Register a handler. * - * @param {CoreDelegateHandler} handler The handler delegate object to register. - * @return {boolean} True when registered, false if already registered. + * @param handler The handler delegate object to register. + * @return True when registered, false if already registered. */ registerHandler(handler: CoreDelegateHandler): boolean { if (typeof this.handlers[handler[this.handlerNameProperty]] !== 'undefined') { @@ -242,9 +233,9 @@ export class CoreDelegate { /** * Update the handler for the current site. * - * @param {CoreDelegateHandler} handler The handler to check. - * @param {number} time Time this update process started. - * @return {Promise} Resolved when done. + * @param handler The handler to check. + * @param time Time this update process started. + * @return Resolved when done. */ protected updateHandler(handler: CoreDelegateHandler, time: number): Promise { const siteId = this.sitesProvider.getCurrentSiteId(), @@ -289,9 +280,9 @@ export class CoreDelegate { /** * Check if feature is enabled or disabled in the site, depending on the feature prefix and the handler name. * - * @param {CoreDelegateHandler} handler Handler to check. - * @param {CoreSite} site Site to check. - * @return {boolean} Whether is enabled or disabled in site. + * @param handler Handler to check. + * @param site Site to check. + * @return Whether is enabled or disabled in site. */ protected isFeatureDisabled(handler: CoreDelegateHandler, site: CoreSite): boolean { return typeof this.featurePrefix != 'undefined' && site.isFeatureDisabled(this.featurePrefix + handler.name); @@ -300,7 +291,7 @@ export class CoreDelegate { /** * Update the handlers for the current site. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected updateHandlers(): Promise { const promises = [], diff --git a/src/classes/interceptor.ts b/src/classes/interceptor.ts index 35e5c4597..9399c0a76 100644 --- a/src/classes/interceptor.ts +++ b/src/classes/interceptor.ts @@ -42,9 +42,9 @@ export class CoreInterceptor implements HttpInterceptor { /** * Serialize an object to be used in a request. * - * @param {any} obj Object to serialize. - * @param {boolean} [addNull] Add null values to the serialized as empty parameters. - * @return {string} Serialization of the object. + * @param obj Object to serialize. + * @param addNull Add null values to the serialized as empty parameters. + * @return Serialization of the object. */ static serialize(obj: any, addNull?: boolean): string { let query = '', diff --git a/src/classes/site.ts b/src/classes/site.ts index 4f885fe93..f3c2ff9b8 100644 --- a/src/classes/site.ts +++ b/src/classes/site.ts @@ -38,98 +38,82 @@ import { InAppBrowserObject } from '@ionic-native/in-app-browser'; export interface CoreSiteWSPreSets { /** * Get the value from the cache if it's still valid. - * @type {boolean} */ getFromCache?: boolean; /** * Save the result to the cache. - * @type {boolean} */ saveToCache?: boolean; /** * Ignore cache expiration. - * @type {boolean} */ omitExpires?: boolean; /** * Use the cache when a request fails. Defaults to true. - * @type {boolean} */ emergencyCache?: boolean; /** * If true, the app won't call the WS. If the data isn't cached, the call will fail. - * @type {boolean} */ forceOffline?: boolean; /** * Extra key to add to the cache when storing this call, to identify the entry. - * @type {string} */ cacheKey?: string; /** * Whether it should use cache key to retrieve the cached data instead of the request params. - * @type {boolean} */ getCacheUsingCacheKey?: boolean; /** * Same as getCacheUsingCacheKey, but for emergency cache. - * @type {boolean} */ getEmergencyCacheUsingCacheKey?: boolean; /** * If true, the cache entry will be deleted if the WS call returns an exception. - * @type {boolean} */ deleteCacheIfWSError?: boolean; /** * Whether it should only be 1 entry for this cache key (all entries with same key will be deleted). - * @type {boolean} */ uniqueCacheKey?: boolean; /** * Whether to filter WS response (moodlewssettingfilter). Defaults to true. - * @type {boolean} */ filter?: boolean; /** * Whether to rewrite URLs (moodlewssettingfileurl). Defaults to true. - * @type {boolean} */ rewriteurls?: boolean; /** * Defaults to true. Set to false when the expected response is null. - * @type {boolean} */ responseExpected?: boolean; /** * Defaults to 'object'. Use it when you expect a type that's not an object|array. - * @type {string} */ typeExpected?: string; /** * Wehther a pending request in the queue matching the same function and arguments can be reused instead of adding * a new request to the queue. Defaults to true for read requests. - * @type {boolean} */ reusePending?: boolean; /** * Whether the request will be be sent immediately as a single request. Defaults to false. - * @type {boolean} */ skipQueue?: boolean; @@ -142,7 +126,6 @@ export interface CoreSiteWSPreSets { * Update frequency. This value determines how often the cached data will be updated. Possible values: * CoreSite.FREQUENCY_USUALLY, CoreSite.FREQUENCY_OFTEN, CoreSite.FREQUENCY_SOMETIMES, CoreSite.FREQUENCY_RARELY. * Defaults to CoreSite.FREQUENCY_USUALLY. - * @type {number} */ updateFrequency?: number; } @@ -153,25 +136,21 @@ export interface CoreSiteWSPreSets { export interface LocalMobileResponse { /** * Code to identify the authentication method to use. - * @type {number} */ code: number; /** * Name of the service to use. - * @type {string} */ service?: string; /** * Code of the warning message. - * @type {string} */ warning?: string; /** * Whether core SSO is supported. - * @type {boolean} */ coreSupported?: boolean; } @@ -255,14 +234,14 @@ export class CoreSite { /** * Create a site. * - * @param {Injector} injector Angular injector to prevent having to pass all the required services. - * @param {string} id Site ID. - * @param {string} siteUrl Site URL. - * @param {string} [token] Site's WS token. - * @param {any} [info] Site info. - * @param {string} [privateToken] Private token. - * @param {any} [config] Site public config. - * @param {boolean} [loggedOut] Whether user is logged out. + * @param injector Angular injector to prevent having to pass all the required services. + * @param id Site ID. + * @param siteUrl Site URL. + * @param token Site's WS token. + * @param info Site info. + * @param privateToken Private token. + * @param config Site public config. + * @param loggedOut Whether user is logged out. */ constructor(injector: Injector, public id: string, public siteUrl: string, public token?: string, public infos?: any, public privateToken?: string, public config?: any, public loggedOut?: boolean) { @@ -300,7 +279,7 @@ export class CoreSite { /** * Get site ID. * - * @return {string} Site ID. + * @return Site ID. */ getId(): string { return this.id; @@ -309,7 +288,7 @@ export class CoreSite { /** * Get site URL. * - * @return {string} Site URL. + * @return Site URL. */ getURL(): string { return this.siteUrl; @@ -318,7 +297,7 @@ export class CoreSite { /** * Get site token. * - * @return {string} Site token. + * @return Site token. */ getToken(): string { return this.token; @@ -327,7 +306,7 @@ export class CoreSite { /** * Get site info. * - * @return {any} Site info. + * @return Site info. */ getInfo(): any { return this.infos; @@ -336,7 +315,7 @@ export class CoreSite { /** * Get site private token. * - * @return {string} Site private token. + * @return Site private token. */ getPrivateToken(): string { return this.privateToken; @@ -345,7 +324,7 @@ export class CoreSite { /** * Get site DB. * - * @return {SQLiteDB} Site DB. + * @return Site DB. */ getDb(): SQLiteDB { return this.db; @@ -354,7 +333,7 @@ export class CoreSite { /** * Get site user's ID. * - * @return {number} User's ID. + * @return User's ID. */ getUserId(): number { if (typeof this.infos != 'undefined' && typeof this.infos.userid != 'undefined') { @@ -365,7 +344,7 @@ export class CoreSite { /** * Get site Course ID for frontpage course. If not declared it will return 1 as default. * - * @return {number} Site Home ID. + * @return Site Home ID. */ getSiteHomeId(): number { return this.infos && this.infos.siteid || 1; @@ -374,7 +353,7 @@ export class CoreSite { /** * Get site name. * - * @return {string} Site name. + * @return Site name. */ getSiteName(): string { if (CoreConfigConstants.sitename) { @@ -388,7 +367,7 @@ export class CoreSite { /** * Set site ID. * - * @param {string} New ID. + * @param New ID. */ setId(id: string): void { this.id = id; @@ -398,7 +377,7 @@ export class CoreSite { /** * Set site token. * - * @param {string} New token. + * @param New token. */ setToken(token: string): void { this.token = token; @@ -407,7 +386,7 @@ export class CoreSite { /** * Set site private token. * - * @param {string} privateToken New private token. + * @param privateToken New private token. */ setPrivateToken(privateToken: string): void { this.privateToken = privateToken; @@ -416,7 +395,7 @@ export class CoreSite { /** * Check if user logged out from the site and needs to authenticate again. * - * @return {boolean} Whether is logged out. + * @return Whether is logged out. */ isLoggedOut(): boolean { return !!this.loggedOut; @@ -425,7 +404,7 @@ export class CoreSite { /** * Set site info. * - * @param {any} New info. + * @param New info. */ setInfo(infos: any): void { this.infos = infos; @@ -442,7 +421,7 @@ export class CoreSite { /** * Set site config. * - * @param {any} Config. + * @param Config. */ setConfig(config: any): void { if (config) { @@ -456,7 +435,7 @@ export class CoreSite { /** * Set site logged out. * - * @param {boolean} loggedOut True if logged out and needs to authenticate again, false otherwise. + * @param loggedOut True if logged out and needs to authenticate again, false otherwise. */ setLoggedOut(loggedOut: boolean): void { this.loggedOut = !!loggedOut; @@ -465,7 +444,7 @@ export class CoreSite { /** * Can the user access their private files? * - * @return {boolean} Whether can access my files. + * @return Whether can access my files. */ canAccessMyFiles(): boolean { const infos = this.getInfo(); @@ -476,7 +455,7 @@ export class CoreSite { /** * Can the user download files? * - * @return {boolean} Whether can download files. + * @return Whether can download files. */ canDownloadFiles(): boolean { const infos = this.getInfo(); @@ -487,9 +466,9 @@ export class CoreSite { /** * Can the user use an advanced feature? * - * @param {string} feature The name of the feature. - * @param {boolean} [whenUndefined=true] The value to return when the parameter is undefined. - * @return {boolean} Whether can use advanced feature. + * @param feature The name of the feature. + * @param whenUndefined The value to return when the parameter is undefined. + * @return Whether can use advanced feature. */ canUseAdvancedFeature(feature: string, whenUndefined: boolean = true): boolean { const infos = this.getInfo(); @@ -513,7 +492,7 @@ export class CoreSite { /** * Can the user upload files? * - * @return {boolean} Whether can upload files. + * @return Whether can upload files. */ canUploadFiles(): boolean { const infos = this.getInfo(); @@ -524,7 +503,7 @@ export class CoreSite { /** * Fetch site info from the Moodle site. * - * @return {Promise} A promise to be resolved when the site info is retrieved. + * @return A promise to be resolved when the site info is retrieved. */ fetchSiteInfo(): Promise { // The get_site_info WS call won't be cached. @@ -543,10 +522,10 @@ export class CoreSite { /** * Read some data from the Moodle site using WS. Requests are cached by default. * - * @param {string} method WS method to use. - * @param {any} data Data to send to the WS. - * @param {CoreSiteWSPreSets} [preSets] Extra options. - * @return {Promise} Promise resolved with the response, rejected with CoreWSError if it fails. + * @param method WS method to use. + * @param data Data to send to the WS. + * @param preSets Extra options. + * @return Promise resolved with the response, rejected with CoreWSError if it fails. */ read(method: string, data: any, preSets?: CoreSiteWSPreSets): Promise { preSets = preSets || {}; @@ -566,10 +545,10 @@ export class CoreSite { /** * Sends some data to the Moodle site using WS. Requests are NOT cached by default. * - * @param {string} method WS method to use. - * @param {any} data Data to send to the WS. - * @param {CoreSiteWSPreSets} [preSets] Extra options. - * @return {Promise} Promise resolved with the response, rejected with CoreWSError if it fails. + * @param method WS method to use. + * @param data Data to send to the WS. + * @param preSets Extra options. + * @return Promise resolved with the response, rejected with CoreWSError if it fails. */ write(method: string, data: any, preSets?: CoreSiteWSPreSets): Promise { preSets = preSets || {}; @@ -589,11 +568,11 @@ export class CoreSite { /** * WS request to the site. * - * @param {string} method The WebService method to be called. - * @param {any} data Arguments to pass to the method. - * @param {CoreSiteWSPreSets} preSets Extra options. - * @param {boolean} [retrying] True if we're retrying the call for some reason. This is to prevent infinite loops. - * @return {Promise} Promise resolved with the response, rejected with CoreWSError if it fails. + * @param method The WebService method to be called. + * @param data Arguments to pass to the method. + * @param preSets Extra options. + * @param retrying True if we're retrying the call for some reason. This is to prevent infinite loops. + * @return Promise resolved with the response, rejected with CoreWSError if it fails. * @description * * Sends a webservice request to the site. This method will automatically add the @@ -805,11 +784,11 @@ export class CoreSite { /** * Adds a request to the queue or calls it immediately when not using the queue. * - * @param {string} method The WebService method to be called. - * @param {any} data Arguments to pass to the method. - * @param {CoreSiteWSPreSets} preSets Extra options related to the site. - * @param {CoreWSPreSets} wsPreSets Extra options related to the WS call. - * @returns {Promise} Promise resolved with the response when the WS is called. + * @param method The WebService method to be called. + * @param data Arguments to pass to the method. + * @param preSets Extra options related to the site. + * @param wsPreSets Extra options related to the WS call. + * @return Promise resolved with the response when the WS is called. */ protected callOrEnqueueRequest(method: string, data: any, preSets: CoreSiteWSPreSets, wsPreSets: CoreWSPreSets): Promise { if (preSets.skipQueue || !this.wsAvailable('tool_mobile_call_external_functions')) { @@ -846,8 +825,8 @@ export class CoreSite { /** * Adds a request to the queue. * - * @param {RequestQueueItem} request The request to enqueue. - * @returns {Promise} Promise resolved with the response when the WS is called. + * @param request The request to enqueue. + * @return Promise resolved with the response when the WS is called. */ protected enqueueRequest(request: RequestQueueItem): Promise { @@ -957,9 +936,9 @@ export class CoreSite { /** * Check if a WS is available in this site. * - * @param {string} method WS name. - * @param {boolean} [checkPrefix=true] When true also checks with the compatibility prefix. - * @return {boolean} Whether the WS is available. + * @param method WS name. + * @param checkPrefix When true also checks with the compatibility prefix. + * @return Whether the WS is available. */ wsAvailable(method: string, checkPrefix: boolean = true): boolean { if (typeof this.infos == 'undefined') { @@ -981,9 +960,9 @@ export class CoreSite { /** * Get cache ID. * - * @param {string} method The WebService method. - * @param {any} data Arguments to pass to the method. - * @return {string} Cache ID. + * @param method The WebService method. + * @param data Arguments to pass to the method. + * @return Cache ID. */ protected getCacheId(method: string, data: any): string { return Md5.hashAsciiStr(method + ':' + this.utils.sortAndStringify(data)); @@ -992,9 +971,9 @@ export class CoreSite { /** * Get the cache ID used in Ionic 1 version of the app. * - * @param {string} method The WebService method. - * @param {any} data Arguments to pass to the method. - * @return {string} Cache ID. + * @param method The WebService method. + * @param data Arguments to pass to the method. + * @return Cache ID. */ protected getCacheOldId(method: string, data: any): string { return Md5.hashAsciiStr(method + ':' + JSON.stringify(data)); @@ -1003,12 +982,12 @@ export class CoreSite { /** * Get a WS response from cache. * - * @param {string} method The WebService method to be called. - * @param {any} data Arguments to pass to the method. - * @param {CoreSiteWSPreSets} preSets Extra options. - * @param {boolean} [emergency] Whether it's an "emergency" cache call (WS call failed). - * @param {any} [originalData] Arguments to pass to the method before being converted to strings. - * @return {Promise} Promise resolved with the WS response. + * @param method The WebService method to be called. + * @param data Arguments to pass to the method. + * @param preSets Extra options. + * @param emergency Whether it's an "emergency" cache call (WS call failed). + * @param originalData Arguments to pass to the method before being converted to strings. + * @return Promise resolved with the WS response. */ protected getFromCache(method: string, data: any, preSets: CoreSiteWSPreSets, emergency?: boolean, originalData?: any) : Promise { @@ -1092,11 +1071,11 @@ export class CoreSite { /** * Save a WS response to cache. * - * @param {string} method The WebService method. - * @param {any} data Arguments to pass to the method. - * @param {any} response The WS response. - * @param {CoreSiteWSPreSets} preSets Extra options. - * @return {Promise} Promise resolved when the response is saved. + * @param method The WebService method. + * @param data Arguments to pass to the method. + * @param response The WS response. + * @param preSets Extra options. + * @return Promise resolved when the response is saved. */ protected saveToCache(method: string, data: any, response: any, preSets: CoreSiteWSPreSets): Promise { if (!this.db) { @@ -1135,11 +1114,11 @@ export class CoreSite { /** * Delete a WS cache entry or entries. * - * @param {string} method The WebService method to be called. - * @param {any} data Arguments to pass to the method. - * @param {CoreSiteWSPreSets} preSets Extra options. - * @param {boolean} [allCacheKey] True to delete all entries with the cache key, false to delete only by ID. - * @return {Promise} Promise resolved when the entries are deleted. + * @param method The WebService method to be called. + * @param data Arguments to pass to the method. + * @param preSets Extra options. + * @param allCacheKey True to delete all entries with the cache key, false to delete only by ID. + * @return Promise resolved when the entries are deleted. */ protected deleteFromCache(method: string, data: any, preSets: CoreSiteWSPreSets, allCacheKey?: boolean): Promise { if (!this.db) { @@ -1158,10 +1137,10 @@ export class CoreSite { /* * Uploads a file using Cordova File API. * - * @param {string} filePath File path. - * @param {CoreWSFileUploadOptions} options File upload options. - * @param {Function} [onProgress] Function to call on progress. - * @return {Promise} Promise resolved when uploaded. + * @param filePath File path. + * @param options File upload options. + * @param onProgress Function to call on progress. + * @return Promise resolved when uploaded. */ uploadFile(filePath: string, options: CoreWSFileUploadOptions, onProgress?: (event: ProgressEvent) => any): Promise { if (!options.fileArea) { @@ -1177,7 +1156,7 @@ export class CoreSite { /** * Invalidates all the cache entries. * - * @return {Promise} Promise resolved when the cache entries are invalidated. + * @return Promise resolved when the cache entries are invalidated. */ invalidateWsCache(): Promise { if (!this.db) { @@ -1192,8 +1171,8 @@ export class CoreSite { /** * Invalidates all the cache entries with a certain key. * - * @param {string} key Key to search. - * @return {Promise} Promise resolved when the cache entries are invalidated. + * @param key Key to search. + * @return Promise resolved when the cache entries are invalidated. */ invalidateWsCacheForKey(key: string): Promise { if (!this.db) { @@ -1211,8 +1190,8 @@ export class CoreSite { /** * Invalidates all the cache entries in an array of keys. * - * @param {string[]} keys Keys to search. - * @return {Promise} Promise resolved when the cache entries are invalidated. + * @param keys Keys to search. + * @return Promise resolved when the cache entries are invalidated. */ invalidateMultipleWsCacheForKey(keys: string[]): Promise { if (!this.db) { @@ -1235,8 +1214,8 @@ export class CoreSite { /** * Invalidates all the cache entries whose key starts with a certain value. * - * @param {string} key Key to search. - * @return {Promise} Promise resolved when the cache entries are invalidated. + * @param key Key to search. + * @return Promise resolved when the cache entries are invalidated. */ invalidateWsCacheForKeyStartingWith(key: string): Promise { if (!this.db) { @@ -1257,8 +1236,8 @@ export class CoreSite { * Generic function for adding the wstoken to Moodle urls and for pointing to the correct script. * Uses CoreUtilsProvider.fixPluginfileURL, passing site's token. * - * @param {string} url The url to be fixed. - * @return {string} Fixed URL. + * @param url The url to be fixed. + * @return Fixed URL. */ fixPluginfileURL(url: string): string { return this.urlUtils.fixPluginfileURL(url, this.token, this.siteUrl); @@ -1267,7 +1246,7 @@ export class CoreSite { /** * Deletes site's DB. * - * @return {Promise} Promise to be resolved when the DB is deleted. + * @return Promise to be resolved when the DB is deleted. */ deleteDB(): Promise { return this.dbProvider.deleteDB('Site-' + this.id); @@ -1276,7 +1255,7 @@ export class CoreSite { /** * Deletes site's folder. * - * @return {Promise} Promise to be resolved when the DB is deleted. + * @return Promise to be resolved when the DB is deleted. */ deleteFolder(): Promise { if (this.fileProvider.isAvailable()) { @@ -1293,7 +1272,7 @@ export class CoreSite { /** * Get space usage of the site. * - * @return {Promise} Promise resolved with the site space usage (size). + * @return Promise resolved with the site space usage (size). */ getSpaceUsage(): Promise { if (this.fileProvider.isAvailable()) { @@ -1310,8 +1289,8 @@ export class CoreSite { /** * Returns the URL to the documentation of the app, based on Moodle version and current language. * - * @param {string} [page] Docs page to go to. - * @return {Promise} Promise resolved with the Moodle docs URL. + * @param page Docs page to go to. + * @return Promise resolved with the Moodle docs URL. */ getDocsUrl(page?: string): Promise { const release = this.infos.release ? this.infos.release : undefined; @@ -1322,8 +1301,8 @@ export class CoreSite { /** * Check if the local_mobile plugin is installed in the Moodle site. * - * @param {boolean} [retrying] True if we're retrying the check. - * @return {Promise} Promise resolved when the check is done. + * @param retrying True if we're retrying the check. + * @return Promise resolved when the check is done. */ checkLocalMobilePlugin(retrying?: boolean): Promise { const checkUrl = this.siteUrl + '/local/mobile/check.php', @@ -1379,7 +1358,7 @@ export class CoreSite { /** * Check if local_mobile has been installed in Moodle. * - * @return {boolean} Whether the App is able to use local_mobile plugin for this site. + * @return Whether the App is able to use local_mobile plugin for this site. */ checkIfAppUsesLocalMobile(): boolean { let appUsesLocalMobile = false; @@ -1400,7 +1379,7 @@ export class CoreSite { /** * Check if local_mobile has been installed in Moodle but the app is not using it. * - * @return {Promise} Promise resolved it local_mobile was added, rejected otherwise. + * @return Promise resolved it local_mobile was added, rejected otherwise. */ checkIfLocalMobileInstalledAndNotUsed(): Promise { const appUsesLocalMobile = this.checkIfAppUsesLocalMobile(); @@ -1423,8 +1402,8 @@ export class CoreSite { /** * Check if a URL belongs to this site. * - * @param {string} url URL to check. - * @return {boolean} Whether the URL belongs to this site. + * @param url URL to check. + * @return Whether the URL belongs to this site. */ containsUrl(url: string): boolean { if (!url) { @@ -1440,7 +1419,7 @@ export class CoreSite { /** * Get the public config of this site. * - * @return {Promise} Promise resolved with public config. Rejected with an object if error, see CoreWSProvider.callAjax. + * @return Promise resolved with public config. Rejected with an object if error, see CoreWSProvider.callAjax. */ getPublicConfig(): Promise { const preSets: CoreWSAjaxPreSets = { @@ -1479,9 +1458,9 @@ export class CoreSite { /** * Open a URL in browser using auto-login in the Moodle site if available. * - * @param {string} url The URL to open. - * @param {string} [alertMessage] If defined, an alert will be shown before opening the browser. - * @return {Promise} Promise resolved when done, rejected otherwise. + * @param url The URL to open. + * @param alertMessage If defined, an alert will be shown before opening the browser. + * @return Promise resolved when done, rejected otherwise. */ openInBrowserWithAutoLogin(url: string, alertMessage?: string): Promise { return this.openWithAutoLogin(false, url, undefined, alertMessage); @@ -1490,9 +1469,9 @@ export class CoreSite { /** * Open a URL in browser using auto-login in the Moodle site if available and the URL belongs to the site. * - * @param {string} url The URL to open. - * @param {string} [alertMessage] If defined, an alert will be shown before opening the browser. - * @return {Promise} Promise resolved when done, rejected otherwise. + * @param url The URL to open. + * @param alertMessage If defined, an alert will be shown before opening the browser. + * @return Promise resolved when done, rejected otherwise. */ openInBrowserWithAutoLoginIfSameSite(url: string, alertMessage?: string): Promise { return this.openWithAutoLoginIfSameSite(false, url, undefined, alertMessage); @@ -1501,10 +1480,10 @@ export class CoreSite { /** * Open a URL in inappbrowser using auto-login in the Moodle site if available. * - * @param {string} url The URL to open. - * @param {any} [options] Override default options passed to InAppBrowser. - * @param {string} [alertMessage] If defined, an alert will be shown before opening the inappbrowser. - * @return {Promise} Promise resolved when done. + * @param url The URL to open. + * @param options Override default options passed to InAppBrowser. + * @param alertMessage If defined, an alert will be shown before opening the inappbrowser. + * @return Promise resolved when done. */ openInAppWithAutoLogin(url: string, options?: any, alertMessage?: string): Promise { return this.openWithAutoLogin(true, url, options, alertMessage); @@ -1513,10 +1492,10 @@ export class CoreSite { /** * Open a URL in inappbrowser using auto-login in the Moodle site if available and the URL belongs to the site. * - * @param {string} url The URL to open. - * @param {object} [options] Override default options passed to inappbrowser. - * @param {string} [alertMessage] If defined, an alert will be shown before opening the inappbrowser. - * @return {Promise} Promise resolved when done. + * @param url The URL to open. + * @param options Override default options passed to inappbrowser. + * @param alertMessage If defined, an alert will be shown before opening the inappbrowser. + * @return Promise resolved when done. */ openInAppWithAutoLoginIfSameSite(url: string, options?: any, alertMessage?: string): Promise { return this.openWithAutoLoginIfSameSite(true, url, options, alertMessage); @@ -1525,11 +1504,11 @@ export class CoreSite { /** * Open a URL in browser or InAppBrowser using auto-login in the Moodle site if available. * - * @param {boolean} inApp True to open it in InAppBrowser, false to open in browser. - * @param {string} url The URL to open. - * @param {object} [options] Override default options passed to $cordovaInAppBrowser#open. - * @param {string} [alertMessage] If defined, an alert will be shown before opening the browser/inappbrowser. - * @return {Promise} Promise resolved when done. Resolve param is returned only if inApp=true. + * @param inApp True to open it in InAppBrowser, false to open in browser. + * @param url The URL to open. + * @param options Override default options passed to $cordovaInAppBrowser#open. + * @param alertMessage If defined, an alert will be shown before opening the browser/inappbrowser. + * @return Promise resolved when done. Resolve param is returned only if inApp=true. */ openWithAutoLogin(inApp: boolean, url: string, options?: any, alertMessage?: string): Promise { // Get the URL to open. @@ -1564,11 +1543,11 @@ export class CoreSite { /** * Open a URL in browser or InAppBrowser using auto-login in the Moodle site if available and the URL belongs to the site. * - * @param {boolean} inApp True to open it in InAppBrowser, false to open in browser. - * @param {string} url The URL to open. - * @param {object} [options] Override default options passed to inappbrowser. - * @param {string} [alertMessage] If defined, an alert will be shown before opening the browser/inappbrowser. - * @return {Promise} Promise resolved when done. Resolve param is returned only if inApp=true. + * @param inApp True to open it in InAppBrowser, false to open in browser. + * @param url The URL to open. + * @param options Override default options passed to inappbrowser. + * @param alertMessage If defined, an alert will be shown before opening the browser/inappbrowser. + * @return Promise resolved when done. Resolve param is returned only if inApp=true. */ openWithAutoLoginIfSameSite(inApp: boolean, url: string, options?: any, alertMessage?: string) : Promise { @@ -1589,9 +1568,9 @@ export class CoreSite { * Get the config of this site. * It is recommended to use getStoredConfig instead since it's faster and doesn't use network. * - * @param {string} [name] Name of the setting to get. If not set or false, all settings will be returned. - * @param {boolean} [ignoreCache] True if it should ignore cached data. - * @return {Promise} Promise resolved with site config. + * @param name Name of the setting to get. If not set or false, all settings will be returned. + * @param ignoreCache True if it should ignore cached data. + * @return Promise resolved with site config. */ getConfig(name?: string, ignoreCache?: boolean): Promise { const preSets: CoreSiteWSPreSets = { @@ -1628,7 +1607,7 @@ export class CoreSite { /** * Invalidates config WS call. * - * @return {Promise} Promise resolved when the data is invalidated. + * @return Promise resolved when the data is invalidated. */ invalidateConfig(): Promise { return this.invalidateWsCacheForKey(this.getConfigCacheKey()); @@ -1637,7 +1616,7 @@ export class CoreSite { /** * Get cache key for getConfig WS calls. * - * @return {string} Cache key. + * @return Cache key. */ protected getConfigCacheKey(): string { return 'tool_mobile_get_config'; @@ -1646,8 +1625,8 @@ export class CoreSite { /** * Get the stored config of this site. * - * @param {string} [name] Name of the setting to get. If not set, all settings will be returned. - * @return {any} Site config or a specific setting. + * @param name Name of the setting to get. If not set, all settings will be returned. + * @return Site config or a specific setting. */ getStoredConfig(name?: string): any { if (!this.config) { @@ -1664,8 +1643,8 @@ export class CoreSite { /** * Check if a certain feature is disabled in the site. * - * @param {string} name Name of the feature to check. - * @return {boolean} Whether it's disabled. + * @param name Name of the feature to check. + * @return Whether it's disabled. */ isFeatureDisabled(name: string): boolean { const disabledFeatures = this.getStoredConfig('tool_mobile_disabledfeatures'); @@ -1688,7 +1667,7 @@ export class CoreSite { /** * Get whether offline is disabled in the site. * - * @return {boolean} Whether it's disabled. + * @return Whether it's disabled. */ isOfflineDisabled(): boolean { return this.offlineDisabled; @@ -1698,8 +1677,8 @@ export class CoreSite { * Check if the site version is greater than one or several versions. * This function accepts a string or an array of strings. If array, the last version must be the highest. * - * @param {string | string[]} versions Version or list of versions to check. - * @return {boolean} Whether it's greater or equal, false otherwise. + * @param versions Version or list of versions to check. + * @return Whether it's greater or equal, false otherwise. * @description * If a string is supplied (e.g. '3.2.1'), it will check if the site version is greater or equal than this version. * @@ -1746,9 +1725,9 @@ export class CoreSite { /** * Given a URL, convert it to a URL that will auto-login if supported. * - * @param {string} url The URL to convert. - * @param {boolean} [showModal=true] Whether to show a loading modal. - * @return {Promise} Promise resolved with the converted URL. + * @param url The URL to convert. + * @param showModal Whether to show a loading modal. + * @return Promise resolved with the converted URL. */ getAutoLoginUrl(url: string, showModal: boolean = true): Promise { @@ -1793,8 +1772,8 @@ export class CoreSite { * Get a version number from a release version. * If release version is valid but not found in the list of Moodle releases, it will use the last released major version. * - * @param {string} version Release version to convert to version number. - * @return {number} Version number, 0 if invalid. + * @param version Release version to convert to version number. + * @return Version number, 0 if invalid. */ protected getVersionNumber(version: string): number { const data = this.getMajorAndMinor(version); @@ -1815,8 +1794,8 @@ export class CoreSite { /** * Given a release version, return the major and minor versions. * - * @param {string} version Release version (e.g. '3.1.0'). - * @return {object} Object with major and minor. Returns false if invalid version. + * @param version Release version (e.g. '3.1.0'). + * @return Object with major and minor. Returns false if invalid version. */ protected getMajorAndMinor(version: string): any { const match = version.match(/(\d)+(?:\.(\d)+)?(?:\.(\d)+)?/); @@ -1834,8 +1813,8 @@ export class CoreSite { /** * Given a release version, return the next major version number. * - * @param {string} version Release version (e.g. '3.1.0'). - * @return {number} Next major version number. + * @param version Release version (e.g. '3.1.0'). + * @return Next major version number. */ protected getNextMajorVersionNumber(version: string): number { const data = this.getMajorAndMinor(version), @@ -1860,8 +1839,8 @@ export class CoreSite { /** * Deletes a site setting. * - * @param {string} name The config name. - * @return {Promise} Promise resolved when done. + * @param name The config name. + * @return Promise resolved when done. */ deleteSiteConfig(name: string): Promise { return this.db.deleteRecords(CoreSite.CONFIG_TABLE, { name: name }); @@ -1870,9 +1849,9 @@ export class CoreSite { /** * Get a site setting on local device. * - * @param {string} name The config name. - * @param {any} [defaultValue] Default value to use if the entry is not found. - * @return {Promise} Resolves upon success along with the config data. Reject on failure. + * @param name The config name. + * @param defaultValue Default value to use if the entry is not found. + * @return Resolves upon success along with the config data. Reject on failure. */ getLocalSiteConfig(name: string, defaultValue?: any): Promise { return this.db.getRecord(CoreSite.CONFIG_TABLE, { name: name }).then((entry) => { @@ -1889,9 +1868,9 @@ export class CoreSite { /** * Set a site setting on local device. * - * @param {string} name The config name. - * @param {number|string} value The config value. Can only store number or strings. - * @return {Promise} Promise resolved when done. + * @param name The config name. + * @param value The config value. Can only store number or strings. + * @return Promise resolved when done. */ setLocalSiteConfig(name: string, value: number | string): Promise { return this.db.insertRecord(CoreSite.CONFIG_TABLE, { name: name, value: value }); diff --git a/src/classes/sqlitedb.ts b/src/classes/sqlitedb.ts index 9bc24272b..011690982 100644 --- a/src/classes/sqlitedb.ts +++ b/src/classes/sqlitedb.ts @@ -21,37 +21,31 @@ import { Platform } from 'ionic-angular'; export interface SQLiteDBTableSchema { /** * The table name. - * @type {string} */ name: string; /** * The columns to create in the table. - * @type {SQLiteDBColumnSchema[]} */ columns: SQLiteDBColumnSchema[]; /** * Names of columns that are primary key. Use it for compound primary keys. - * @type {string[]} */ primaryKeys?: string[]; /** * List of sets of unique columns. E.g: [['section', 'title'], ['author', 'title']]. - * @type {string[][]} */ uniqueKeys?: string[][]; /** * List of foreign keys. - * @type {SQLiteDBForeignKeySchema[]} */ foreignKeys?: SQLiteDBForeignKeySchema[]; /** * Check constraint for the table. - * @type {string} */ tableCheck?: string; } @@ -62,49 +56,41 @@ export interface SQLiteDBTableSchema { export interface SQLiteDBColumnSchema { /** * Column's name. - * @type {string} */ name: string; /** * Column's type. - * @type {string} */ type?: 'INTEGER' | 'REAL' | 'TEXT' | 'BLOB'; /** * Whether the column is a primary key. Use it only if primary key is a single column. - * @type {boolean} */ primaryKey?: boolean; /** * Whether it should be autoincremented. Only if primaryKey is true. - * @type {boolean} */ autoIncrement?: boolean; /** * True if column shouldn't be null. - * @type {boolean} */ notNull?: boolean; /** * WWhether the column is unique. - * @type {boolean} */ unique?: boolean; /** * Check constraint for the column. - * @type {string} */ check?: string; /** * Default value for the column. - * @type {string} */ default?: string; } @@ -115,25 +101,21 @@ export interface SQLiteDBColumnSchema { export interface SQLiteDBForeignKeySchema { /** * Columns to include in this foreign key. - * @type {string[]} */ columns: string[]; /** * The external table referenced by this key. - * @type {string} */ table: string; /** * List of referenced columns from the referenced table. - * @type {string[]} */ foreignColumns?: string[]; /** * Text with the actions to apply to the foreign key. - * @type {string} */ actions?: string; } @@ -154,9 +136,9 @@ export class SQLiteDB { /** * Create and open the database. * - * @param {string} name Database name. - * @param {SQLite} sqlite SQLite library. - * @param {Platform} platform Ionic platform. + * @param name Database name. + * @param sqlite SQLite library. + * @param platform Ionic platform. */ constructor(public name: string, private sqlite: SQLite, private platform: Platform) { this.init(); @@ -165,12 +147,12 @@ export class SQLiteDB { /** * Helper function to create a table if it doesn't exist. * - * @param {string} name The table name. - * @param {SQLiteDBColumnSchema[]} columns The columns to create in the table. - * @param {string[]} [primaryKeys] Names of columns that are primary key. Use it for compound primary keys. - * @param {string[][]} [uniqueKeys] List of sets of unique columns. E.g: [['section', 'title'], ['author', 'title']]. - * @param {SQLiteDBForeignKeySchema[]} [foreignKeys] List of foreign keys. - * @param {string} [tableCheck] Check constraint for the table. + * @param name The table name. + * @param columns The columns to create in the table. + * @param primaryKeys Names of columns that are primary key. Use it for compound primary keys. + * @param uniqueKeys List of sets of unique columns. E.g: [['section', 'title'], ['author', 'title']]. + * @param foreignKeys List of foreign keys. + * @param tableCheck Check constraint for the table. * @return SQL query. */ buildCreateTableSql(name: string, columns: SQLiteDBColumnSchema[], primaryKeys?: string[], uniqueKeys?: string[][], @@ -257,7 +239,7 @@ export class SQLiteDB { /** * Close the database. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ close(): Promise { return this.ready().then(() => { @@ -268,9 +250,9 @@ export class SQLiteDB { /** * Count the records in a table where all the given conditions met. * - * @param {string} table The table to query. - * @param {object} [conditions] The conditions to build the where clause. Must not contain numeric indexes. - * @return {Promise} Promise resolved with the count of records returned from the specified criteria. + * @param table The table to query. + * @param conditions The conditions to build the where clause. Must not contain numeric indexes. + * @return Promise resolved with the count of records returned from the specified criteria. */ countRecords(table: string, conditions?: object): Promise { const selectAndParams = this.whereClause(conditions); @@ -281,11 +263,11 @@ export class SQLiteDB { /** * Count the records in a table which match a particular WHERE clause. * - * @param {string} table The table to query. - * @param {string} [select] A fragment of SQL to be used in a where clause in the SQL call. - * @param {any} [params] An array of sql parameters. - * @param {string} [countItem] The count string to be used in the SQL call. Default is COUNT('x'). - * @return {Promise} Promise resolved with the count of records returned from the specified criteria. + * @param table The table to query. + * @param select A fragment of SQL to be used in a where clause in the SQL call. + * @param params An array of sql parameters. + * @param countItem The count string to be used in the SQL call. Default is COUNT('x'). + * @return Promise resolved with the count of records returned from the specified criteria. */ countRecordsSelect(table: string, select: string = '', params?: any, countItem: string = 'COUNT(\'x\')'): Promise { if (select) { @@ -300,9 +282,9 @@ export class SQLiteDB { * * Given a query that counts rows, return that count. * - * @param {string} sql The SQL string you wish to be executed. - * @param {any} [params] An array of sql parameters. - * @return {Promise} Promise resolved with the count. + * @param sql The SQL string you wish to be executed. + * @param params An array of sql parameters. + * @return Promise resolved with the count. */ countRecordsSql(sql: string, params?: any): Promise { return this.getFieldSql(sql, params).then((count) => { @@ -317,13 +299,13 @@ export class SQLiteDB { /** * Create a table if it doesn't exist. * - * @param {string} name The table name. - * @param {SQLiteDBColumnSchema[]} columns The columns to create in the table. - * @param {string[]} [primaryKeys] Names of columns that are primary key. Use it for compound primary keys. - * @param {string[][]} [uniqueKeys] List of sets of unique columns. E.g: [['section', 'title'], ['author', 'title']]. - * @param {SQLiteDBForeignKeySchema[]} [foreignKeys] List of foreign keys. - * @param {string} [tableCheck] Check constraint for the table. - * @return {Promise} Promise resolved when success. + * @param name The table name. + * @param columns The columns to create in the table. + * @param primaryKeys Names of columns that are primary key. Use it for compound primary keys. + * @param uniqueKeys List of sets of unique columns. E.g: [['section', 'title'], ['author', 'title']]. + * @param foreignKeys List of foreign keys. + * @param tableCheck Check constraint for the table. + * @return Promise resolved when success. */ createTable(name: string, columns: SQLiteDBColumnSchema[], primaryKeys?: string[], uniqueKeys?: string[][], foreignKeys?: SQLiteDBForeignKeySchema[], tableCheck?: string): Promise { @@ -335,8 +317,8 @@ export class SQLiteDB { /** * Create a table if it doesn't exist from a schema. * - * @param {SQLiteDBTableSchema} table Table schema. - * @return {Promise} Promise resolved when success. + * @param table Table schema. + * @return Promise resolved when success. */ createTableFromSchema(table: SQLiteDBTableSchema): Promise { return this.createTable(table.name, table.columns, table.primaryKeys, table.uniqueKeys, @@ -346,8 +328,8 @@ export class SQLiteDB { /** * Create several tables if they don't exist from a list of schemas. * - * @param {SQLiteDBTableSchema[]} tables List of table schema. - * @return {Promise} Promise resolved when success. + * @param tables List of table schema. + * @return Promise resolved when success. */ createTablesFromSchema(tables: SQLiteDBTableSchema[]): Promise { const promises = []; @@ -362,9 +344,9 @@ export class SQLiteDB { * Delete the records from a table where all the given conditions met. * If conditions not specified, table is truncated. * - * @param {string} table The table to delete from. - * @param {object} [conditions] The conditions to build the where clause. Must not contain numeric indexes. - * @return {Promise} Promise resolved when done. + * @param table The table to delete from. + * @param conditions The conditions to build the where clause. Must not contain numeric indexes. + * @return Promise resolved when done. */ deleteRecords(table: string, conditions?: object): Promise { if (conditions === null || typeof conditions == 'undefined') { @@ -380,10 +362,10 @@ export class SQLiteDB { /** * Delete the records from a table where one field match one list of values. * - * @param {string} table The table to delete from. - * @param {string} field The name of a field. - * @param {any[]} values The values field might take. - * @return {Promise} Promise resolved when done. + * @param table The table to delete from. + * @param field The name of a field. + * @param values The values field might take. + * @return Promise resolved when done. */ deleteRecordsList(table: string, field: string, values: any[]): Promise { const selectAndParams = this.whereClauseList(field, values); @@ -394,10 +376,10 @@ export class SQLiteDB { /** * Delete one or more records from a table which match a particular WHERE clause. * - * @param {string} table The table to delete from. - * @param {string} [select] A fragment of SQL to be used in a where clause in the SQL call. - * @param {any[]} [params] Array of sql parameters. - * @return {Promise} Promise resolved when done. + * @param table The table to delete from. + * @param select A fragment of SQL to be used in a where clause in the SQL call. + * @param params Array of sql parameters. + * @return Promise resolved when done. */ deleteRecordsSelect(table: string, select: string = '', params?: any[]): Promise { if (select) { @@ -410,8 +392,8 @@ export class SQLiteDB { /** * Drop a table if it exists. * - * @param {string} name The table name. - * @return {Promise} Promise resolved when success. + * @param name The table name. + * @return Promise resolved when success. */ dropTable(name: string): Promise { return this.execute(`DROP TABLE IF EXISTS ${name}`); @@ -422,9 +404,9 @@ export class SQLiteDB { * IMPORTANT: Use this function only if you cannot use any of the other functions in this API. Please take into account that * these query will be run in SQLite (Mobile) and Web SQL (desktop), so your query should work in both environments. * - * @param {string} sql SQL query to execute. - * @param {any[]} params Query parameters. - * @return {Promise} Promise resolved with the result. + * @param sql SQL query to execute. + * @param params Query parameters. + * @return Promise resolved with the result. */ execute(sql: string, params?: any[]): Promise { return this.ready().then(() => { @@ -437,8 +419,8 @@ export class SQLiteDB { * IMPORTANT: Use this function only if you cannot use any of the other functions in this API. Please take into account that * these query will be run in SQLite (Mobile) and Web SQL (desktop), so your query should work in both environments. * - * @param {any[]} sqlStatements SQL statements to execute. - * @return {Promise} Promise resolved with the result. + * @param sqlStatements SQL statements to execute. + * @return Promise resolved with the result. */ executeBatch(sqlStatements: any[]): Promise { return this.ready().then(() => { @@ -449,7 +431,7 @@ export class SQLiteDB { /** * Format the data to insert in the database. Removes undefined entries so they are stored as null instead of 'undefined'. * - * @param {object} data Data to insert. + * @param data Data to insert. */ protected formatDataToInsert(data: object): void { if (!data) { @@ -468,8 +450,8 @@ export class SQLiteDB { /** * Get all the records from a table. * - * @param {string} table The table to query. - * @return {Promise} Promise resolved with the records. + * @param table The table to query. + * @return Promise resolved with the records. */ getAllRecords(table: string): Promise { return this.getRecords(table); @@ -478,10 +460,10 @@ export class SQLiteDB { /** * Get a single field value from a table record where all the given conditions met. * - * @param {string} table The table to query. - * @param {string} field The field to return the value of. - * @param {object} [conditions] The conditions to build the where clause. Must not contain numeric indexes. - * @return {Promise} Promise resolved with the field's value. + * @param table The table to query. + * @param field The field to return the value of. + * @param conditions The conditions to build the where clause. Must not contain numeric indexes. + * @return Promise resolved with the field's value. */ getField(table: string, field: string, conditions?: object): Promise { const selectAndParams = this.whereClause(conditions); @@ -492,11 +474,11 @@ export class SQLiteDB { /** * Get a single field value from a table record which match a particular WHERE clause. * - * @param {string} table The table to query. - * @param {string} field The field to return the value of. - * @param {string} [select=''] A fragment of SQL to be used in a where clause returning one row with one column. - * @param {any[]} [params] Array of sql parameters. - * @return {Promise} Promise resolved with the field's value. + * @param table The table to query. + * @param field The field to return the value of. + * @param select A fragment of SQL to be used in a where clause returning one row with one column. + * @param params Array of sql parameters. + * @return Promise resolved with the field's value. */ getFieldSelect(table: string, field: string, select: string = '', params?: any[]): Promise { if (select) { @@ -509,9 +491,9 @@ export class SQLiteDB { /** * Get a single field value (first field) using a SQL statement. * - * @param {string} sql The SQL query returning one row with one column. - * @param {any[]} [params] An array of sql parameters. - * @return {Promise} Promise resolved with the field's value. + * @param sql The SQL query returning one row with one column. + * @param params An array of sql parameters. + * @return Promise resolved with the field's value. */ getFieldSql(sql: string, params?: any[]): Promise { return this.getRecordSql(sql, params).then((record) => { @@ -527,11 +509,11 @@ export class SQLiteDB { /** * Constructs 'IN()' or '=' sql fragment * - * @param {any} items A single value or array of values for the expression. It doesn't accept objects. - * @param {boolean} [equal=true] True means we want to equate to the constructed expression. - * @param {any} [onEmptyItems] This defines the behavior when the array of items provided is empty. Defaults to false, - * meaning return empty. Other values will become part of the returned SQL fragment. - * @return {any[]} A list containing the constructed sql fragment and an array of parameters. + * @param items A single value or array of values for the expression. It doesn't accept objects. + * @param equal True means we want to equate to the constructed expression. + * @param onEmptyItems This defines the behavior when the array of items provided is empty. Defaults to false, + * meaning return empty. Other values will become part of the returned SQL fragment. + * @return A list containing the constructed sql fragment and an array of parameters. */ getInOrEqual(items: any, equal: boolean = true, onEmptyItems?: any): any[] { let sql, @@ -571,7 +553,7 @@ export class SQLiteDB { /** * Get the database name. * - * @return {string} Database name. + * @return Database name. */ getName(): string { return this.name; @@ -580,10 +562,10 @@ export class SQLiteDB { /** * Get a single database record where all the given conditions met. * - * @param {string} table The table to query. - * @param {object} [conditions] The conditions to build the where clause. Must not contain numeric indexes. - * @param {string} [fields='*'] A comma separated list of fields to return. - * @return {Promise} Promise resolved with the record, rejected if not found. + * @param table The table to query. + * @param conditions The conditions to build the where clause. Must not contain numeric indexes. + * @param fields A comma separated list of fields to return. + * @return Promise resolved with the record, rejected if not found. */ getRecord(table: string, conditions?: object, fields: string = '*'): Promise { const selectAndParams = this.whereClause(conditions); @@ -594,11 +576,11 @@ export class SQLiteDB { /** * Get a single database record as an object which match a particular WHERE clause. * - * @param {string} table The table to query. - * @param {string} [select] A fragment of SQL to be used in a where clause in the SQL call. - * @param {any[]} [params] An array of sql parameters. - * @param {string} [fields='*'] A comma separated list of fields to return. - * @return {Promise} Promise resolved with the record, rejected if not found. + * @param table The table to query. + * @param select A fragment of SQL to be used in a where clause in the SQL call. + * @param params An array of sql parameters. + * @param fields A comma separated list of fields to return. + * @return Promise resolved with the record, rejected if not found. */ getRecordSelect(table: string, select: string = '', params: any[] = [], fields: string = '*'): Promise { if (select) { @@ -614,9 +596,9 @@ export class SQLiteDB { * The SQL statement should normally only return one record. * It is recommended to use getRecordsSql() if more matches possible! * - * @param {string} sql The SQL string you wish to be executed, should normally only return one record. - * @param {any[]} [params] List of sql parameters - * @return {Promise} Promise resolved with the records. + * @param sql The SQL string you wish to be executed, should normally only return one record. + * @param params List of sql parameters + * @return Promise resolved with the records. */ getRecordSql(sql: string, params?: any[]): Promise { return this.getRecordsSql(sql, params, 0, 1).then((result) => { @@ -633,13 +615,13 @@ export class SQLiteDB { /** * Get a number of records where all the given conditions met. * - * @param {string} table The table to query. - * @param {object} [conditions] The conditions to build the where clause. Must not contain numeric indexes. - * @param {string} [sort=''] An order to sort the results in. - * @param {string} [fields='*'] A comma separated list of fields to return. - * @param {number} [limitFrom=0] Return a subset of records, starting at this point. - * @param {number} [limitNum=0] Return a subset comprising this many records in total. - * @return {Promise} Promise resolved with the records. + * @param table The table to query. + * @param conditions The conditions to build the where clause. Must not contain numeric indexes. + * @param sort An order to sort the results in. + * @param fields A comma separated list of fields to return. + * @param limitFrom Return a subset of records, starting at this point. + * @param limitNum Return a subset comprising this many records in total. + * @return Promise resolved with the records. */ getRecords(table: string, conditions?: object, sort: string = '', fields: string = '*', limitFrom: number = 0, limitNum: number = 0): Promise { @@ -651,14 +633,14 @@ export class SQLiteDB { /** * Get a number of records where one field match one list of values. * - * @param {string} table The database table to be checked against. - * @param {string} field The name of a field. - * @param {any[]} values The values field might take. - * @param {string} [sort=''] An order to sort the results in. - * @param {string} [fields='*'] A comma separated list of fields to return. - * @param {number} [limitFrom=0] Return a subset of records, starting at this point. - * @param {number} [limitNum=0] Return a subset comprising this many records in total. - * @return {Promise} Promise resolved with the records. + * @param table The database table to be checked against. + * @param field The name of a field. + * @param values The values field might take. + * @param sort An order to sort the results in. + * @param fields A comma separated list of fields to return. + * @param limitFrom Return a subset of records, starting at this point. + * @param limitNum Return a subset comprising this many records in total. + * @return Promise resolved with the records. */ getRecordsList(table: string, field: string, values: any[], sort: string = '', fields: string = '*', limitFrom: number = 0, limitNum: number = 0): Promise { @@ -670,14 +652,14 @@ export class SQLiteDB { /** * Get a number of records which match a particular WHERE clause. * - * @param {string} table The table to query. - * @param {string} [select] A fragment of SQL to be used in a where clause in the SQL call. - * @param {any[]} [params] An array of sql parameters. - * @param {string} [sort=''] An order to sort the results in. - * @param {string} [fields='*'] A comma separated list of fields to return. - * @param {number} [limitFrom=0] Return a subset of records, starting at this point. - * @param {number} [limitNum=0] Return a subset comprising this many records in total. - * @return {Promise} Promise resolved with the records. + * @param table The table to query. + * @param select A fragment of SQL to be used in a where clause in the SQL call. + * @param params An array of sql parameters. + * @param sort An order to sort the results in. + * @param fields A comma separated list of fields to return. + * @param limitFrom Return a subset of records, starting at this point. + * @param limitNum Return a subset comprising this many records in total. + * @return Promise resolved with the records. */ getRecordsSelect(table: string, select: string = '', params: any[] = [], sort: string = '', fields: string = '*', limitFrom: number = 0, limitNum: number = 0): Promise { @@ -696,11 +678,11 @@ export class SQLiteDB { /** * Get a number of records using a SQL statement. * - * @param {string} sql The SQL select query to execute. - * @param {any[]} [params] List of sql parameters - * @param {number} [limitFrom] Return a subset of records, starting at this point. - * @param {number} [limitNum] Return a subset comprising this many records. - * @return {Promise} Promise resolved with the records. + * @param sql The SQL select query to execute. + * @param params List of sql parameters + * @param limitFrom Return a subset of records, starting at this point. + * @param limitNum Return a subset comprising this many records. + * @return Promise resolved with the records. */ getRecordsSql(sql: string, params?: any[], limitFrom?: number, limitNum?: number): Promise { const limits = this.normaliseLimitFromNum(limitFrom, limitNum); @@ -726,9 +708,9 @@ export class SQLiteDB { /** * Given a data object, returns the SQL query and the params to insert that record. * - * @param {string} table The database table. - * @param {object} data A data object with values for one or more fields in the record. - * @return {any[]} Array with the SQL query and the params. + * @param table The database table. + * @param data A data object with values for one or more fields in the record. + * @return Array with the SQL query and the params. */ protected getSqlInsertQuery(table: string, data: object): any[] { this.formatDataToInsert(data); @@ -760,9 +742,9 @@ export class SQLiteDB { /** * Insert a record into a table and return the "rowId" field. * - * @param {string} table The database table to be inserted into. - * @param {object} data A data object with values for one or more fields in the record. - * @return {Promise} Promise resolved with new rowId. Please notice this rowId is internal from SQLite. + * @param table The database table to be inserted into. + * @param data A data object with values for one or more fields in the record. + * @return Promise resolved with new rowId. Please notice this rowId is internal from SQLite. */ insertRecord(table: string, data: object): Promise { const sqlAndParams = this.getSqlInsertQuery(table, data); @@ -775,9 +757,9 @@ export class SQLiteDB { /** * Insert multiple records into database as fast as possible. * - * @param {string} table The database table to be inserted into. - * @param {object[]} dataObjects List of objects to be inserted. - * @return {Promise} Promise resolved when done. + * @param table The database table to be inserted into. + * @param dataObjects List of objects to be inserted. + * @return Promise resolved when done. */ insertRecords(table: string, dataObjects: object[]): Promise { if (!Array.isArray(dataObjects)) { @@ -796,11 +778,11 @@ export class SQLiteDB { /** * Insert multiple records into database from another table. * - * @param {string} table The database table to be inserted into. - * @param {string} source The database table to get the records from. - * @param {object} [conditions] The conditions to build the where clause. Must not contain numeric indexes. - * @param {string} [fields='*'] A comma separated list of fields to return. - * @return {Promise} Promise resolved when done. + * @param table The database table to be inserted into. + * @param source The database table to get the records from. + * @param conditions The conditions to build the where clause. Must not contain numeric indexes. + * @param fields A comma separated list of fields to return. + * @return Promise resolved when done. */ insertRecordsFrom(table: string, source: string, conditions?: object, fields: string = '*'): Promise { const selectAndParams = this.whereClause(conditions); @@ -815,9 +797,9 @@ export class SQLiteDB { * We explicitly treat null, '' and -1 as 0 in order to provide compatibility with how limit * values have been passed historically. * - * @param {any} limitFrom Where to start results from. - * @param {any} limitNum How many results to return. - * @return {number[]} Normalised limit params in array: [limitFrom, limitNum]. + * @param limitFrom Where to start results from. + * @param limitNum How many results to return. + * @return Normalised limit params in array: [limitFrom, limitNum]. */ normaliseLimitFromNum(limitFrom: any, limitNum: any): number[] { // We explicilty treat these cases as 0. @@ -839,7 +821,7 @@ export class SQLiteDB { /** * Open the database. Only needed if it was closed before, a database is automatically opened when created. * - * @return {Promise} Promise resolved when open. + * @return Promise resolved when open. */ open(): Promise { return this.ready().then(() => { @@ -850,7 +832,7 @@ export class SQLiteDB { /** * Wait for the DB to be ready. * - * @return {Promise} Promise resolved when ready. + * @return Promise resolved when ready. */ ready(): Promise { return this.promise; @@ -859,9 +841,9 @@ export class SQLiteDB { /** * Test whether a record exists in a table where all the given conditions met. * - * @param {string} table The table to check. - * @param {object} [conditions] The conditions to build the where clause. Must not contain numeric indexes. - * @return {Promise} Promise resolved if exists, rejected otherwise. + * @param table The table to check. + * @param conditions The conditions to build the where clause. Must not contain numeric indexes. + * @return Promise resolved if exists, rejected otherwise. */ recordExists(table: string, conditions?: object): Promise { return this.getRecord(table, conditions).then((record) => { @@ -874,10 +856,10 @@ export class SQLiteDB { /** * Test whether any records exists in a table which match a particular WHERE clause. * - * @param {string} table The table to query. - * @param {string} [select] A fragment of SQL to be used in a where clause in the SQL call. - * @param {any[]} [params] An array of sql parameters. - * @return {Promise} Promise resolved if exists, rejected otherwise. + * @param table The table to query. + * @param select A fragment of SQL to be used in a where clause in the SQL call. + * @param params An array of sql parameters. + * @return Promise resolved if exists, rejected otherwise. */ recordExistsSelect(table: string, select: string = '', params: any[] = []): Promise { return this.getRecordSelect(table, select, params).then((record) => { @@ -890,9 +872,9 @@ export class SQLiteDB { /** * Test whether a SQL SELECT statement returns any records. * - * @param {string} sql The SQL query returning one row with one column. - * @param {any[]} [params] An array of sql parameters. - * @return {Promise} Promise resolved if exists, rejected otherwise. + * @param sql The SQL query returning one row with one column. + * @param params An array of sql parameters. + * @return Promise resolved if exists, rejected otherwise. */ recordExistsSql(sql: string, params?: any[]): Promise { return this.getRecordSql(sql, params).then((record) => { @@ -905,8 +887,8 @@ export class SQLiteDB { /** * Test whether a table exists.. * - * @param {string} name The table name. - * @return {Promise} Promise resolved if exists, rejected otherwise. + * @param name The table name. + * @return Promise resolved if exists, rejected otherwise. */ tableExists(name: string): Promise { return this.recordExists('sqlite_master', {type: 'table', tbl_name: name}); @@ -915,10 +897,10 @@ export class SQLiteDB { /** * Update one or more records in a table. * - * @param {string} string table The database table to update. - * @param {any} data An object with the fields to update: fieldname=>fieldvalue. - * @param {any} [conditions] The conditions to build the where clause. Must not contain numeric indexes. - * @return {Promise} Promise resolved when updated. + * @param string table The database table to update. + * @param data An object with the fields to update: fieldname=>fieldvalue. + * @param conditions The conditions to build the where clause. Must not contain numeric indexes. + * @return Promise resolved when updated. */ updateRecords(table: string, data: any, conditions?: any): Promise { @@ -948,11 +930,11 @@ export class SQLiteDB { /** * Update one or more records in a table. It accepts a WHERE clause as a string. * - * @param {string} string table The database table to update. - * @param {any} data An object with the fields to update: fieldname=>fieldvalue. - * @param {string} [where] Where clause. Must not include the "WHERE" word. - * @param {any[]} [whereParams] Params for the where clause. - * @return {Promise} Promise resolved when updated. + * @param string table The database table to update. + * @param data An object with the fields to update: fieldname=>fieldvalue. + * @param where Where clause. Must not include the "WHERE" word. + * @param whereParams Params for the where clause. + * @return Promise resolved when updated. */ updateRecordsWhere(table: string, data: any, where?: string, whereParams?: any[]): Promise { if (!data || !Object.keys(data).length) { @@ -985,8 +967,8 @@ export class SQLiteDB { /** * Returns the SQL WHERE conditions. * - * @param {object} [conditions] The conditions to build the where clause. Must not contain numeric indexes. - * @return {any[]} An array list containing sql 'where' part and 'params'. + * @param conditions The conditions to build the where clause. Must not contain numeric indexes. + * @return An array list containing sql 'where' part and 'params'. */ whereClause(conditions: any = {}): any[] { if (!conditions || !Object.keys(conditions).length) { @@ -1013,9 +995,9 @@ export class SQLiteDB { /** * Returns SQL WHERE conditions for the ..._list group of methods. * - * @param {string} field The name of a field. - * @param {any[]} values The values field might take. - * @return {any[]} An array containing sql 'where' part and 'params'. + * @param field The name of a field. + * @param values The values field might take. + * @return An array containing sql 'where' part and 'params'. */ whereClauseList(field: string, values: any[]): any[] { if (!values || !values.length) { diff --git a/src/components/attachments/attachments.ts b/src/components/attachments/attachments.ts index 03ada9d5d..6f5f2ea16 100644 --- a/src/components/attachments/attachments.ts +++ b/src/components/attachments/attachments.ts @@ -106,8 +106,8 @@ export class CoreAttachmentsComponent implements OnInit { /** * Delete a file from the list. * - * @param {number} index The index of the file. - * @param {boolean} [askConfirm] Whether to ask confirm. + * @param index The index of the file. + * @param askConfirm Whether to ask confirm. */ delete(index: number, askConfirm?: boolean): void { let promise; @@ -129,8 +129,8 @@ export class CoreAttachmentsComponent implements OnInit { /** * A file was renamed. * - * @param {number} index Index of the file. - * @param {any} data The data received. + * @param index Index of the file. + * @param data The data received. */ renamed(index: number, data: any): void { this.files[index] = data.file; diff --git a/src/components/chart/chart.ts b/src/components/chart/chart.ts index 55ec191ca..f34d43242 100644 --- a/src/components/chart/chart.ts +++ b/src/components/chart/chart.ts @@ -117,8 +117,8 @@ export class CoreChartComponent implements OnDestroy, OnInit, OnChanges { /** * Generate random colors if needed. * - * @param {number} n Number of colors needed. - * @return {any[]} Array with the number of background colors requested. + * @param n Number of colors needed. + * @return Array with the number of background colors requested. */ protected getRandomColors(n: number): any[] { while (CoreChartComponent.backgroundColors.length < n) { diff --git a/src/components/context-menu/context-menu-item.ts b/src/components/context-menu/context-menu-item.ts index 0870cbcd3..9c9b6c182 100644 --- a/src/components/context-menu/context-menu-item.ts +++ b/src/components/context-menu/context-menu-item.ts @@ -85,9 +85,9 @@ export class CoreContextMenuItemComponent implements OnInit, OnDestroy, OnChange /** * Get a boolean value from item. * - * @param {any} value Value to check. - * @param {boolean} defaultValue Value to use if undefined. - * @return {boolean} Boolean value. + * @param value Value to check. + * @param defaultValue Value to use if undefined. + * @return Boolean value. */ protected getBooleanValue(value: any, defaultValue: boolean): boolean { if (typeof value == 'undefined') { diff --git a/src/components/context-menu/context-menu-popover.ts b/src/components/context-menu/context-menu-popover.ts index aa468f189..070e4362d 100644 --- a/src/components/context-menu/context-menu-popover.ts +++ b/src/components/context-menu/context-menu-popover.ts @@ -47,9 +47,9 @@ export class CoreContextMenuPopoverComponent { /** * Function called when an item is clicked. * - * @param {Event} event Click event. - * @param {CoreContextMenuItemComponent} item Item clicked. - * @return {boolean} Return true if success, false if error. + * @param event Click event. + * @param item Item clicked. + * @return Return true if success, false if error. */ itemClicked(event: Event, item: CoreContextMenuItemComponent): boolean { if (item.action.observers.length > 0) { diff --git a/src/components/context-menu/context-menu.ts b/src/components/context-menu/context-menu.ts index 42fca4504..3a8daf25c 100644 --- a/src/components/context-menu/context-menu.ts +++ b/src/components/context-menu/context-menu.ts @@ -76,7 +76,7 @@ export class CoreContextMenuComponent implements OnInit, OnDestroy { /** * Add a context menu item. * - * @param {CoreContextMenuItemComponent} item The item to add. + * @param item The item to add. */ addItem(item: CoreContextMenuItemComponent): void { if (this.parentContextMenu) { @@ -108,7 +108,7 @@ export class CoreContextMenuComponent implements OnInit, OnDestroy { * Merge the current context menu with the one passed as parameter. All the items in this menu will be moved to the * one passed as parameter. * - * @param {CoreContextMenuComponent} contextMenu The context menu where to move the items. + * @param contextMenu The context menu where to move the items. */ mergeContextMenus(contextMenu: CoreContextMenuComponent): void { this.parentContextMenu = contextMenu; @@ -128,7 +128,7 @@ export class CoreContextMenuComponent implements OnInit, OnDestroy { /** * Remove an item from the context menu. * - * @param {CoreContextMenuItemComponent} item The item to remove. + * @param item The item to remove. */ removeItem(item: CoreContextMenuItemComponent): void { if (this.parentContextMenu) { @@ -173,7 +173,7 @@ export class CoreContextMenuComponent implements OnInit, OnDestroy { /** * Show the context menu. * - * @param {MouseEvent} event Event. + * @param event Event. */ showContextMenu(event: MouseEvent): void { if (!this.expanded) { diff --git a/src/components/course-picker-menu/course-picker-menu-popover.ts b/src/components/course-picker-menu/course-picker-menu-popover.ts index 2e53d9f61..8a6fd955a 100644 --- a/src/components/course-picker-menu/course-picker-menu-popover.ts +++ b/src/components/course-picker-menu/course-picker-menu-popover.ts @@ -34,9 +34,9 @@ export class CoreCoursePickerMenuPopoverComponent { /** * Function called when a course is clicked. * - * @param {Event} event Click event. - * @param {any} course Course object clicked. - * @return {boolean} Return true if success, false if error. + * @param event Click event. + * @param course Course object clicked. + * @return Return true if success, false if error. */ coursePicked(event: Event, course: any): boolean { this.viewCtrl.dismiss(course); diff --git a/src/components/download-refresh/download-refresh.ts b/src/components/download-refresh/download-refresh.ts index 87d964c9b..b231514ca 100644 --- a/src/components/download-refresh/download-refresh.ts +++ b/src/components/download-refresh/download-refresh.ts @@ -44,8 +44,8 @@ export class CoreDownloadRefreshComponent { /** * Download clicked. * - * @param {Event} e Click event. - * @param {boolean} refresh Whether it's refreshing. + * @param e Click event. + * @param refresh Whether it's refreshing. */ download(e: Event, refresh: boolean): void { e.preventDefault(); diff --git a/src/components/dynamic-component/dynamic-component.ts b/src/components/dynamic-component/dynamic-component.ts index 36fe69cdc..58bb372ac 100644 --- a/src/components/dynamic-component/dynamic-component.ts +++ b/src/components/dynamic-component/dynamic-component.ts @@ -118,9 +118,9 @@ export class CoreDynamicComponent implements OnInit, OnChanges, DoCheck { /** * Call a certain function on the component. * - * @param {string} name Name of the function to call. - * @param {any[]} params List of params to send to the function. - * @return {any} Result of the call. Undefined if no component instance or the function doesn't exist. + * @param name Name of the function to call. + * @param params List of params to send to the function. + * @return Result of the call. Undefined if no component instance or the function doesn't exist. */ callComponentFunction(name: string, params?: any[]): any { if (this.instance && typeof this.instance[name] == 'function') { @@ -131,7 +131,7 @@ export class CoreDynamicComponent implements OnInit, OnChanges, DoCheck { /** * Create a component, add it to a container and set the input data. * - * @return {boolean} Whether the component was successfully created. + * @return Whether the component was successfully created. */ protected createComponent(): boolean { this.lastComponent = this.component; diff --git a/src/components/file/file.ts b/src/components/file/file.ts index 22d0c98af..30aa5b588 100644 --- a/src/components/file/file.ts +++ b/src/components/file/file.ts @@ -104,7 +104,7 @@ export class CoreFileComponent implements OnInit, OnDestroy { /** * Convenience function to get the file state and set variables based on it. * - * @return {Promise} Promise resolved when state has been calculated. + * @return Promise resolved when state has been calculated. */ protected calculateState(): Promise { return this.filepoolProvider.getFileStateByUrl(this.siteId, this.fileUrl, this.timemodified).then((state) => { @@ -118,7 +118,7 @@ export class CoreFileComponent implements OnInit, OnDestroy { /** * Convenience function to open a file, downloading it if needed. * - * @return {Promise} Promise resolved when file is opened. + * @return Promise resolved when file is opened. */ protected openFile(): Promise { return this.fileHelper.downloadAndOpenFile(this.file, this.component, this.componentId, this.state, (event) => { @@ -134,8 +134,8 @@ export class CoreFileComponent implements OnInit, OnDestroy { /** * Download a file and, optionally, open it afterwards. * - * @param {Event} [e] Click event. - * @param {boolean} openAfterDownload Whether the file should be opened after download. + * @param e Click event. + * @param openAfterDownload Whether the file should be opened after download. */ download(e?: Event, openAfterDownload: boolean = false): void { e && e.preventDefault(); @@ -198,7 +198,7 @@ export class CoreFileComponent implements OnInit, OnDestroy { /** * Delete the file. * - * @param {Event} e Click event. + * @param e Click event. */ delete(e: Event): void { e.preventDefault(); diff --git a/src/components/icon/icon.ts b/src/components/icon/icon.ts index 82e53d165..38c96f1fb 100644 --- a/src/components/icon/icon.ts +++ b/src/components/icon/icon.ts @@ -111,8 +111,8 @@ export class CoreIconComponent implements OnChanges, OnDestroy { /** * Check if the value is true or on. * - * @param {any} val value to be checked. - * @return {boolean} If has a value equivalent to true. + * @param val value to be checked. + * @return If has a value equivalent to true. */ isTrueProperty(val: any): boolean { if (typeof val === 'string') { diff --git a/src/components/iframe/iframe.ts b/src/components/iframe/iframe.ts index 722d9eae6..aa7584337 100644 --- a/src/components/iframe/iframe.ts +++ b/src/components/iframe/iframe.ts @@ -22,8 +22,6 @@ import { CoreDomUtilsProvider } from '@providers/utils/dom'; import { CoreIframeUtilsProvider } from '@providers/utils/iframe'; import { CoreSplitViewComponent } from '@components/split-view/split-view'; -/** - */ @Component({ selector: 'core-iframe', templateUrl: 'core-iframe.html' diff --git a/src/components/infinite-loading/infinite-loading.ts b/src/components/infinite-loading/infinite-loading.ts index 977eba6b7..5c5a3ff18 100644 --- a/src/components/infinite-loading/infinite-loading.ts +++ b/src/components/infinite-loading/infinite-loading.ts @@ -48,7 +48,7 @@ export class CoreInfiniteLoadingComponent implements OnChanges { /** * Detect changes on input properties. * - * @param {SimpleChange}} changes Changes. + * @param } changes Changes. */ ngOnChanges(changes: {[name: string]: SimpleChange}): void { if (changes.enabled && this.enabled && this.position == 'bottom') { @@ -64,7 +64,7 @@ export class CoreInfiniteLoadingComponent implements OnChanges { /** * Load More items calling the action provided. * - * @param {InfiniteScroll} [infiniteScroll] Infinite scroll object only if triggered from the scroll. + * @param infiniteScroll Infinite scroll object only if triggered from the scroll. */ loadMore(infiniteScroll?: InfiniteScroll): void { if (this.loadingMore) { @@ -110,7 +110,7 @@ export class CoreInfiniteLoadingComponent implements OnChanges { /** * Get the height of the element. * - * @return {number} Height. + * @return Height. */ getHeight(): number { return this.getElementHeight(this.topButton) + this.getElementHeight(this.infiniteEl) + @@ -120,8 +120,8 @@ export class CoreInfiniteLoadingComponent implements OnChanges { /** * Get the height of an element. * - * @param {ElementRef} element Element ref. - * @return {number} Height. + * @param element Element ref. + * @return Height. */ protected getElementHeight(element: ElementRef): number { if (element && element.nativeElement) { diff --git a/src/components/ion-tabs/ion-tabs.ts b/src/components/ion-tabs/ion-tabs.ts index 914d97ab6..f410ad3fe 100644 --- a/src/components/ion-tabs/ion-tabs.ts +++ b/src/components/ion-tabs/ion-tabs.ts @@ -61,7 +61,6 @@ export class CoreIonTabsComponent extends Tabs implements OnDestroy { /** * List of tabs that haven't been initialized yet. This is required because IonTab calls add() on the constructor, * but we need it to be called in OnInit to be able to determine the tab position. - * @type {CoreIonTabComponent[]} */ protected tabsNotInit: CoreIonTabComponent[] = []; @@ -95,9 +94,9 @@ export class CoreIonTabsComponent extends Tabs implements OnDestroy { /** * Add a new tab if it isn't already in the list of tabs. * - * @param {CoreIonTabComponent} tab The tab to add. - * @param {boolean} [isInit] Whether the tab has been initialized. - * @return {string} The tab ID. + * @param tab The tab to add. + * @param isInit Whether the tab has been initialized. + * @return The tab ID. */ add(tab: CoreIonTabComponent, isInit?: boolean): string { // Check if tab is already in the list of initialized tabs. @@ -146,7 +145,7 @@ export class CoreIonTabsComponent extends Tabs implements OnDestroy { /** * Initialize the tabs. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ initTabs(): Promise { if (!this.initialized && (this._loaded || typeof this._loaded == 'undefined')) { @@ -224,7 +223,7 @@ export class CoreIonTabsComponent extends Tabs implements OnDestroy { /** * Remove a tab from the list of tabs. * - * @param {CoreIonTabComponent} tab The tab to remove. + * @param tab The tab to remove. */ remove(tab: CoreIonTabComponent): void { // First search in the list of initialized tabs. @@ -274,11 +273,11 @@ export class CoreIonTabsComponent extends Tabs implements OnDestroy { /** * Select a tab. * - * @param {number|Tab} tabOrIndex Index, or the Tab instance, of the tab to select. - * @param {NavOptions} Nav options. - * @param {boolean} [fromUrl] Whether to load from a URL. - * @param {boolean} [manualClick] Whether the user manually clicked the tab. - * @return {Promise} Promise resolved when selected. + * @param tabOrIndex Index, or the Tab instance, of the tab to select. + * @param Nav options. + * @param fromUrl Whether to load from a URL. + * @param manualClick Whether the user manually clicked the tab. + * @return Promise resolved when selected. */ select(tabOrIndex: number | Tab, opts: NavOptions = {}, fromUrl?: boolean, manualClick?: boolean): Promise { @@ -314,8 +313,8 @@ export class CoreIonTabsComponent extends Tabs implements OnDestroy { /** * Select a tab by Index. First it will reset the status of the tab. * - * @param {number} index Index of the tab. - * @return {Promise} Promise resolved when selected. + * @param index Index of the tab. + * @return Promise resolved when selected. */ selectTabRootByIndex(index: number): Promise { if (this.initialized) { @@ -350,7 +349,7 @@ export class CoreIonTabsComponent extends Tabs implements OnDestroy { /** * Change tabs visibility to show/hide them from the view. * - * @param {boolean} visible If show or hide the tabs. + * @param visible If show or hide the tabs. */ changeVisibility(visible: boolean): void { if (this.hidden == visible) { @@ -374,8 +373,8 @@ export class CoreIonTabsComponent extends Tabs implements OnDestroy { /** * Confirm if the user wants to go to the root of the current tab. * - * @param {Tab} tab Tab to go to root. - * @return {Promise} Promise resolved when confirmed. + * @param tab Tab to go to root. + * @return Promise resolved when confirmed. */ confirmGoToRoot(tab: Tab): Promise { if (!tab || !tab.isSelected || (tab.getActive() && tab.getActive().isFirst())) { diff --git a/src/components/local-file/local-file.ts b/src/components/local-file/local-file.ts index b5f3140ec..025ffe751 100644 --- a/src/components/local-file/local-file.ts +++ b/src/components/local-file/local-file.ts @@ -93,7 +93,7 @@ export class CoreLocalFileComponent implements OnInit { /** * File clicked. * - * @param {Event} e Click event. + * @param e Click event. */ fileClicked(e: Event): void { if (this.editMode) { @@ -113,7 +113,7 @@ export class CoreLocalFileComponent implements OnInit { /** * Activate the edit mode. * - * @param {Event} e Click event. + * @param e Click event. */ activateEdit(e: Event): void { e.preventDefault(); @@ -125,8 +125,8 @@ export class CoreLocalFileComponent implements OnInit { /** * Rename the file. * - * @param {string} newName New name. - * @param {Event} e Click event. + * @param newName New name. + * @param e Click event. */ changeName(newName: string, e: Event): void { e.preventDefault(); @@ -165,7 +165,7 @@ export class CoreLocalFileComponent implements OnInit { /** * Delete the file. * - * @param {Event} e Click event. + * @param e Click event. */ deleteFile(e: Event): void { e.preventDefault(); diff --git a/src/components/navbar-buttons/navbar-buttons.ts b/src/components/navbar-buttons/navbar-buttons.ts index c38931322..c3332006e 100644 --- a/src/components/navbar-buttons/navbar-buttons.ts +++ b/src/components/navbar-buttons/navbar-buttons.ts @@ -111,7 +111,7 @@ export class CoreNavBarButtonsComponent implements OnInit, OnDestroy { /** * Force or unforce hiding all buttons. If this is true, it will override the "hidden" input. * - * @param {boolean} value The value to set. + * @param value The value to set. */ forceHide(value: boolean): void { this.forceHidden = value; @@ -122,7 +122,7 @@ export class CoreNavBarButtonsComponent implements OnInit, OnDestroy { /** * If both button containers have a context menu, merge them into a single one. * - * @param {HTMLElement} buttonsContainer The container where the buttons will be moved. + * @param buttonsContainer The container where the buttons will be moved. */ protected mergeContextMenus(buttonsContainer: HTMLElement): void { // Check if both button containers have a context menu. @@ -155,8 +155,8 @@ export class CoreNavBarButtonsComponent implements OnInit, OnDestroy { /** * Search the ion-header where the buttons should be added. * - * @param {number} [retries] Number of retries so far. - * @return {Promise} Promise resolved with the header element. + * @param retries Number of retries so far. + * @return Promise resolved with the header element. */ protected searchHeader(retries: number = 0): Promise { let parentPage: HTMLElement = this.element; @@ -196,8 +196,8 @@ export class CoreNavBarButtonsComponent implements OnInit, OnDestroy { /** * Search ion-header inside a page. The header should be a direct child. * - * @param {HTMLElement} page Page to search in. - * @return {HTMLElement} Header element. Undefined if not found. + * @param page Page to search in. + * @return Header element. Undefined if not found. */ protected searchHeaderInPage(page: HTMLElement): HTMLElement { for (let i = 0; i < page.children.length; i++) { @@ -232,7 +232,7 @@ export class CoreNavBarButtonsComponent implements OnInit, OnDestroy { /** * Show or hide an element. * - * @param {Node} element Element to show or hide. + * @param element Element to show or hide. */ protected showHideElement(element: Node): void { // Check if it's an HTML Element diff --git a/src/components/recaptcha/recaptchamodal.ts b/src/components/recaptcha/recaptchamodal.ts index 3739a74b5..b84e98f70 100644 --- a/src/components/recaptcha/recaptchamodal.ts +++ b/src/components/recaptcha/recaptchamodal.ts @@ -44,7 +44,7 @@ export class CoreRecaptchaModalComponent { /** * The iframe with the recaptcha was loaded. * - * @param {HTMLIFrameElement} iframe Iframe element. + * @param iframe Iframe element. */ loaded(iframe: HTMLIFrameElement): void { // Search the iframe content. diff --git a/src/components/rich-text-editor/rich-text-editor.ts b/src/components/rich-text-editor/rich-text-editor.ts index e9c8bc2b5..68c4651e0 100644 --- a/src/components/rich-text-editor/rich-text-editor.ts +++ b/src/components/rich-text-editor/rich-text-editor.ts @@ -153,7 +153,7 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy /** * Resize editor to maximize the space occupied. * - * @return {Promise} Resolved with calculated editor size. + * @return Resolved with calculated editor size. */ protected maximizeEditorSize = (): Promise => { this.content.resize(); @@ -210,8 +210,8 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy /** * Get the height of the surrounding elements from the current to the top element. * - * @param {any} element Directive DOM element to get surroundings elements from. - * @return {number} Surrounding height in px. + * @param element Directive DOM element to get surroundings elements from. + * @return Surrounding height in px. */ protected getSurroundingHeight(element: any): number { let height = 0; @@ -246,7 +246,7 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy /** * On change function to sync with form data. * - * @param {Event} $event The event. + * @param $event The event. */ onChange($event: Event): void { if (this.rteEnabled) { @@ -279,7 +279,7 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy * On key down function to move the cursor. * https://stackoverflow.com/questions/6249095/how-to-set-caretcursor-position-in-contenteditable-element-div * - * @param {Event} $event The event. + * @param $event The event. */ moveCursor($event: Event): void { if (!this.rteEnabled) { @@ -302,8 +302,8 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy /** * Returns the number of chars from the beggining where is placed the cursor. * - * @param {Node} parent Parent where to get the position from. - * @return {number} Position in chars. + * @param parent Parent where to get the position from. + * @return Position in chars. */ protected getCurrentCursorPosition(parent: Node): number { const selection = window.getSelection(); @@ -340,18 +340,18 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy /** * Set the caret position on the character number. * - * @param {Node} parent Parent where to set the position. - * @param {number} [chars] Number of chars where to place the caret. If not defined it will go to the end. + * @param parent Parent where to set the position. + * @param chars Number of chars where to place the caret. If not defined it will go to the end. */ protected setCurrentCursorPosition(parent: Node, chars?: number): void { /** * Loops round all the child text nodes within the supplied node and sets a range from the start of the initial node to * the characters. * - * @param {Node} node Node where to start. - * @param {Range} range Previous calculated range. - * @param {any} chars Object with counting of characters (input-output param). - * @return {Range} Selection range. + * @param node Node where to start. + * @param range Previous calculated range. + * @param chars Object with counting of characters (input-output param). + * @return Selection range. */ const setRange = (node: Node, range: Range, chars: any): Range => { if (chars.count === 0) { @@ -404,7 +404,7 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy /** * Toggle from rte editor to textarea syncing values. * - * @param {Event} $event The event. + * @param $event The event. */ toggleEditor($event: Event): void { $event.preventDefault(); @@ -481,7 +481,7 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy /** * Check if text is empty. - * @param {string} value text + * @param value text */ protected isNullOrWhiteSpace(value: string): boolean { if (value == null || typeof value == 'undefined') { @@ -497,7 +497,7 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy /** * Set the content of the textarea and the editor element. * - * @param {string} value New content. + * @param value New content. */ protected setContent(value: string): void { if (this.isNullOrWhiteSpace(value)) { @@ -530,8 +530,8 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy * Execute an action over the selected text. * API docs: https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand * - * @param {any} $event Event data - * @param {string} command Command to execute. + * @param $event Event data + * @param command Command to execute. */ buttonAction($event: any, command: string): void { this.stopBubble($event); @@ -568,7 +568,7 @@ export class CoreRichTextEditorComponent implements AfterContentInit, OnDestroy /** * Stop event default and propagation. * - * @param {Event} event Event. + * @param event Event. */ stopBubble(event: Event): void { event.preventDefault(); diff --git a/src/components/search-box/search-box.ts b/src/components/search-box/search-box.ts index e978908d1..36a42cb0d 100644 --- a/src/components/search-box/search-box.ts +++ b/src/components/search-box/search-box.ts @@ -62,7 +62,7 @@ export class CoreSearchBoxComponent implements OnInit { /** * Form submitted. * - * @param {Event} e Event. + * @param e Event. */ submitForm(e: Event): void { e.preventDefault(); diff --git a/src/components/send-message-form/send-message-form.ts b/src/components/send-message-form/send-message-form.ts index ae7a25ff9..48a7a87c6 100644 --- a/src/components/send-message-form/send-message-form.ts +++ b/src/components/send-message-form/send-message-form.ts @@ -66,7 +66,7 @@ export class CoreSendMessageFormComponent implements OnInit { /** * Form submitted. * - * @param {Event} $event Mouse event. + * @param $event Mouse event. */ submitForm($event: Event): void { $event.preventDefault(); @@ -95,8 +95,8 @@ export class CoreSendMessageFormComponent implements OnInit { /** * Enter key clicked. * - * @param {Event} e Event. - * @param {string} other The name of the other key that was clicked, undefined if no other key. + * @param e Event. + * @param other The name of the other key that was clicked, undefined if no other key. */ enterClicked(e: Event, other: string): void { if (this.sendOnEnter && !other) { diff --git a/src/components/show-password/show-password.ts b/src/components/show-password/show-password.ts index 68abdbf70..61dea32ef 100644 --- a/src/components/show-password/show-password.ts +++ b/src/components/show-password/show-password.ts @@ -103,7 +103,7 @@ export class CoreShowPasswordComponent implements OnInit, AfterViewInit { /** * Toggle show/hide password. * - * @param {Event} event The mouse event. + * @param event The mouse event. */ toggle(event: Event): void { event.preventDefault(); diff --git a/src/components/split-view/split-view.ts b/src/components/split-view/split-view.ts index ca807f10d..4a63bfe72 100644 --- a/src/components/split-view/split-view.ts +++ b/src/components/split-view/split-view.ts @@ -30,8 +30,8 @@ import { Subscription } from 'rxjs'; * * Accepts the following params: * - * @param {string|boolean} [when] When the split-pane should be shown. Can be a CSS media query expression, or a shortcut - * expression. Can also be a boolean expression. Check split-pane component documentation for more information. + * @param when When the split-pane should be shown. Can be a CSS media query expression, or a shortcut + * expression. Can also be a boolean expression. Check split-pane component documentation for more information. * * Example: * @@ -98,7 +98,7 @@ export class CoreSplitViewComponent implements OnInit, OnDestroy { /** * Get the details NavController. If split view is not enabled, it will return the master nav. * - * @return {NavController} Details NavController. + * @return Details NavController. */ getDetailsNav(): NavController { if (this.isEnabled) { @@ -111,7 +111,7 @@ export class CoreSplitViewComponent implements OnInit, OnDestroy { /** * Get the master NavController. * - * @return {NavController} Master NavController. + * @return Master NavController. */ getMasterNav(): NavController { return this.masterNav; @@ -172,7 +172,7 @@ export class CoreSplitViewComponent implements OnInit, OnDestroy { /** * Check if both panels are shown. It depends on screen width. * - * @return {boolean} If split view is enabled. + * @return If split view is enabled. */ isOn(): boolean { return !!this.isEnabled; @@ -181,9 +181,9 @@ export class CoreSplitViewComponent implements OnInit, OnDestroy { /** * Push a page to the navigation stack. It will decide where to load it depending on the size of the screen. * - * @param {any} page The component class or deeplink name you want to push onto the navigation stack. - * @param {any} params Any NavParams you want to pass along to the next view. - * @param {boolean} [retrying] Whether it's retrying. + * @param page The component class or deeplink name you want to push onto the navigation stack. + * @param params Any NavParams you want to pass along to the next view. + * @param retrying Whether it's retrying. */ push(page: any, params?: any, retrying?: boolean): void { // Check there's no ongoing push. @@ -224,7 +224,7 @@ export class CoreSplitViewComponent implements OnInit, OnDestroy { /** * Splitpanel visibility has changed. * - * @param {Boolean} isOn If it fits both panels at the same time. + * @param isOn If it fits both panels at the same time. */ onSplitPaneChanged(isOn: boolean): void { if (this.ignoreSplitChanged) { diff --git a/src/components/style/style.ts b/src/components/style/style.ts index b0790ca96..344327cd0 100644 --- a/src/components/style/style.ts +++ b/src/components/style/style.ts @@ -50,9 +50,9 @@ export class CoreStyleComponent implements OnChanges { /** * Add a prefix to all rules in a CSS string. * - * @param {string} css CSS code to be prefixed. - * @param {string} prefix Prefix css selector. - * @return {string} Prefixed CSS. + * @param css CSS code to be prefixed. + * @param prefix Prefix css selector. + * @return Prefixed CSS. */ protected prefixCSS(css: string, prefix: string): string { if (!css) { diff --git a/src/components/tabs/tab.ts b/src/components/tabs/tab.ts index fc4aaf2fc..763376374 100644 --- a/src/components/tabs/tab.ts +++ b/src/components/tabs/tab.ts @@ -148,7 +148,7 @@ export class CoreTabComponent implements OnInit, OnDestroy { * Get all child core-navbar-buttons. We need to use querySelectorAll because ContentChildren doesn't work with ng-template. * https://github.com/angular/angular/issues/14842 * - * @return {CoreNavBarButtonsComponent[]} List of component instances. + * @return List of component instances. */ protected getChildrenNavBarButtons(): CoreNavBarButtonsComponent[] { const elements = this.element.querySelectorAll('core-navbar-buttons'), @@ -167,7 +167,7 @@ export class CoreTabComponent implements OnInit, OnDestroy { /** * Show all hide all children navbar buttons. * - * @param {boolean} show Whether to show or hide the buttons. + * @param show Whether to show or hide the buttons. */ protected showHideNavBarButtons(show: boolean): void { const instances = this.getChildrenNavBarButtons(); diff --git a/src/components/tabs/tabs.ts b/src/components/tabs/tabs.ts index ba7b9fdb1..e60ea9b10 100644 --- a/src/components/tabs/tabs.ts +++ b/src/components/tabs/tabs.ts @@ -194,7 +194,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe /** * Add a new tab if it isn't already in the list of tabs. * - * @param {CoreTabComponent} tab The tab to add. + * @param tab The tab to add. */ addTab(tab: CoreTabComponent): void { // Check if tab is already in the list. @@ -248,8 +248,8 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe /** * Get the index of tab. * - * @param {any} tab Tab object to check. - * @return {number} Index number on the tabs array or -1 if not found. + * @param tab Tab object to check. + * @return Index number on the tabs array or -1 if not found. */ getIndex(tab: any): number { for (let i = 0; i < this.tabs.length; i++) { @@ -265,7 +265,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe /** * Get the current selected tab. * - * @return {CoreTabComponent} Selected tab. + * @return Selected tab. */ getSelected(): CoreTabComponent { return this.tabs[this.selected]; @@ -415,7 +415,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe /** * Show or hide the tabs. This is used when the user is scrolling inside a tab. * - * @param {any} scrollElement Scroll element to check scroll position. + * @param scrollElement Scroll element to check scroll position. */ showHideTabs(scrollElement: any): void { if (!this.tabBarHeight) { @@ -460,7 +460,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe /** * Remove a tab from the list of tabs. * - * @param {CoreTabComponent} tab The tab to remove. + * @param tab The tab to remove. */ removeTab(tab: CoreTabComponent): void { const index = this.getIndex(tab); @@ -472,7 +472,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe /** * Select a certain tab. * - * @param {number} index The index of the tab to select. + * @param index The index of the tab to select. */ selectTab(index: number): void { if (index == this.selected) { diff --git a/src/core/block/classes/base-block-component.ts b/src/core/block/classes/base-block-component.ts index 46dc2c33b..e3c7e75f6 100644 --- a/src/core/block/classes/base-block-component.ts +++ b/src/core/block/classes/base-block-component.ts @@ -49,10 +49,10 @@ export class CoreBlockBaseComponent implements OnInit { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @param {Function} [done] Function to call when done. - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @param done Function to call when done. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved when done. */ doRefresh(refresher?: any, done?: () => void, showErrors: boolean = false): Promise { if (this.loaded) { @@ -68,8 +68,8 @@ export class CoreBlockBaseComponent implements OnInit { /** * Perform the refresh content function. * - * @param {boolean} [showErrors=false] Wether to show errors to the user or hide them. - * @return {Promise} Resolved when done. + * @param showErrors Wether to show errors to the user or hide them. + * @return Resolved when done. */ protected refreshContent(showErrors: boolean = false): Promise { // Wrap the call in a try/catch so the workflow isn't interrupted if an error occurs. @@ -94,7 +94,7 @@ export class CoreBlockBaseComponent implements OnInit { /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { return Promise.resolve(); @@ -103,9 +103,9 @@ export class CoreBlockBaseComponent implements OnInit { /** * Loads the component contents and shows the corresponding error. * - * @param {boolean} [refresh=false] Whether we're refreshing data. - * @param {boolean} [showErrors=false] Wether to show errors to the user or hide them. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @param showErrors Wether to show errors to the user or hide them. + * @return Promise resolved when done. */ protected loadContent(refresh?: boolean, showErrors: boolean = false): Promise { // Wrap the call in a try/catch so the workflow isn't interrupted if an error occurs. @@ -131,8 +131,8 @@ export class CoreBlockBaseComponent implements OnInit { /** * Download the component contents. * - * @param {boolean} [refresh] Whether we're refreshing data. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @return Promise resolved when done. */ protected fetchContent(refresh?: boolean): Promise { return Promise.resolve(); diff --git a/src/core/block/classes/base-block-handler.ts b/src/core/block/classes/base-block-handler.ts index 695d8182e..8e5447d79 100644 --- a/src/core/block/classes/base-block-handler.ts +++ b/src/core/block/classes/base-block-handler.ts @@ -32,7 +32,7 @@ export class CoreBlockBaseHandler implements CoreBlockHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -41,11 +41,11 @@ export class CoreBlockBaseHandler implements CoreBlockHandler { /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise { diff --git a/src/core/block/components/block/block.ts b/src/core/block/components/block/block.ts index eebf4fd4d..3632c972f 100644 --- a/src/core/block/components/block/block.ts +++ b/src/core/block/components/block/block.ts @@ -128,10 +128,10 @@ export class CoreBlockComponent implements OnInit, OnDestroy, DoCheck { /** * Refresh the data. * - * @param {any} [refresher] Refresher. Please pass this only if the refresher should finish when this function finishes. - * @param {Function} [done] Function to call when done. - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. Please pass this only if the refresher should finish when this function finishes. + * @param done Function to call when done. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved when done. */ doRefresh(refresher?: any, done?: () => void, showErrors: boolean = false): Promise { if (this.dynamicComponent) { @@ -144,7 +144,7 @@ export class CoreBlockComponent implements OnInit, OnDestroy, DoCheck { /** * Invalidate some data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ invalidate(): Promise { if (this.dynamicComponent) { diff --git a/src/core/block/components/course-blocks/course-blocks.ts b/src/core/block/components/course-blocks/course-blocks.ts index c1b849c56..e973eac72 100644 --- a/src/core/block/components/course-blocks/course-blocks.ts +++ b/src/core/block/components/course-blocks/course-blocks.ts @@ -57,7 +57,7 @@ export class CoreBlockCourseBlocksComponent implements OnInit { /** * Invalidate blocks data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ invalidateBlocks(): Promise { const promises = []; @@ -79,7 +79,7 @@ export class CoreBlockCourseBlocksComponent implements OnInit { /** * Convenience function to fetch the data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ loadContent(): Promise { return this.blockHelper.getCourseBlocks(this.courseId).then((blocks) => { diff --git a/src/core/block/providers/delegate.ts b/src/core/block/providers/delegate.ts index 7f0f245f3..2f9d96fdc 100644 --- a/src/core/block/providers/delegate.ts +++ b/src/core/block/providers/delegate.ts @@ -28,18 +28,17 @@ import { Subject } from 'rxjs'; export interface CoreBlockHandler extends CoreDelegateHandler { /** * Name of the block the handler supports. E.g. 'activity_modules'. - * @type {string} */ blockName: string; /** * Returns the data needed to render the block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Data or promise resolved with the data. */ getDisplayData?(injector: Injector, block: any, contextLevel: string, instanceId: number) : CoreBlockHandlerData | Promise; @@ -51,38 +50,32 @@ export interface CoreBlockHandler extends CoreDelegateHandler { export interface CoreBlockHandlerData { /** * Title to display for the block. - * @type {string} */ title: string; /** * Class to add to the displayed block. - * @type {string} */ class?: string; /** * The component to render the contents of the block. * It's recommended to return the class of the component, but you can also return an instance of the component. - * @type {any} */ component: any; /** * Data to pass to the component. All the properties in this object will be passed to the component as inputs. - * @type {any} */ componentData?: any; /** * Link to go when showing only title. - * @type {string} */ link?: string; /** * Params of the link. - * @type {[type]} */ linkParams?: any; } @@ -108,8 +101,8 @@ export class CoreBlockDelegate extends CoreDelegate { /** * Check if blocks are disabled in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's disabled. + * @param site Site. If not defined, use current site. + * @return Whether it's disabled. */ areBlocksDisabledInSite(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -120,8 +113,8 @@ export class CoreBlockDelegate extends CoreDelegate { /** * Check if blocks are disabled in a certain site for courses. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's disabled. + * @param site Site. If not defined, use current site. + * @return Whether it's disabled. */ areBlocksDisabledInCourses(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -132,8 +125,8 @@ export class CoreBlockDelegate extends CoreDelegate { /** * Check if blocks are disabled in a certain site. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. */ areBlocksDisabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -144,11 +137,11 @@ export class CoreBlockDelegate extends CoreDelegate { /** * Get the display data for a certain block. * - * @param {Injector} injector Injector. - * @param {any} block The block to render. - * @param {string} contextLevel The context where the block will be used. - * @param {number} instanceId The instance ID associated with the context level. - * @return {Promise} Promise resolved with the display data. + * @param injector Injector. + * @param block The block to render. + * @param contextLevel The context where the block will be used. + * @param instanceId The instance ID associated with the context level. + * @return Promise resolved with the display data. */ getBlockDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number): Promise { return Promise.resolve(this.executeFunctionOnEnabled(block.name, 'getDisplayData', @@ -158,8 +151,8 @@ export class CoreBlockDelegate extends CoreDelegate { /** * Check if any of the blocks in a list is supported. * - * @param {any[]} blocks The list of blocks. - * @return {boolean} Whether any of the blocks is supported. + * @param blocks The list of blocks. + * @return Whether any of the blocks is supported. */ hasSupportedBlock(blocks: any[]): boolean { blocks = blocks || []; @@ -170,8 +163,8 @@ export class CoreBlockDelegate extends CoreDelegate { /** * Check if a block is supported. * - * @param {string} name Block "name". E.g. 'activity_modules'. - * @return {boolean} Whether it's supported. + * @param name Block "name". E.g. 'activity_modules'. + * @return Whether it's supported. */ isBlockSupported(name: string): boolean { return this.hasHandler(name, true); @@ -180,9 +173,9 @@ export class CoreBlockDelegate extends CoreDelegate { /** * Check if feature is enabled or disabled in the site, depending on the feature prefix and the handler name. * - * @param {CoreDelegateHandler} handler Handler to check. - * @param {CoreSite} site Site to check. - * @return {boolean} Whether is enabled or disabled in site. + * @param handler Handler to check. + * @param site Site to check. + * @return Whether is enabled or disabled in site. */ protected isFeatureDisabled(handler: CoreDelegateHandler, site: CoreSite): boolean { return this.areBlocksDisabledInSite(site) || super.isFeatureDisabled(handler, site); diff --git a/src/core/block/providers/helper.ts b/src/core/block/providers/helper.ts index 14473f757..9272bca16 100644 --- a/src/core/block/providers/helper.ts +++ b/src/core/block/providers/helper.ts @@ -27,7 +27,7 @@ export class CoreBlockHelperProvider { /** * Return if it get course blocks options is enabled for the current site. * - * @return {boolean} true if enabled, false otherwise. + * @return true if enabled, false otherwise. */ canGetCourseBlocks(): boolean { return this.courseProvider.canGetCourseBlocks() && !this.blockDelegate.areBlocksDisabledInCourses(); @@ -36,8 +36,8 @@ export class CoreBlockHelperProvider { /** * Returns the list of blocks for the selected course. * - * @param {number} courseId Course ID. - * @return {Promise} List of supported blocks. + * @param courseId Course ID. + * @return List of supported blocks. */ getCourseBlocks(courseId: number): Promise { const canGetBlocks = this.canGetCourseBlocks(); diff --git a/src/core/comments/components/comments/comments.ts b/src/core/comments/components/comments/comments.ts index 6bbe34fc4..d37e325c8 100644 --- a/src/core/comments/components/comments/comments.ts +++ b/src/core/comments/components/comments/comments.ts @@ -117,7 +117,7 @@ export class CoreCommentsCommentsComponent implements OnChanges, OnDestroy { /** * Refresh comments. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ doRefresh(): Promise { return this.invalidateComments().then(() => { @@ -128,7 +128,7 @@ export class CoreCommentsCommentsComponent implements OnChanges, OnDestroy { /** * Invalidate comments data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ invalidateComments(): Promise { return this.commentsProvider.invalidateCommentsData(this.contextLevel, this.instanceId, this.component, this.itemId, @@ -170,9 +170,9 @@ export class CoreCommentsCommentsComponent implements OnChanges, OnDestroy { /** * Check if a certain value in data is undefined or equal to this instance value. * - * @param {any} data Data object. - * @param {string} name Name of the property to check. - * @return {boolean} Whether it's undefined or equal. + * @param data Data object. + * @param name Name of the property to check. + * @return Whether it's undefined or equal. */ protected undefinedOrEqual(data: any, name: string): boolean { return typeof data[name] == 'undefined' || data[name] == this[name]; diff --git a/src/core/comments/pages/add/add.ts b/src/core/comments/pages/add/add.ts index 66510fb79..bfabd4535 100644 --- a/src/core/comments/pages/add/add.ts +++ b/src/core/comments/pages/add/add.ts @@ -49,7 +49,7 @@ export class CoreCommentsAddPage { /** * Send the comment or store it offline. * - * @param {Event} e Event. + * @param e Event. */ addComment(e: Event): void { e.preventDefault(); diff --git a/src/core/comments/pages/viewer/viewer.ts b/src/core/comments/pages/viewer/viewer.ts index e84d27e0c..b1925c26d 100644 --- a/src/core/comments/pages/viewer/viewer.ts +++ b/src/core/comments/pages/viewer/viewer.ts @@ -113,9 +113,9 @@ export class CoreCommentsViewerPage implements OnDestroy { /** * Fetches the comments. * - * @param {boolean} sync When to resync comments. - * @param {boolean} [showErrors] When to display errors or not. - * @return {Promise} Resolved when done. + * @param sync When to resync comments. + * @param showErrors When to display errors or not. + * @return Resolved when done. */ protected fetchComments(sync: boolean, showErrors?: boolean): Promise { this.loadMoreError = false; @@ -204,8 +204,8 @@ export class CoreCommentsViewerPage implements OnDestroy { /** * Function to load more commemts. * - * @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. - * @return {Promise} Resolved when done. + * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. + * @return Resolved when done. */ loadMore(infiniteComplete?: any): Promise { this.page++; @@ -219,9 +219,9 @@ export class CoreCommentsViewerPage implements OnDestroy { /** * Refresh the comments. * - * @param {boolean} showErrors Whether to display errors or not. - * @param {any} [refresher] Refresher. - * @return {Promise} Resolved when done. + * @param showErrors Whether to display errors or not. + * @param refresher Refresher. + * @return Resolved when done. */ refreshComments(showErrors: boolean, refresher?: any): Promise { this.refreshIcon = 'spinner'; @@ -241,7 +241,7 @@ export class CoreCommentsViewerPage implements OnDestroy { /** * Show sync warnings if any. * - * @param {string[]} warnings the warnings + * @param warnings the warnings */ private showSyncWarnings(warnings: string[]): void { const message = this.textUtils.buildMessage(warnings); @@ -253,8 +253,8 @@ export class CoreCommentsViewerPage implements OnDestroy { /** * Tries to synchronize comments. * - * @param {boolean} showErrors Whether to display errors or not. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param showErrors Whether to display errors or not. + * @return Promise resolved if sync is successful, rejected otherwise. */ private syncComments(showErrors: boolean): Promise { return this.commentsSync.syncComments(this.contextLevel, this.instanceId, this.componentName, this.itemId, @@ -272,7 +272,7 @@ export class CoreCommentsViewerPage implements OnDestroy { /** * Add a new comment to the list. * - * @param {Event} e Event. + * @param e Event. */ addComment(e: Event): void { e.preventDefault(); @@ -302,8 +302,8 @@ export class CoreCommentsViewerPage implements OnDestroy { /** * Delete a comment. * - * @param {Event} e Click event. - * @param {any} comment Comment to delete. + * @param e Click event. + * @param comment Comment to delete. */ deleteComment(e: Event, comment: any): void { e.preventDefault(); @@ -336,8 +336,8 @@ export class CoreCommentsViewerPage implements OnDestroy { /** * Restore a comment. * - * @param {Event} e Click event. - * @param {any} comment Comment to delete. + * @param e Click event. + * @param comment Comment to delete. */ undoDeleteComment(e: Event, comment: any): void { e.preventDefault(); diff --git a/src/core/comments/providers/comments.ts b/src/core/comments/providers/comments.ts index 16d7c8f95..24475b69a 100644 --- a/src/core/comments/providers/comments.ts +++ b/src/core/comments/providers/comments.ts @@ -37,14 +37,14 @@ export class CoreCommentsProvider { /** * Add a comment. * - * @param {string} content Comment text. - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: true if comment was sent to server, false if stored in device. + * @param content Comment text. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: true if comment was sent to server, false if stored in device. */ addComment(content: string, contextLevel: string, instanceId: number, component: string, itemId: number, area: string = '', siteId?: string): Promise { @@ -79,14 +79,14 @@ export class CoreCommentsProvider { /** * Add a comment. It will fail if offline or cannot connect. * - * @param {string} content Comment text. - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when added, rejected otherwise. + * @param content Comment text. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when added, rejected otherwise. */ addCommentOnline(content: string, contextLevel: string, instanceId: number, component: string, itemId: number, area: string = '', siteId?: string): Promise { @@ -114,10 +114,10 @@ export class CoreCommentsProvider { /** * Add several comments. It will fail if offline or cannot connect. * - * @param {any[]} comments Comments to save. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when added, rejected otherwise. Promise resolved doesn't mean that comments - * have been added, the resolve param can contain errors for comments not sent. + * @param comments Comments to save. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when added, rejected otherwise. Promise resolved doesn't mean that comments + * have been added, the resolve param can contain errors for comments not sent. */ addCommentsOnline(comments: any[], siteId?: string): Promise { if (!comments || !comments.length) { @@ -136,8 +136,8 @@ export class CoreCommentsProvider { /** * Check if Calendar is disabled in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's disabled. + * @param site Site. If not defined, use current site. + * @return Whether it's disabled. */ areCommentsDisabledInSite(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -148,8 +148,8 @@ export class CoreCommentsProvider { /** * Check if comments are disabled in a certain site. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. */ areCommentsDisabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -160,10 +160,10 @@ export class CoreCommentsProvider { /** * Delete a comment. * - * @param {any} comment Comment object to delete. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when deleted, rejected otherwise. Promise resolved doesn't mean that comments - * have been deleted, the resolve param can contain errors for comments not deleted. + * @param comment Comment object to delete. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when deleted, rejected otherwise. Promise resolved doesn't mean that comments + * have been deleted, the resolve param can contain errors for comments not deleted. */ deleteComment(comment: any, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -204,15 +204,15 @@ export class CoreCommentsProvider { /** * Delete a comment. It will fail if offline or cannot connect. * - * @param {number[]} commentIds Comment IDs to delete. - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when deleted, rejected otherwise. Promise resolved doesn't mean that comments - * have been deleted, the resolve param can contain errors for comments not deleted. + * @param commentIds Comment IDs to delete. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when deleted, rejected otherwise. Promise resolved doesn't mean that comments + * have been deleted, the resolve param can contain errors for comments not deleted. */ deleteCommentsOnline(commentIds: number[], contextLevel: string, instanceId: number, component: string, itemId: number, area: string = '', siteId?: string): Promise { @@ -233,8 +233,8 @@ export class CoreCommentsProvider { /** * Returns whether WS to add/delete comments are available in site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if available, resolved with false or rejected otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if available, resolved with false or rejected otherwise. * @since 3.8 */ isAddCommentsAvailable(siteId?: string): Promise { @@ -251,12 +251,12 @@ export class CoreCommentsProvider { /** * Get cache key for get comments data WS calls. * - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @return {string} Cache key. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @return Cache key. */ protected getCommentsCacheKey(contextLevel: string, instanceId: number, component: string, itemId: number, area: string = ''): string { @@ -266,9 +266,9 @@ export class CoreCommentsProvider { /** * Get cache key for get comments instance data WS calls. * - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @return {string} Cache key. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @return Cache key. */ protected getCommentsPrefixCacheKey(contextLevel: string, instanceId: number): string { return this.ROOT_CACHE_KEY + 'comments:' + contextLevel + ':' + instanceId; @@ -277,14 +277,14 @@ export class CoreCommentsProvider { /** * Retrieve a list of comments. * - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @param {number} [page=0] Page number (0 based). Default 0. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the comments. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @param page Page number (0 based). Default 0. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the comments. */ getComments(contextLevel: string, instanceId: number, component: string, itemId: number, area: string = '', page: number = 0, siteId?: string): Promise { @@ -316,13 +316,13 @@ export class CoreCommentsProvider { /** * Get comments count number to show on the comments component. * - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Comments count with plus sign if needed. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @param siteId Site ID. If not defined, current site. + * @return Comments count with plus sign if needed. */ getCommentsCount(contextLevel: string, instanceId: number, component: string, itemId: number, area: string = '', siteId?: string): Promise { @@ -371,13 +371,13 @@ export class CoreCommentsProvider { /** * Invalidates comments data. * - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateCommentsData(contextLevel: string, instanceId: number, component: string, itemId: number, area: string = '', siteId?: string): Promise { @@ -396,10 +396,10 @@ export class CoreCommentsProvider { /** * Invalidates all comments data for an instance. * - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateCommentsByInstance(contextLevel: string, instanceId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/core/comments/providers/offline.ts b/src/core/comments/providers/offline.ts index 94caf9fb3..3979c9cb7 100644 --- a/src/core/comments/providers/offline.ts +++ b/src/core/comments/providers/offline.ts @@ -107,8 +107,8 @@ export class CoreCommentsOfflineProvider { /** * Get all offline comments. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with comments. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with comments. */ getAllComments(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -122,13 +122,13 @@ export class CoreCommentsOfflineProvider { /** * Get an offline comment. * - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the comments. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the comments. */ getComment(contextLevel: string, instanceId: number, component: string, itemId: number, area: string = '', siteId?: string): Promise { @@ -148,13 +148,13 @@ export class CoreCommentsOfflineProvider { /** * Get all offline comments added or deleted of a special area. * - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the comments. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the comments. */ getComments(contextLevel: string, instanceId: number, component: string, itemId: number, area: string = '', siteId?: string): Promise { @@ -176,8 +176,8 @@ export class CoreCommentsOfflineProvider { /** * Get all offline deleted comments. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with comments. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with comments. */ getAllDeletedComments(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -188,13 +188,13 @@ export class CoreCommentsOfflineProvider { /** * Get an offline comment. * - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the comments. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the comments. */ getDeletedComments(contextLevel: string, instanceId: number, component: string, itemId: number, area: string = '', siteId?: string): Promise { @@ -214,13 +214,13 @@ export class CoreCommentsOfflineProvider { /** * Remove an offline comment. * - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if deleted, rejected if failure. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if deleted, rejected if failure. */ removeComment(contextLevel: string, instanceId: number, component: string, itemId: number, area: string = '', siteId?: string): Promise { @@ -238,13 +238,13 @@ export class CoreCommentsOfflineProvider { /** * Remove an offline deleted comment. * - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if deleted, rejected if failure. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if deleted, rejected if failure. */ removeDeletedComments(contextLevel: string, instanceId: number, component: string, itemId: number, area: string = '', siteId?: string): Promise { @@ -262,14 +262,14 @@ export class CoreCommentsOfflineProvider { /** * Save a comment to be sent later. * - * @param {string} content Comment text. - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param content Comment text. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ saveComment(content: string, contextLevel: string, instanceId: number, component: string, itemId: number, area: string = '', siteId?: string): Promise { @@ -294,14 +294,14 @@ export class CoreCommentsOfflineProvider { /** * Delete a comment offline to be sent later. * - * @param {number} commentId Comment ID. - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if stored, rejected if failure. + * @param commentId Comment ID. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if stored, rejected if failure. */ deleteComment(commentId: number, contextLevel: string, instanceId: number, component: string, itemId: number, area: string = '', siteId?: string): Promise { @@ -326,9 +326,9 @@ export class CoreCommentsOfflineProvider { /** * Undo delete a comment. * - * @param {number} commentId Comment ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if deleted, rejected if failure. + * @param commentId Comment ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if deleted, rejected if failure. */ undoDeleteComment(commentId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/core/comments/providers/sync-cron-handler.ts b/src/core/comments/providers/sync-cron-handler.ts index 5803f936e..76d9e1529 100644 --- a/src/core/comments/providers/sync-cron-handler.ts +++ b/src/core/comments/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class CoreCommentsSyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.commentsSync.syncAllComments(siteId, force); @@ -40,7 +40,7 @@ export class CoreCommentsSyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return 300000; // 5 minutes. diff --git a/src/core/comments/providers/sync.ts b/src/core/comments/providers/sync.ts index c8466cac7..6e1003e98 100644 --- a/src/core/comments/providers/sync.ts +++ b/src/core/comments/providers/sync.ts @@ -46,9 +46,9 @@ export class CoreCommentsSyncProvider extends CoreSyncBaseProvider { /** * Try to synchronize all the comments in a certain site or in all sites. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncAllComments(siteId?: string, force?: boolean): Promise { return this.syncOnSites('all comments', this.syncAllCommentsFunc.bind(this), [force], siteId); @@ -57,9 +57,9 @@ export class CoreCommentsSyncProvider extends CoreSyncBaseProvider { /** * Synchronize all the comments in a certain site * - * @param {string} siteId Site ID to sync. - * @param {boolean} force Wether to force sync not depending on last execution. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. + * @param force Wether to force sync not depending on last execution. + * @return Promise resolved if sync is successful, rejected if sync fails. */ private syncAllCommentsFunc(siteId: string, force: boolean): Promise { return this.commentsOffline.getAllComments(siteId).then((comments) => { @@ -100,13 +100,13 @@ export class CoreCommentsSyncProvider extends CoreSyncBaseProvider { /** * Sync course comments only if a certain time has passed since the last time. * - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the comments are synced or if they don't need to be synced. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the comments are synced or if they don't need to be synced. */ private syncCommentsIfNeeded(contextLevel: string, instanceId: number, component: string, itemId: number, area: string = '', siteId?: string): Promise { @@ -122,13 +122,13 @@ export class CoreCommentsSyncProvider extends CoreSyncBaseProvider { /** * Synchronize comments in a particular area. * - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncComments(contextLevel: string, instanceId: number, component: string, itemId: number, area: string = '', siteId?: string): Promise { @@ -216,12 +216,12 @@ export class CoreCommentsSyncProvider extends CoreSyncBaseProvider { /** * Get the ID of a comments sync. * - * @param {string} contextLevel Contextlevel system, course, user... - * @param {number} instanceId The Instance id of item associated with the context level. - * @param {string} component Component name. - * @param {number} itemId Associated id. - * @param {string} [area=''] String comment area. Default empty. - * @return {string} Sync ID. + * @param contextLevel Contextlevel system, course, user... + * @param instanceId The Instance id of item associated with the context level. + * @param component Component name. + * @param itemId Associated id. + * @param area String comment area. Default empty. + * @return Sync ID. */ protected getSyncId(contextLevel: string, instanceId: number, component: string, itemId: number, area: string = ''): string { return contextLevel + '#' + instanceId + '#' + component + '#' + itemId + '#' + area; diff --git a/src/core/compile/components/compile-html/compile-html.ts b/src/core/compile/components/compile-html/compile-html.ts index 82c52cd8e..cf0bb0863 100644 --- a/src/core/compile/components/compile-html/compile-html.ts +++ b/src/core/compile/components/compile-html/compile-html.ts @@ -129,7 +129,7 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck { /** * Get a class that defines the dynamic component. * - * @return {any} The component class. + * @return The component class. */ protected getComponentClass(): any { // tslint:disable: no-this-assignment @@ -221,11 +221,11 @@ export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck { /** * Call a certain function on the component instance. * - * @param {string} name Name of the function to call. - * @param {any[]} params List of params to send to the function. - * @param {boolean} [callWhenCreated=true] If this param is true and the component hasn't been created yet, call the function - * once the component has been created. - * @return {any} Result of the call. Undefined if no component instance or the function doesn't exist. + * @param name Name of the function to call. + * @param params List of params to send to the function. + * @param callWhenCreated If this param is true and the component hasn't been created yet, call the function + * once the component has been created. + * @return Result of the call. Undefined if no component instance or the function doesn't exist. */ callComponentFunction(name: string, params?: any[], callWhenCreated: boolean = true): any { if (this.componentInstance) { diff --git a/src/core/compile/providers/compile.ts b/src/core/compile/providers/compile.ts index 7b76555ce..1cb152a84 100644 --- a/src/core/compile/providers/compile.ts +++ b/src/core/compile/providers/compile.ts @@ -154,10 +154,10 @@ export class CoreCompileProvider { /** * Create and compile a dynamic component. * - * @param {string} template The template of the component. - * @param {any} componentClass The JS class of the component. - * @param {any[]} [extraImports] Extra imported modules if needed and not imported by this class. - * @return {Promise>} Promise resolved with the factory to instantiate the component. + * @param template The template of the component. + * @param componentClass The JS class of the component. + * @param extraImports Extra imported modules if needed and not imported by this class. + * @return Promise resolved with the factory to instantiate the component. */ createAndCompileComponent(template: string, componentClass: any, extraImports: any[] = []): Promise> { // Create the component using the template and the class. @@ -190,8 +190,8 @@ export class CoreCompileProvider { /** * Eval some javascript using the context of the function. * - * @param {string} javascript The javascript to eval. - * @return {any} Result of the eval. + * @param javascript The javascript to eval. + * @return Result of the eval. */ protected evalInContext(javascript: string): any { // tslint:disable: no-eval @@ -201,9 +201,9 @@ export class CoreCompileProvider { /** * Execute some javascript code, using a certain instance as the context. * - * @param {any} instance Instance to use as the context. In the JS code, "this" will be this instance. - * @param {string} javascript The javascript code to eval. - * @return {any} Result of the javascript execution. + * @param instance Instance to use as the context. In the JS code, "this" will be this instance. + * @param javascript The javascript code to eval. + * @return Result of the javascript execution. */ executeJavascript(instance: any, javascript: string): any { try { @@ -216,8 +216,8 @@ export class CoreCompileProvider { /** * Inject all the core libraries in a certain object. * - * @param {any} instance The instance where to inject the libraries. - * @param {any[]} [extraProviders] Extra imported providers if needed and not imported by this class. + * @param instance The instance where to inject the libraries. + * @param extraProviders Extra imported providers if needed and not imported by this class. */ injectLibraries(instance: any, extraProviders: any[] = []): void { const providers = ( CORE_PROVIDERS).concat(CORE_CONTENTLINKS_PROVIDERS).concat(CORE_COURSE_PROVIDERS) @@ -284,10 +284,10 @@ export class CoreCompileProvider { /** * Instantiate a dynamic component. * - * @param {string} template The template of the component. - * @param {any} componentClass The JS class of the component. - * @param {Injector} [injector] The injector to use. It's recommended to pass it so NavController and similar can be injected. - * @return {Promise>} Promise resolved with the component instance. + * @param template The template of the component. + * @param componentClass The JS class of the component. + * @param injector The injector to use. It's recommended to pass it so NavController and similar can be injected. + * @return Promise resolved with the component instance. */ instantiateDynamicComponent(template: string, componentClass: any, injector?: Injector): Promise> { injector = injector || this.injector; diff --git a/src/core/contentlinks/classes/base-handler.ts b/src/core/contentlinks/classes/base-handler.ts index 9f79ddbda..ca23fd706 100644 --- a/src/core/contentlinks/classes/base-handler.ts +++ b/src/core/contentlinks/classes/base-handler.ts @@ -23,34 +23,29 @@ import { CoreContentLinksHandler, CoreContentLinksAction } from '../providers/de export class CoreContentLinksHandlerBase implements CoreContentLinksHandler { /** * A name to identify the handler. - * @type {string} */ name = 'CoreContentLinksHandlerBase'; /** * Handler's priority. The highest priority is treated first. - * @type {number} */ priority = 0; /** * Whether the isEnabled function should be called for all the users in a site. It should be true only if the isEnabled call * can return different values for different users in same site. - * @type {boolean} */ checkAllUsers = false; /** * Name of the feature this handler is related to. * It will be used to check if the feature is disabled (@see CoreSite.isFeatureDisabled). - * @type {string} */ featureName = ''; /** * A pattern to use to detect if the handler handles a URL and to get its site URL. Required if "handles" and * "getSiteUrl" functions aren't overridden. - * @type {RexExp} */ pattern?: RegExp; @@ -61,11 +56,11 @@ export class CoreContentLinksHandlerBase implements CoreContentLinksHandler { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -75,8 +70,8 @@ export class CoreContentLinksHandlerBase implements CoreContentLinksHandler { /** * Check if a URL is handled by this handler. * - * @param {string} url The URL to check. - * @return {boolean} Whether the URL is handled by this handler + * @param url The URL to check. + * @return Whether the URL is handled by this handler */ handles(url: string): boolean { return this.pattern && url.search(this.pattern) >= 0; @@ -85,8 +80,8 @@ export class CoreContentLinksHandlerBase implements CoreContentLinksHandler { /** * If the URL is handled by this handler, return the site URL. * - * @param {string} url The URL to check. - * @return {string} Site URL if it is handled, undefined otherwise. + * @param url The URL to check. + * @return Site URL if it is handled, undefined otherwise. */ getSiteUrl(url: string): string { if (this.pattern) { @@ -101,11 +96,11 @@ export class CoreContentLinksHandlerBase implements CoreContentLinksHandler { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return true; diff --git a/src/core/contentlinks/classes/module-grade-handler.ts b/src/core/contentlinks/classes/module-grade-handler.ts index c1a5124e4..865a32d9e 100644 --- a/src/core/contentlinks/classes/module-grade-handler.ts +++ b/src/core/contentlinks/classes/module-grade-handler.ts @@ -26,25 +26,23 @@ export class CoreContentLinksModuleGradeHandler extends CoreContentLinksHandlerB /** * Whether the module can be reviewed in the app. If true, the handler needs to implement the goToReview function. - * @type {boolean} */ canReview: boolean; /** * If this boolean is set to true, the app will retrieve all modules with this modName with a single WS call. * This reduces the number of WS calls, but it isn't recommended for modules that can return a lot of contents. - * @type {boolean} */ protected useModNameToGetModule = false; /** * Construct the handler. * - * @param {CoreCourseHelperProvider} courseHelper The CoreCourseHelperProvider instance. - * @param {CoreDomUtilsProvider} domUtils The CoreDomUtilsProvider instance. - * @param {CoreSitesProvider} sitesProvider The CoreSitesProvider instance. - * @param {string} addon Name of the addon as it's registered in course delegate. It'll be used to check if it's disabled. - * @param {string} modName Name of the module (assign, book, ...). + * @param courseHelper The CoreCourseHelperProvider instance. + * @param domUtils The CoreDomUtilsProvider instance. + * @param sitesProvider The CoreSitesProvider instance. + * @param addon Name of the addon as it's registered in course delegate. It'll be used to check if it's disabled. + * @param modName Name of the module (assign, book, ...). */ constructor(protected courseHelper: CoreCourseHelperProvider, protected domUtils: CoreDomUtilsProvider, protected sitesProvider: CoreSitesProvider, public addon: string, public modName: string) { @@ -58,11 +56,11 @@ export class CoreContentLinksModuleGradeHandler extends CoreContentLinksHandlerB /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -95,12 +93,12 @@ export class CoreContentLinksModuleGradeHandler extends CoreContentLinksHandlerB /** * Go to the page to review. * - * @param {string} url The URL to treat. - * @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @param {number} courseId Course ID related to the URL. - * @param {string} siteId Site to use. - * @param {NavController} [navCtrl] Nav Controller to use to navigate. - * @return {Promise} Promise resolved when done. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. + * @param siteId Site to use. + * @param navCtrl Nav Controller to use to navigate. + * @return Promise resolved when done. */ protected goToReview(url: string, params: any, courseId: number, siteId: string, navCtrl?: NavController): Promise { // This function should be overridden. diff --git a/src/core/contentlinks/classes/module-index-handler.ts b/src/core/contentlinks/classes/module-index-handler.ts index 67159b012..2ada678f5 100644 --- a/src/core/contentlinks/classes/module-index-handler.ts +++ b/src/core/contentlinks/classes/module-index-handler.ts @@ -24,16 +24,15 @@ export class CoreContentLinksModuleIndexHandler extends CoreContentLinksHandlerB /** * If this boolean is set to true, the app will retrieve all modules with this modName with a single WS call. * This reduces the number of WS calls, but it isn't recommended for modules that can return a lot of contents. - * @type {boolean} */ protected useModNameToGetModule = false; /** * Construct the handler. * - * @param {CoreCourseHelperProvider} courseHelper The CoreCourseHelperProvider instance. - * @param {string} addon Name of the addon as it's registered in course delegate. It'll be used to check if it's disabled. - * @param {string} modName Name of the module (assign, book, ...). + * @param courseHelper The CoreCourseHelperProvider instance. + * @param addon Name of the addon as it's registered in course delegate. It'll be used to check if it's disabled. + * @param modName Name of the module (assign, book, ...). */ constructor(protected courseHelper: CoreCourseHelperProvider, public addon: string, public modName: string) { super(); @@ -46,11 +45,11 @@ export class CoreContentLinksModuleIndexHandler extends CoreContentLinksHandlerB /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { diff --git a/src/core/contentlinks/classes/module-list-handler.ts b/src/core/contentlinks/classes/module-list-handler.ts index 37e44e7d7..6365a1ad9 100644 --- a/src/core/contentlinks/classes/module-list-handler.ts +++ b/src/core/contentlinks/classes/module-list-handler.ts @@ -24,17 +24,16 @@ export class CoreContentLinksModuleListHandler extends CoreContentLinksHandlerBa /** * The title to use in the new page. If not defined, the app will try to calculate it. - * @type {string} */ protected title: string; /** * Construct the handler. * - * @param {CoreContentLinksHelperProvider} linkHelper The CoreContentLinksHelperProvider instance. - * @param {TranslateService} translate The TranslateService instance. - * @param {string} addon Name of the addon as it's registered in course delegate. It'll be used to check if it's disabled. - * @param {string} modName Name of the module (assign, book, ...). + * @param linkHelper The CoreContentLinksHelperProvider instance. + * @param translate The TranslateService instance. + * @param addon Name of the addon as it's registered in course delegate. It'll be used to check if it's disabled. + * @param modName Name of the module (assign, book, ...). */ constructor(protected linkHelper: CoreContentLinksHelperProvider, protected translate: TranslateService, public addon: string, public modName: string) { @@ -48,10 +47,10 @@ export class CoreContentLinksModuleListHandler extends CoreContentLinksHandlerBa /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any): CoreContentLinksAction[] | Promise { diff --git a/src/core/contentlinks/pages/choose-site/choose-site.ts b/src/core/contentlinks/pages/choose-site/choose-site.ts index b10a36bc7..0808e130d 100644 --- a/src/core/contentlinks/pages/choose-site/choose-site.ts +++ b/src/core/contentlinks/pages/choose-site/choose-site.ts @@ -96,7 +96,7 @@ export class CoreContentLinksChooseSitePage implements OnInit { /** * Perform the action on a certain site. * - * @param {string} siteId Site ID. + * @param siteId Site ID. */ siteClicked(siteId: string): void { if (this.isRootURL) { diff --git a/src/core/contentlinks/providers/delegate.ts b/src/core/contentlinks/providers/delegate.ts index b753ac02e..340f1eb17 100644 --- a/src/core/contentlinks/providers/delegate.ts +++ b/src/core/contentlinks/providers/delegate.ts @@ -25,39 +25,35 @@ import { CoreUtilsProvider } from '@providers/utils/utils'; export interface CoreContentLinksHandler { /** * A name to identify the handler. - * @type {string} */ name: string; /** * Handler's priority. The highest priority is treated first. - * @type {number} */ priority?: number; /** * Whether the isEnabled function should be called for all the users in a site. It should be true only if the isEnabled call * can return different values for different users in same site. - * @type {boolean} */ checkAllUsers?: boolean; /** * Name of the feature this handler is related to. * It will be used to check if the feature is disabled (@see CoreSite.isFeatureDisabled). - * @type {string} */ featureName?: string; /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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 {any} [data] Extra data to handle the URL. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @param data Extra data to handle the URL. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number, data?: any): CoreContentLinksAction[] | Promise; @@ -65,16 +61,16 @@ export interface CoreContentLinksHandler { /** * Check if a URL is handled by this handler. * - * @param {string} url The URL to check. - * @return {boolean} Whether the URL is handled by this handler + * @param url The URL to check. + * @return Whether the URL is handled by this handler */ handles(url: string): boolean; /** * If the URL is handled by this handler, return the site URL. * - * @param {string} url The URL to check. - * @return {string} Site URL if it is handled, undefined otherwise. + * @param url The URL to check. + * @return Site URL if it is handled, undefined otherwise. */ getSiteUrl(url: string): string; @@ -82,11 +78,11 @@ export interface CoreContentLinksHandler { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled?(siteId: string, url: string, params: any, courseId?: number): boolean | Promise; } @@ -97,27 +93,24 @@ export interface CoreContentLinksHandler { export interface CoreContentLinksAction { /** * A message to identify the action. Default: 'core.view'. - * @type {string} */ message?: string; /** * Name of the icon of the action. Default: 'eye'. - * @type {string} */ icon?: string; /** * IDs of the sites that support the action. - * @type {string[]} */ sites?: string[]; /** * Action to perform when the link is clicked. * - * @param {string} siteId The site ID. - * @param {NavController} [navCtrl] Nav Controller to use to navigate. + * @param siteId The site ID. + * @param navCtrl Nav Controller to use to navigate. */ action(siteId: string, navCtrl?: NavController): void; } @@ -128,13 +121,11 @@ export interface CoreContentLinksAction { export interface CoreContentLinksHandlerActions { /** * Handler's priority. - * @type {number} */ priority: number; /** * List of actions. - * @type {CoreContentLinksAction[]} */ actions: CoreContentLinksAction[]; } @@ -155,11 +146,11 @@ export class CoreContentLinksDelegate { /** * Get the list of possible actions to do for a URL. * - * @param {string} url URL to handle. - * @param {number} [courseId] Course ID related to the URL. Optional but recommended. - * @param {string} [username] Username to use to filter sites. - * @param {any} [data] Extra data to handle the URL. - * @return {Promise} Promise resolved with the actions. + * @param url URL to handle. + * @param courseId Course ID related to the URL. Optional but recommended. + * @param username Username to use to filter sites. + * @param data Extra data to handle the URL. + * @return Promise resolved with the actions. */ getActionsFor(url: string, courseId?: number, username?: string, data?: any): Promise { if (!url) { @@ -220,8 +211,8 @@ export class CoreContentLinksDelegate { /** * Get the site URL if the URL is supported by any handler. * - * @param {string} url URL to handle. - * @return {string} Site URL if the URL is supported by any handler, undefined otherwise. + * @param url URL to handle. + * @return Site URL if the URL is supported by any handler, undefined otherwise. */ getSiteUrl(url: string): string { if (!url) { @@ -242,12 +233,12 @@ export class CoreContentLinksDelegate { /** * Check if a handler is enabled for a certain site and URL. * - * @param {CoreContentLinksHandler} handler Handler to check. - * @param {string} url The URL to check. - * @param {any} params The params of the URL - * @param {number} courseId Course ID the URL belongs to (can be undefined). - * @param {string} siteId The site ID to check. - * @return {Promise} Promise resolved with boolean: whether the handler is enabled. + * @param handler Handler to check. + * @param url The URL to check. + * @param params The params of the URL + * @param courseId Course ID the URL belongs to (can be undefined). + * @param siteId The site ID to check. + * @return Promise resolved with boolean: whether the handler is enabled. */ protected isHandlerEnabled(handler: CoreContentLinksHandler, url: string, params: any, courseId: number, siteId: string) : Promise { @@ -277,8 +268,8 @@ export class CoreContentLinksDelegate { /** * Register a handler. * - * @param {CoreContentLinksHandler} handler The handler to register. - * @return {boolean} True if registered successfully, false otherwise. + * @param handler The handler to register. + * @return True if registered successfully, false otherwise. */ registerHandler(handler: CoreContentLinksHandler): boolean { if (typeof this.handlers[handler.name] !== 'undefined') { @@ -295,8 +286,8 @@ export class CoreContentLinksDelegate { /** * Sort actions by priority. * - * @param {CoreContentLinksHandlerActions[]} actions Actions to sort. - * @return {CoreContentLinksAction[]} Sorted actions. + * @param actions Actions to sort. + * @return Sorted actions. */ protected sortActionsByPriority(actions: CoreContentLinksHandlerActions[]): CoreContentLinksAction[] { let sorted: CoreContentLinksAction[] = []; diff --git a/src/core/contentlinks/providers/helper.ts b/src/core/contentlinks/providers/helper.ts index 6e9f77e91..dd2f6e35b 100644 --- a/src/core/contentlinks/providers/helper.ts +++ b/src/core/contentlinks/providers/helper.ts @@ -51,11 +51,11 @@ export class CoreContentLinksHelperProvider { /** * Check whether a link can be handled by the app. * - * @param {string} url URL to handle. - * @param {number} [courseId] Course ID related to the URL. Optional but recommended. - * @param {string} [username] Username to use to filter sites. - * @param {boolean} [checkRoot] Whether to check if the URL is the root URL of a site. - * @return {Promise} Promise resolved with a boolean: whether the URL can be handled. + * @param url URL to handle. + * @param courseId Course ID related to the URL. Optional but recommended. + * @param username Username to use to filter sites. + * @param checkRoot Whether to check if the URL is the root URL of a site. + * @return Promise resolved with a boolean: whether the URL can be handled. */ canHandleLink(url: string, courseId?: number, username?: string, checkRoot?: boolean): Promise { let promise; @@ -83,8 +83,8 @@ export class CoreContentLinksHelperProvider { /** * Get the first valid action in a list of actions. * - * @param {CoreContentLinksAction[]} actions List of actions. - * @return {CoreContentLinksAction} First valid action. Returns undefined if no valid action found. + * @param actions List of actions. + * @return First valid action. Returns undefined if no valid action found. */ getFirstValidAction(actions: CoreContentLinksAction[]): CoreContentLinksAction { if (actions) { @@ -101,12 +101,12 @@ export class CoreContentLinksHelperProvider { * Goes to a certain page in a certain site. If the site is current site it will perform a regular navigation, * otherwise it will 'redirect' to the other site. * - * @param {NavController} navCtrl The NavController instance to use. - * @param {string} pageName Name of the page to go. - * @param {any} [pageParams] Params to send to the page. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [checkMenu] If true, check if the root page of a main menu tab. Only the page name will be checked. - * @return {Promise} Promise resolved when done. + * @param navCtrl The NavController instance to use. + * @param pageName Name of the page to go. + * @param pageParams Params to send to the page. + * @param siteId Site ID. If not defined, current site. + * @param checkMenu If true, check if the root page of a main menu tab. Only the page name will be checked. + * @return Promise resolved when done. */ goInSite(navCtrl: NavController, pageName: string, pageParams: any, siteId?: string, checkMenu?: boolean): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -144,7 +144,7 @@ export class CoreContentLinksHelperProvider { /** * Go to the page to choose a site. * - * @param {string} url URL to treat. + * @param url URL to treat. */ goToChooseSite(url: string): void { this.appProvider.getRootNavController().setRoot('CoreContentLinksChooseSitePage', { url: url }); @@ -153,8 +153,8 @@ export class CoreContentLinksHelperProvider { /** * Handle a URL received by Custom URL Scheme. * - * @param {string} url URL to handle. - * @return {boolean} True if the URL should be handled by this component, false otherwise. + * @param url URL to handle. + * @return True if the URL should be handled by this component, false otherwise. * @deprecated Please use CoreCustomURLSchemesProvider.handleCustomURL instead. */ handleCustomUrl(url: string): boolean { @@ -270,13 +270,13 @@ export class CoreContentLinksHelperProvider { /** * Handle a link. * - * @param {string} url URL to handle. - * @param {string} [username] Username related with the URL. E.g. in 'http://myuser@m.com', url would be 'http://m.com' and - * the username 'myuser'. Don't use it if you don't want to filter by username. - * @param {NavController} [navCtrl] Nav Controller to use to navigate. - * @param {boolean} [checkRoot] Whether to check if the URL is the root URL of a site. - * @param {boolean} [openBrowserRoot] Whether to open in browser if it's root URL and it belongs to current site. - * @return {Promise} Promise resolved with a boolean: true if URL was treated, false otherwise. + * @param url URL to handle. + * @param username Username related with the URL. E.g. in 'http://myuser@m.com', url would be 'http://m.com' and + * the username 'myuser'. Don't use it if you don't want to filter by username. + * @param navCtrl Nav Controller to use to navigate. + * @param checkRoot Whether to check if the URL is the root URL of a site. + * @param openBrowserRoot Whether to open in browser if it's root URL and it belongs to current site. + * @return Promise resolved with a boolean: true if URL was treated, false otherwise. */ handleLink(url: string, username?: string, navCtrl?: NavController, checkRoot?: boolean, openBrowserRoot?: boolean) : Promise { @@ -336,11 +336,11 @@ export class CoreContentLinksHelperProvider { /** * Handle a root URL of a site. * - * @param {CoreSite} site Site to handle. - * @param {boolean} [openBrowserRoot] Whether to open in browser if it's root URL and it belongs to current site. - * @param {boolean} [checkToken] Whether to check that token is the same to verify it's current site. If false or not defined, - * only the URL will be checked. - * @return {Promise} Promise resolved when done. + * @param site Site to handle. + * @param openBrowserRoot Whether to open in browser if it's root URL and it belongs to current site. + * @param checkToken Whether to check that token is the same to verify it's current site. If false or not defined, + * only the URL will be checked. + * @return Promise resolved when done. */ handleRootURL(site: CoreSite, openBrowserRoot?: boolean, checkToken?: boolean): Promise { const currentSite = this.sitesProvider.getCurrentSite(); diff --git a/src/core/course/classes/activity-prefetch-handler.ts b/src/core/course/classes/activity-prefetch-handler.ts index 3c0294a93..54f19c06b 100644 --- a/src/core/course/classes/activity-prefetch-handler.ts +++ b/src/core/course/classes/activity-prefetch-handler.ts @@ -22,12 +22,12 @@ import { CoreCourseModulePrefetchHandlerBase } from './module-prefetch-handler'; * The string returned by this function will be stored as "extra" data in the filepool package. If you don't need to store * extra data, don't return anything. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} single True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} siteId Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the prefetch finishes. The string returned will be stored as "extra" data in the - * filepool package. If you don't need to store extra data, don't return anything. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the prefetch finishes. The string returned will be stored as "extra" data in the + * filepool package. If you don't need to store extra data, don't return anything. */ export type prefetchFunction = (module: any, courseId: number, single: boolean, siteId: string, ...args: any[]) => Promise; @@ -46,10 +46,10 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe /** * Download the module. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when all content is downloaded. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when all content is downloaded. */ download(module: any, courseId: number, dirPath?: string): Promise { // Same implementation for download and prefetch. @@ -59,11 +59,11 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string): Promise { // To be overridden. It should call prefetchPackage @@ -79,12 +79,12 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe * Then the function "prefetchModule" will receive params: * prefetchModule(module, courseId, single, siteId, someParam, anotherParam) * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {prefetchFunction} downloadFn Function to perform the prefetch. Please check the documentation of prefetchFunction. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the module has been downloaded. Data returned is not reliable. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param downloadFn Function to perform the prefetch. Please check the documentation of prefetchFunction. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the module has been downloaded. Data returned is not reliable. */ prefetchPackage(module: any, courseId: number, single: boolean, downloadFn: prefetchFunction, siteId?: string, ...args: any[]) : Promise { @@ -128,10 +128,10 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe /** * Mark the module as downloaded. * - * @param {number} id Unique identifier per component. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {string} [extra] Extra data to store. - * @return {Promise} Promise resolved when done. + * @param id Unique identifier per component. + * @param siteId Site ID. If not defined, current site. + * @param extra Extra data to store. + * @return Promise resolved when done. */ setDownloaded(id: number, siteId?: string, extra?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -142,9 +142,9 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe /** * Mark the module as downloading. * - * @param {number} id Unique identifier per component. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param id Unique identifier per component. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ setDownloading(id: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -155,10 +155,10 @@ export class CoreCourseActivityPrefetchHandlerBase extends CoreCourseModulePrefe /** * Set previous status and return a rejected promise. * - * @param {number} id Unique identifier per component. - * @param {any} [error] Error to return. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Rejected promise. + * @param id Unique identifier per component. + * @param error Error to return. + * @param siteId Site ID. If not defined, current site. + * @return Rejected promise. */ setPreviousStatusAndReject(id: number, error?: any, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); diff --git a/src/core/course/classes/activity-sync.ts b/src/core/course/classes/activity-sync.ts index 8d7333963..ae076f069 100644 --- a/src/core/course/classes/activity-sync.ts +++ b/src/core/course/classes/activity-sync.ts @@ -40,11 +40,11 @@ export class CoreCourseActivitySyncBaseProvider extends CoreSyncBaseProvider { /** * Conveniece function to prefetch data after an update. * - * @param {any} module Module. - * @param {number} courseId Course ID. - * @param {RegExp} [regex] If regex matches, don't download the data. Defaults to check files. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID. + * @param regex If regex matches, don't download the data. Defaults to check files. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ prefetchAfterUpdate(module: any, courseId: number, regex?: RegExp, siteId?: string): Promise { regex = regex || /^.*files$/; diff --git a/src/core/course/classes/main-activity-component.ts b/src/core/course/classes/main-activity-component.ts index 752a140e2..6e1f0b23c 100644 --- a/src/core/course/classes/main-activity-component.ts +++ b/src/core/course/classes/main-activity-component.ts @@ -93,8 +93,8 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR /** * Compares sync event data with current data to check if refresh content is needed. * - * @param {any} syncEventData Data received on sync observer. - * @return {boolean} True if refresh is needed, false otherwise. + * @param syncEventData Data received on sync observer. + * @return True if refresh is needed, false otherwise. */ protected isRefreshSyncNeeded(syncEventData: any): boolean { return false; @@ -103,7 +103,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR /** * An autosync event has been received, check if refresh is needed and update the view. * - * @param {any} syncEventData Data receiven on sync observer. + * @param syncEventData Data receiven on sync observer. */ protected autoSyncEventReceived(syncEventData: any): void { if (this.isRefreshSyncNeeded(syncEventData)) { @@ -115,9 +115,9 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR /** * Perform the refresh content function. * - * @param {boolean} [sync=false] If the refresh needs syncing. - * @param {boolean} [showErrors=false] Wether to show errors to the user or hide them. - * @return {Promise} Resolved when done. + * @param sync If the refresh needs syncing. + * @param showErrors Wether to show errors to the user or hide them. + * @return Resolved when done. */ protected refreshContent(sync: boolean = false, showErrors: boolean = false): Promise { if (!this.module) { @@ -154,9 +154,9 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR /** * Show loading and perform the load content function. * - * @param {boolean} [sync=false] If the fetch needs syncing. - * @param {boolean} [showErrors=false] Wether to show errors to the user or hide them. - * @return {Promise} Resolved when done. + * @param sync If the fetch needs syncing. + * @param showErrors Wether to show errors to the user or hide them. + * @return Resolved when done. */ protected showLoadingAndFetch(sync: boolean = false, showErrors: boolean = false): Promise { this.refreshIcon = 'spinner'; @@ -173,9 +173,9 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR /** * Show loading and perform the refresh content function. * - * @param {boolean} [sync=false] If the refresh needs syncing. - * @param {boolean} [showErrors=false] Wether to show errors to the user or hide them. - * @return {Promise} Resolved when done. + * @param sync If the refresh needs syncing. + * @param showErrors Wether to show errors to the user or hide them. + * @return Resolved when done. */ protected showLoadingAndRefresh(sync: boolean = false, showErrors: boolean = false): Promise { this.refreshIcon = 'spinner'; @@ -189,10 +189,10 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR /** * Download the component contents. * - * @param {boolean} [refresh=false] Whether we're refreshing data. - * @param {boolean} [sync=false] If the refresh needs syncing. - * @param {boolean} [showErrors=false] Wether to show errors to the user or hide them. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @param sync If the refresh needs syncing. + * @param showErrors Wether to show errors to the user or hide them. + * @return Promise resolved when done. */ protected fetchContent(refresh: boolean = false, sync: boolean = false, showErrors: boolean = false): Promise { return Promise.resolve(); @@ -201,10 +201,10 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR /** * Loads the component contents and shows the corresponding error. * - * @param {boolean} [refresh=false] Whether we're refreshing data. - * @param {boolean} [sync=false] If the refresh needs syncing. - * @param {boolean} [showErrors=false] Wether to show errors to the user or hide them. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @param sync If the refresh needs syncing. + * @param showErrors Wether to show errors to the user or hide them. + * @return Promise resolved when done. */ protected loadContent(refresh?: boolean, sync: boolean = false, showErrors: boolean = false): Promise { this.isOnline = this.appProvider.isOnline(); @@ -245,8 +245,8 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR /** * Displays some data based on the current status. * - * @param {string} status The current status. - * @param {string} [previousStatus] The previous status. If not defined, there is no previous status. + * @param status The current status. + * @param previousStatus The previous status. If not defined, there is no previous status. */ protected showStatus(status: string, previousStatus?: string): void { // To be overridden. @@ -255,7 +255,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR /** * Watch for changes on the status. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected setStatusListener(): Promise { if (typeof this.statusObserver == 'undefined') { @@ -283,7 +283,7 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR /** * Performs the sync of the activity. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected sync(): Promise { return Promise.resolve(true); @@ -292,8 +292,8 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR /** * Checks if sync has succeed from result sync data. * - * @param {any} result Data returned on the sync function. - * @return {boolean} If suceed or not. + * @param result Data returned on the sync function. + * @return If suceed or not. */ protected hasSyncSucceed(result: any): boolean { return true; @@ -302,8 +302,8 @@ export class CoreCourseModuleMainActivityComponent extends CoreCourseModuleMainR /** * Tries to synchronize the activity. * - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved with true if sync succeed, or false if failed. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved with true if sync succeed, or false if failed. */ protected syncActivity(showErrors: boolean = false): Promise { return this.sync().then((result) => { diff --git a/src/core/course/classes/main-resource-component.ts b/src/core/course/classes/main-resource-component.ts index e357d0888..854d194f6 100644 --- a/src/core/course/classes/main-resource-component.ts +++ b/src/core/course/classes/main-resource-component.ts @@ -99,10 +99,10 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @param {Function} [done] Function to call when done. - * @param {boolean} [showErrors=false] If show errors to the user of hide them. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @param done Function to call when done. + * @param showErrors If show errors to the user of hide them. + * @return Promise resolved when done. */ doRefresh(refresher?: any, done?: () => void, showErrors: boolean = false): Promise { if (this.loaded && this.module) { @@ -129,9 +129,9 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, /** * Perform the refresh content function. * - * @param {boolean} [sync=false] If the refresh needs syncing. - * @param {boolean} [showErrors=false] Wether to show errors to the user or hide them. - * @return {Promise} Resolved when done. + * @param sync If the refresh needs syncing. + * @param showErrors Wether to show errors to the user or hide them. + * @return Resolved when done. */ protected refreshContent(sync: boolean = false, showErrors: boolean = false): Promise { if (!this.module) { @@ -166,7 +166,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, /** * Perform the invalidate content function. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected invalidateContent(): Promise { return Promise.resolve(); @@ -175,8 +175,8 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, /** * Download the component contents. * - * @param {boolean} [refresh] Whether we're refreshing data. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @return Promise resolved when done. */ protected fetchContent(refresh?: boolean): Promise { return Promise.resolve(); @@ -185,8 +185,8 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, /** * Loads the component contents and shows the corresponding error. * - * @param {boolean} [refresh] Whether we're refreshing data. - * @return {Promise} Promise resolved when done. + * @param refresh Whether we're refreshing data. + * @return Promise resolved when done. */ protected loadContent(refresh?: boolean): Promise { if (!this.module) { @@ -242,7 +242,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, /** * Go to blog posts. * - * @param {any} event Event. + * @param event Event. */ gotoBlog(event: any): void { this.linkHelper.goInSite(this.navCtrl, 'AddonBlogEntriesPage', { cmId: this.module.id }); @@ -251,7 +251,7 @@ export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, /** * Prefetch the module. * - * @param {Function} [done] Function to call when done. + * @param done Function to call when done. */ prefetch(done?: () => void): void { this.courseHelper.contextMenuPrefetch(this, this.module, this.courseId, done); diff --git a/src/core/course/classes/module-prefetch-handler.ts b/src/core/course/classes/module-prefetch-handler.ts index e079055ed..0bae87e2b 100644 --- a/src/core/course/classes/module-prefetch-handler.ts +++ b/src/core/course/classes/module-prefetch-handler.ts @@ -29,39 +29,33 @@ import { CoreCourseModulePrefetchHandler } from '../providers/module-prefetch-de export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePrefetchHandler { /** * Name of the handler. - * @type {string} */ name = 'CoreCourseModulePrefetchHandler'; /** * Name of the module. It should match the "modname" of the module returned in core_course_get_contents. - * @type {string} */ modName = 'default'; /** * The handler's component. - * @type {string} */ component = 'core_module'; /** * The RegExp to check updates. If a module has an update whose name matches this RegExp, the module will be marked * as outdated. This RegExp is ignored if hasUpdates function is defined. - * @type {RegExp} */ updatesNames = /^.*files$/; /** * If true, this module will be ignored when determining the status of a list of modules. The module will * still be downloaded when downloading the section/course, it only affects whether the button should be displayed. - * @type {boolean} */ skipListStatus = false; /** * List of download promises to prevent downloading the module twice at the same time. - * @type {{[s: string]: {[s: string]: Promise}}} */ protected downloadPromises: { [s: string]: { [s: string]: Promise } } = {}; @@ -72,10 +66,10 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Add an ongoing download to the downloadPromises list. When the promise finishes it will be removed. * - * @param {number} id Unique identifier per component. - * @param {Promise} promise Promise to add. - * @param {String} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise of the current download. + * @param id Unique identifier per component. + * @param promise Promise to add. + * @param siteId Site ID. If not defined, current site. + * @return Promise of the current download. */ addOngoingDownload(id: number, promise: Promise, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -96,10 +90,10 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Download the module. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when all content is downloaded. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when all content is downloaded. */ download(module: any, courseId: number, dirPath?: string): Promise { // To be overridden. @@ -109,8 +103,8 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Returns a list of content files that can be downloaded. * - * @param {any} module The module object returned by WS. - * @return {any[]} List of files. + * @param module The module object returned by WS. + * @return List of files. */ getContentDownloadableFiles(module: any): any[] { const files = []; @@ -129,11 +123,11 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Get the download size of a module. * - * @param {any} module Module. - * @param {Number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise<{size: number, total: boolean}>} Promise resolved with the size and a boolean indicating if it was able - * to calculate the total size. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved with the size and a boolean indicating if it was able + * to calculate the total size. */ getDownloadSize(module: any, courseId: number, single?: boolean): Promise<{ size: number, total: boolean }> { return this.getFiles(module, courseId).then((files) => { @@ -146,9 +140,9 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Get the downloaded size of a module. If not defined, we'll use getFiles to calculate it (it can be slow). * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {number|Promise} Size, or promise resolved with the size. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Size, or promise resolved with the size. */ getDownloadedSize(module: any, courseId: number): number | Promise { const siteId = this.sitesProvider.getCurrentSiteId(); @@ -159,10 +153,10 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Get list of files. If not defined, we'll assume they're in module.contents. * - * @param {any} module Module. - * @param {Number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise} Promise resolved with the list of files. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved with the list of files. */ getFiles(module: any, courseId: number, single?: boolean): Promise { // To be overridden. @@ -172,10 +166,10 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Returns module intro files. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise resolved with list of intro files. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved with list of intro files. */ getIntroFiles(module: any, courseId: number, ignoreCache?: boolean): Promise { return Promise.resolve(this.getIntroFilesFromInstance(module)); @@ -184,9 +178,9 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Returns module intro files from instance. * - * @param {any} module The module object returned by WS. - * @param {any} [instance] The instance to get the intro files (book, assign, ...). If not defined, module will be used. - * @return {any[]} List of intro files. + * @param module The module object returned by WS. + * @param instance The instance to get the intro files (book, assign, ...). If not defined, module will be used. + * @return List of intro files. */ getIntroFilesFromInstance(module: any, instance?: any): any[] { if (instance) { @@ -207,9 +201,9 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * If there's an ongoing download for a certain identifier return it. * - * @param {number} id Unique identifier per component. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise of the current download. + * @param id Unique identifier per component. + * @param siteId Site ID. If not defined, current site. + * @return Promise of the current download. */ getOngoingDownload(id: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -225,8 +219,8 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Create unique identifier using component and id. * - * @param {number} id Unique ID inside component. - * @return {string} Unique ID. + * @param id Unique ID inside component. + * @return Unique ID. */ getUniqueId(id: number): string { return this.component + '#' + id; @@ -235,9 +229,9 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId The course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId The course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { // To be overridden. @@ -248,9 +242,9 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref * Invalidate WS calls needed to determine module status (usually, to check if module is downloadable). * It doesn't need to invalidate check updates. It should NOT invalidate files nor all the prefetched data. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule(module: any, courseId: number): Promise { return this.courseProvider.invalidateModule(module.id); @@ -259,9 +253,9 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Check if a module can be downloaded. If the function is not defined, we assume that all modules are downloadable. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {boolean|Promise} Whether the module can be downloaded. The promise should never be rejected. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Whether the module can be downloaded. The promise should never be rejected. */ isDownloadable(module: any, courseId: number): boolean | Promise { // By default, mark all instances as downloadable. @@ -271,9 +265,9 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Check if a there's an ongoing download for the given identifier. * - * @param {number} id Unique identifier per component. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean} True if downloading, false otherwise. + * @param id Unique identifier per component. + * @param siteId Site ID. If not defined, current site. + * @return True if downloading, false otherwise. */ isDownloading(id: number, siteId?: string): boolean { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -284,7 +278,7 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ isEnabled(): boolean | Promise { return true; @@ -293,8 +287,8 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Check if a file is downloadable. * - * @param {any} file File to check. - * @return {boolean} Whether the file is downloadable. + * @param file File to check. + * @return Whether the file is downloadable. */ isFileDownloadable(file: any): boolean { return file.type === 'file'; @@ -303,10 +297,10 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Load module contents into module.contents if they aren't loaded already. * - * @param {any} module Module to load the contents. - * @param {number} [courseId] The course ID. Recommended to speed up the process and minimize data usage. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise resolved when loaded. + * @param module Module to load the contents. + * @param courseId The course ID. Recommended to speed up the process and minimize data usage. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved when loaded. */ loadContents(module: any, courseId: number, ignoreCache?: boolean): Promise { // To be overridden. @@ -316,11 +310,11 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string): Promise { // To be overridden. @@ -330,9 +324,9 @@ export class CoreCourseModulePrefetchHandlerBase implements CoreCourseModulePref /** * Remove module downloaded files. If not defined, we'll use getFiles to remove them (slow). * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when done. */ removeFiles(module: any, courseId: number): Promise { return this.filepoolProvider.removeFilesByComponent(this.sitesProvider.getCurrentSiteId(), this.component, module.id); diff --git a/src/core/course/classes/resource-prefetch-handler.ts b/src/core/course/classes/resource-prefetch-handler.ts index f7e7386d3..f3ce201e1 100644 --- a/src/core/course/classes/resource-prefetch-handler.ts +++ b/src/core/course/classes/resource-prefetch-handler.ts @@ -28,10 +28,10 @@ export class CoreCourseResourcePrefetchHandlerBase extends CoreCourseModulePrefe /** * Download the module. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when all content is downloaded. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when all content is downloaded. */ download(module: any, courseId: number, dirPath?: string): Promise { return this.downloadOrPrefetch(module, courseId, false, dirPath); @@ -40,13 +40,13 @@ export class CoreCourseResourcePrefetchHandlerBase extends CoreCourseModulePrefe /** * Download or prefetch the content. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {boolean} [prefetch] True to prefetch, false to download right away. - * @param {string} [dirPath] Path of the directory where to store all the content files. This is to keep the files - * relative paths and make the package work in an iframe. Undefined to download the files - * in the filepool root folder. - * @return {Promise} Promise resolved when all content is downloaded. Data returned is not reliable. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param prefetch True to prefetch, false to download right away. + * @param dirPath Path of the directory where to store all the content files. This is to keep the files + * relative paths and make the package work in an iframe. Undefined to download the files + * in the filepool root folder. + * @return Promise resolved when all content is downloaded. Data returned is not reliable. */ downloadOrPrefetch(module: any, courseId: number, prefetch?: boolean, dirPath?: string): Promise { if (!this.appProvider.isOnline()) { @@ -96,10 +96,10 @@ export class CoreCourseResourcePrefetchHandlerBase extends CoreCourseModulePrefe /** * Get list of files. If not defined, we'll assume they're in module.contents. * - * @param {any} module Module. - * @param {Number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise} Promise resolved with the list of files. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved with the list of files. */ getFiles(module: any, courseId: number, single?: boolean): Promise { // Load module contents if needed. @@ -113,9 +113,9 @@ export class CoreCourseResourcePrefetchHandlerBase extends CoreCourseModulePrefe /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId The course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId The course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { const promises = [], @@ -130,10 +130,10 @@ export class CoreCourseResourcePrefetchHandlerBase extends CoreCourseModulePrefe /** * Load module contents into module.contents if they aren't loaded already. * - * @param {any} module Module to load the contents. - * @param {number} [courseId] The course ID. Recommended to speed up the process and minimize data usage. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise resolved when loaded. + * @param module Module to load the contents. + * @param courseId The course ID. Recommended to speed up the process and minimize data usage. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved when loaded. */ loadContents(module: any, courseId: number, ignoreCache?: boolean): Promise { return this.courseProvider.loadModuleContents(module, courseId, undefined, false, ignoreCache); @@ -142,11 +142,11 @@ export class CoreCourseResourcePrefetchHandlerBase extends CoreCourseModulePrefe /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string): Promise { return this.downloadOrPrefetch(module, courseId, true, dirPath); diff --git a/src/core/course/components/format/format.ts b/src/core/course/components/format/format.ts index 8455d4487..f15589083 100644 --- a/src/core/course/components/format/format.ts +++ b/src/core/course/components/format/format.ts @@ -271,7 +271,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { /** * Display the section selector modal. * - * @param {MouseEvent} event Event. + * @param event Event. */ showSectionSelector(event: MouseEvent): void { if (!this.sectionSelectorExpanded) { @@ -296,7 +296,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { /** * Function called when selected section changes. * - * @param {any} newSection The new selected section. + * @param newSection The new selected section. */ sectionChanged(newSection: any): void { const previousValue = this.selectedSection; @@ -351,9 +351,9 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { /** * Compare if two sections are equal. * - * @param {any} s1 First section. - * @param {any} s2 Second section. - * @return {boolean} Whether they're equal. + * @param s1 First section. + * @param s2 Second section. + * @return Whether they're equal. */ compareSections(s1: any, s2: any): boolean { return s1 && s2 ? s1.id === s2.id : s1 === s2; @@ -362,7 +362,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { /** * Calculate the status of sections. * - * @param {boolean} refresh If refresh or not. + * @param refresh If refresh or not. */ protected calculateSectionsStatus(refresh?: boolean): void { this.courseHelper.calculateSectionsStatus(this.sections, this.course.id, refresh).catch(() => { @@ -373,8 +373,8 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { /** * Confirm and prefetch a section. If the section is "all sections", prefetch all the sections. * - * @param {any} section Section to download. - * @param {boolean} refresh Refresh clicked (not used). + * @param section Section to download. + * @param refresh Refresh clicked (not used). */ prefetch(section: any, refresh: boolean = false): void { section.isCalculating = true; @@ -393,9 +393,9 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { /** * Prefetch a section. * - * @param {any} section The section to download. - * @param {boolean} [manual] Whether the prefetch was started manually or it was automatically started because all modules - * are being downloaded. + * @param section The section to download. + * @param manual Whether the prefetch was started manually or it was automatically started because all modules + * are being downloaded. */ protected prefetchSection(section: any, manual?: boolean): void { this.courseHelper.prefetchSection(section, this.course.id, this.sections).catch((error) => { @@ -411,10 +411,10 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @param {Function} [done] Function to call when done. - * @param {boolean} [afterCompletionChange] Whether the refresh is due to a completion change. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @param done Function to call when done. + * @param afterCompletionChange Whether the refresh is due to a completion change. + * @return Promise resolved when done. */ doRefresh(refresher?: any, done?: () => void, afterCompletionChange?: boolean): Promise { const promises = []; @@ -433,7 +433,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { /** * Show more activities (only used when showing all the sections at the same time). * - * @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. */ showMoreActivities(infiniteComplete?: any): void { this.canLoadMore = false; @@ -508,8 +508,8 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { /** * Check whether a section can be viewed. * - * @param {any} section The section to check. - * @return {boolean} Whether the section can be viewed. + * @param section The section to check. + * @return Whether the section can be viewed. */ canViewSection(section: any): boolean { return section.uservisible !== false && !section.hiddenbynumsections && @@ -543,7 +543,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { /** * Recalculate the download status of each section, in response to a module being downloaded. * - * @param {any} eventData + * @param eventData */ onModuleStatusChange(eventData: any): void { this.courseHelper.calculateSectionsStatus(this.sections, this.course.id, false, false); diff --git a/src/core/course/components/module-completion/module-completion.ts b/src/core/course/components/module-completion/module-completion.ts index 73efcc86f..7d4141d43 100644 --- a/src/core/course/components/module-completion/module-completion.ts +++ b/src/core/course/components/module-completion/module-completion.ts @@ -58,7 +58,7 @@ export class CoreCourseModuleCompletionComponent implements OnChanges { /** * Completion clicked. * - * @param {Event} e The click event. + * @param e The click event. */ completionClicked(e: Event): void { if (this.completion) { diff --git a/src/core/course/components/module/module.ts b/src/core/course/components/module/module.ts index 3bdb1a898..8acfd8dc2 100644 --- a/src/core/course/components/module/module.ts +++ b/src/core/course/components/module/module.ts @@ -111,7 +111,7 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy { /** * Function called when the module is clicked. * - * @param {Event} event Click event. + * @param event Click event. */ moduleClicked(event: Event): void { if (this.module.uservisible !== false && this.module.handlerData.action) { @@ -122,8 +122,8 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy { /** * Function called when a button is clicked. * - * @param {Event} event Click event. - * @param {CoreCourseModuleHandlerButton} button The clicked button. + * @param event Click event. + * @param button The clicked button. */ buttonClicked(event: Event, button: CoreCourseModuleHandlerButton): void { if (button && button.action) { @@ -137,7 +137,7 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy { /** * Download the module. * - * @param {boolean} refresh Whether it's refreshing. + * @param refresh Whether it's refreshing. */ download(refresh: boolean): void { if (!this.prefetchHandler) { @@ -169,7 +169,7 @@ export class CoreCourseModuleComponent implements OnInit, OnDestroy { /** * Show download buttons according to module status. * - * @param {string} status Module status. + * @param status Module status. */ protected showStatus(status: string): void { if (status) { diff --git a/src/core/course/components/tag-area/tag-area.ts b/src/core/course/components/tag-area/tag-area.ts index 07d34c21c..fa37a678e 100644 --- a/src/core/course/components/tag-area/tag-area.ts +++ b/src/core/course/components/tag-area/tag-area.ts @@ -33,7 +33,7 @@ export class CoreCourseTagAreaComponent { /** * Open a course. * - * @param {number} courseId The course to open. + * @param courseId The course to open. */ openCourse(courseId: number): void { // If this component is inside a split view, use the master nav to open it. diff --git a/src/core/course/formats/singleactivity/components/singleactivity.ts b/src/core/course/formats/singleactivity/components/singleactivity.ts index fb2a21924..946b9ea8d 100644 --- a/src/core/course/formats/singleactivity/components/singleactivity.ts +++ b/src/core/course/formats/singleactivity/components/singleactivity.ts @@ -64,10 +64,10 @@ export class CoreCourseFormatSingleActivityComponent implements OnChanges { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @param {Function} [done] Function to call when done. - * @param {boolean} [afterCompletionChange] Whether the refresh is due to a completion change. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @param done Function to call when done. + * @param afterCompletionChange Whether the refresh is due to a completion change. + * @return Promise resolved when done. */ doRefresh(refresher?: any, done?: () => void, afterCompletionChange?: boolean): Promise { if (afterCompletionChange) { diff --git a/src/core/course/formats/singleactivity/providers/handler.ts b/src/core/course/formats/singleactivity/providers/handler.ts index 328ae5ee6..d85d68ed7 100644 --- a/src/core/course/formats/singleactivity/providers/handler.ts +++ b/src/core/course/formats/singleactivity/providers/handler.ts @@ -32,7 +32,7 @@ export class CoreCourseFormatSingleActivityHandler implements CoreCourseFormatHa /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -41,8 +41,8 @@ export class CoreCourseFormatSingleActivityHandler implements CoreCourseFormatHa /** * Whether it allows seeing all sections at the same time. Defaults to true. * - * @param {any} course The course to check. - * @type {boolean} Whether it can view all sections. + * @param course The course to check. + * @return Whether it can view all sections. */ canViewAllSections(course: any): boolean { return false; @@ -52,9 +52,9 @@ export class CoreCourseFormatSingleActivityHandler implements CoreCourseFormatHa * Get the title to use in course page. If not defined, course displayname or fullname. * This function will be called without sections first, and then call it again when the sections are retrieved. * - * @param {any} course The course. - * @param {any[]} [sections] List of sections. - * @return {string} Title. + * @param course The course. + * @param sections List of sections. + * @return Title. */ getCourseTitle(course: any, sections?: any[]): string { if (sections && sections[0] && sections[0].modules && sections[0].modules[0]) { @@ -73,8 +73,8 @@ export class CoreCourseFormatSingleActivityHandler implements CoreCourseFormatHa /** * Whether the option to enable section/module download should be displayed. Defaults to true. * - * @param {any} course The course to check. - * @return {boolean} Whether the option to enable section/module download should be displayed + * @param course The course to check. + * @return Whether the option to enable section/module download should be displayed */ displayEnableDownload(course: any): boolean { return false; @@ -83,8 +83,8 @@ export class CoreCourseFormatSingleActivityHandler implements CoreCourseFormatHa /** * Whether the default section selector should be displayed. Defaults to true. * - * @param {any} course The course to check. - * @type {boolean} Whether the default section selector should be displayed. + * @param course The course to check. + * @return Whether the default section selector should be displayed. */ displaySectionSelector(course: any): boolean { return false; @@ -94,9 +94,9 @@ export class CoreCourseFormatSingleActivityHandler implements CoreCourseFormatHa * Whether the course refresher should be displayed. If it returns false, a refresher must be included in the course format, * and the doRefresh method of CoreCourseSectionPage must be called on refresh. Defaults to true. * - * @param {any} course The course to check. - * @param {any[]} sections List of course sections. - * @return {boolean} Whether the refresher should be displayed. + * @param course The course to check. + * @param sections List of course sections. + * @return Whether the refresher should be displayed. */ displayRefresher(course: any, sections: any[]): boolean { if (sections && sections[0] && sections[0].modules && sections[0].modules[0]) { @@ -112,9 +112,9 @@ export class CoreCourseFormatSingleActivityHandler implements CoreCourseFormatHa * If you want to customize the default format there are several methods to customize parts of it. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} course The course to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param course The course to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getCourseFormatComponent(injector: Injector, course: any): any | Promise { return CoreCourseFormatSingleActivityComponent; @@ -124,8 +124,8 @@ export class CoreCourseFormatSingleActivityHandler implements CoreCourseFormatHa * Whether the view should be refreshed when completion changes. If your course format doesn't display * activity completion then you should return false. * - * @param {any} course The course. - * @return {boolean|Promise} Whether course view should be refreshed when an activity completion changes. + * @param course The course. + * @return Whether course view should be refreshed when an activity completion changes. */ shouldRefreshWhenCompletionChanges(course: any): boolean | Promise { return false; diff --git a/src/core/course/formats/topics/providers/handler.ts b/src/core/course/formats/topics/providers/handler.ts index 0f6d49e3c..d4a3c4457 100644 --- a/src/core/course/formats/topics/providers/handler.ts +++ b/src/core/course/formats/topics/providers/handler.ts @@ -30,7 +30,7 @@ export class CoreCourseFormatTopicsHandler implements CoreCourseFormatHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/core/course/formats/weeks/providers/handler.ts b/src/core/course/formats/weeks/providers/handler.ts index ccaef9d44..66245bbbe 100644 --- a/src/core/course/formats/weeks/providers/handler.ts +++ b/src/core/course/formats/weeks/providers/handler.ts @@ -30,7 +30,7 @@ export class CoreCourseFormatWeeksHandler implements CoreCourseFormatHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -39,9 +39,9 @@ export class CoreCourseFormatWeeksHandler implements CoreCourseFormatHandler { /** * Given a list of sections, get the "current" section that should be displayed first. * - * @param {any} course The course to get the title. - * @param {any[]} sections List of sections. - * @return {any|Promise} Current section (or promise resolved with current section). + * @param course The course to get the title. + * @param sections List of sections. + * @return Current section (or promise resolved with current section). */ getCurrentSection(course: any, sections: any[]): any | Promise { const now = this.timeUtils.timestamp(); @@ -70,9 +70,9 @@ export class CoreCourseFormatWeeksHandler implements CoreCourseFormatHandler { /** * Return the start and end date of a section. * - * @param {any} section The section to treat. - * @param {number} startDate The course start date (in seconds). - * @return {{start: number, end: number}} An object with the start and end date of the section. + * @param section The section to treat. + * @param startDate The course start date (in seconds). + * @return An object with the start and end date of the section. */ protected getSectionDates(section: any, startDate: number): { start: number, end: number } { // Hack alert. We add 2 hours to avoid possible DST problems. (e.g. we go into daylight savings and the date changes). diff --git a/src/core/course/pages/list-mod-type/list-mod-type.ts b/src/core/course/pages/list-mod-type/list-mod-type.ts index 37220ae4a..759c3d47d 100644 --- a/src/core/course/pages/list-mod-type/list-mod-type.ts +++ b/src/core/course/pages/list-mod-type/list-mod-type.ts @@ -63,7 +63,7 @@ export class CoreCourseListModTypePage { /** * Fetches the data. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected fetchData(): Promise { // Get all the modules in the course. @@ -113,7 +113,7 @@ export class CoreCourseListModTypePage { /** * Refresh the data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshData(refresher: any): void { this.courseProvider.invalidateSections(this.courseId).finally(() => { diff --git a/src/core/course/pages/section-selector/section-selector.ts b/src/core/course/pages/section-selector/section-selector.ts index 6186fe8ca..381132fba 100644 --- a/src/core/course/pages/section-selector/section-selector.ts +++ b/src/core/course/pages/section-selector/section-selector.ts @@ -69,7 +69,7 @@ export class CoreCourseSectionSelectorPage { /** * Select a section. * - * @param {any} section Selected section object. + * @param section Selected section object. */ selectSection(section: any): void { if (section.uservisible !== false) { diff --git a/src/core/course/pages/section/section.ts b/src/core/course/pages/section/section.ts index 85f3ab89e..f5e61c060 100644 --- a/src/core/course/pages/section/section.ts +++ b/src/core/course/pages/section/section.ts @@ -187,9 +187,9 @@ export class CoreCourseSectionPage implements OnDestroy { /** * Fetch and load all the data required for the view. * - * @param {boolean} [refresh] If it's refreshing content. - * @param {boolean} [sync] If it should try to sync. - * @return {Promise} Promise resolved when done. + * @param refresh If it's refreshing content. + * @param sync If it should try to sync. + * @return Promise resolved when done. */ protected loadData(refresh?: boolean, sync?: boolean): Promise { // First of all, get the course because the data might have changed. @@ -348,8 +348,8 @@ export class CoreCourseSectionPage implements OnDestroy { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @return Promise resolved when done. */ doRefresh(refresher?: any): Promise { return this.invalidateData().finally(() => { @@ -402,7 +402,7 @@ export class CoreCourseSectionPage implements OnDestroy { /** * Refresh list after a completion change since there could be new activities. * - * @param {boolean} [sync] If it should try to sync. + * @param sync If it should try to sync. */ protected refreshAfterCompletionChange(sync?: boolean): void { // Save scroll position to restore it once done. @@ -428,7 +428,7 @@ export class CoreCourseSectionPage implements OnDestroy { /** * Determines the prefetch icon of the course. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected determineCoursePrefetchIcon(): Promise { return this.courseHelper.getCourseStatusIconAndTitle(this.course.id).then((data) => { @@ -460,7 +460,7 @@ export class CoreCourseSectionPage implements OnDestroy { /** * Update the course status icon and title. * - * @param {string} status Status to show. + * @param status Status to show. */ protected updateCourseStatus(status: string): void { const statusData = this.courseHelper.getCourseStatusIconAndTitleFromStatus(status); @@ -479,7 +479,7 @@ export class CoreCourseSectionPage implements OnDestroy { /** * Opens a menu item registered to the delegate. * - * @param {CoreCourseMenuHandlerToDisplay} item Item to open + * @param item Item to open */ openMenuItem(item: CoreCourseOptionsMenuHandlerToDisplay): void { const params = Object.assign({ course: this.course}, item.data.pageParams); diff --git a/src/core/course/providers/course-offline.ts b/src/core/course/providers/course-offline.ts index 4de3ac671..4a5db05af 100644 --- a/src/core/course/providers/course-offline.ts +++ b/src/core/course/providers/course-offline.ts @@ -63,9 +63,9 @@ export class CoreCourseOfflineProvider { /** * Delete a manual completion stored. * - * @param {number} cmId The module ID to remove the completion. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when deleted, rejected if failure. + * @param cmId The module ID to remove the completion. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when deleted, rejected if failure. */ deleteManualCompletion(cmId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -77,8 +77,8 @@ export class CoreCourseOfflineProvider { /** * Get all offline manual completions for a certain course. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the list of completions. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of completions. */ getAllManualCompletions(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -90,9 +90,9 @@ export class CoreCourseOfflineProvider { /** * Get all offline manual completions for a certain course. * - * @param {number} courseId Course ID the module belongs to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the list of completions. + * @param courseId Course ID the module belongs to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of completions. */ getCourseManualCompletions(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -104,9 +104,9 @@ export class CoreCourseOfflineProvider { /** * Get the offline manual completion for a certain module. * - * @param {number} cmId The module ID to remove the completion. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the completion, rejected if failure or not found. + * @param cmId The module ID to remove the completion. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the completion, rejected if failure or not found. */ getManualCompletion(cmId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -118,12 +118,12 @@ export class CoreCourseOfflineProvider { /** * Offline version for manually marking a module as completed. * - * @param {number} cmId The module ID to store the completion. - * @param {number} completed Whether the module is completed or not. - * @param {number} courseId Course ID the module belongs to. - * @param {string} [courseName] Course name. Recommended, it is used to display a better warning message. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise<{status: boolean, offline: boolean}>} Promise resolved when completion is successfully stored. + * @param cmId The module ID to store the completion. + * @param completed Whether the module is completed or not. + * @param courseId Course ID the module belongs to. + * @param courseName Course name. Recommended, it is used to display a better warning message. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when completion is successfully stored. */ markCompletedManually(cmId: number, completed: number, courseId: number, courseName?: string, siteId?: string) : Promise<{status: boolean, offline: boolean}> { diff --git a/src/core/course/providers/course-tag-area-handler.ts b/src/core/course/providers/course-tag-area-handler.ts index 066754de6..6a40f6371 100644 --- a/src/core/course/providers/course-tag-area-handler.ts +++ b/src/core/course/providers/course-tag-area-handler.ts @@ -29,7 +29,7 @@ export class CoreCourseTagAreaHandler implements CoreTagAreaHandler { /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return true; @@ -38,8 +38,8 @@ export class CoreCourseTagAreaHandler implements CoreTagAreaHandler { /** * Parses the rendered content of a tag index and returns the items. * - * @param {string} content Rendered content. - * @return {any[]|Promise} Area items (or promise resolved with the items). + * @param content Rendered content. + * @return Area items (or promise resolved with the items). */ parseContent(content: string): any[] | Promise { const items = []; @@ -65,8 +65,8 @@ export class CoreCourseTagAreaHandler implements CoreTagAreaHandler { /** * Get the component to use to display items. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return CoreCourseTagAreaComponent; diff --git a/src/core/course/providers/course.ts b/src/core/course/providers/course.ts index d15793574..1b1af7c17 100644 --- a/src/core/course/providers/course.ts +++ b/src/core/course/providers/course.ts @@ -113,7 +113,7 @@ export class CoreCourseProvider { /** * Check if the get course blocks WS is available in current site. * - * @return {boolean} Whether it's available. + * @return Whether it's available. * @since 3.7 */ canGetCourseBlocks(): boolean { @@ -124,8 +124,8 @@ export class CoreCourseProvider { /** * Check whether the site supports requesting stealth modules. * - * @param {CoreSite} [site] Site. If not defined, current site. - * @return {boolean} Whether the site supports requesting stealth modules. + * @param site Site. If not defined, current site. + * @return Whether the site supports requesting stealth modules. * @since 3.4.6, 3.5.3, 3.6 */ canRequestStealthModules(site?: CoreSite): boolean { @@ -138,8 +138,8 @@ export class CoreCourseProvider { * Check if module completion could have changed. If it could have, trigger event. This function must be used, * for example, after calling a "module_view" WS since it can change the module completion. * - * @param {number} courseId Course ID. - * @param {any} completion Completion status of the module. + * @param courseId Course ID. + * @param completion Completion status of the module. */ checkModuleCompletion(courseId: number, completion: any): void { if (completion && completion.tracking === 2 && completion.state === 0) { @@ -152,8 +152,8 @@ export class CoreCourseProvider { /** * Clear all courses status in a site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when all status are cleared. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when all status are cleared. */ clearAllCoursesStatus(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -168,9 +168,9 @@ export class CoreCourseProvider { /** * Check if the current view in a NavController is a certain course initial page. * - * @param {NavController} navCtrl NavController. - * @param {number} courseId Course ID. - * @return {boolean} Whether the current view is a certain course. + * @param navCtrl NavController. + * @param courseId Course ID. + * @return Whether the current view is a certain course. */ currentViewIsCourse(navCtrl: NavController, courseId: number): boolean { if (navCtrl) { @@ -185,13 +185,13 @@ export class CoreCourseProvider { /** * Get completion status of all the activities in a course for a certain user. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, current user. - * @param {boolean} [forceCache] True if it should return cached data. Has priority over ignoreCache. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @param {boolean} [includeOffline=true] True if it should load offline data in the completion status. - * @return {Promise} Promise resolved with the completion statuses: object where the key is module ID. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, current user. + * @param forceCache True if it should return cached data. Has priority over ignoreCache. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param includeOffline True if it should load offline data in the completion status. + * @return Promise resolved with the completion statuses: object where the key is module ID. */ getActivitiesCompletionStatus(courseId: number, siteId?: string, userId?: number, forceCache: boolean = false, ignoreCache: boolean = false, includeOffline: boolean = true): Promise { @@ -254,9 +254,9 @@ export class CoreCourseProvider { /** * Get cache key for activities completion WS calls. * - * @param {number} courseId Course ID. - * @param {number} userId User ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @param userId User ID. + * @return Cache key. */ protected getActivitiesCompletionCacheKey(courseId: number, userId: number): string { return this.ROOT_CACHE_KEY + 'activitiescompletion:' + courseId + ':' + userId; @@ -265,9 +265,9 @@ export class CoreCourseProvider { /** * Get course blocks. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the list of blocks. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of blocks. * @since 3.7 */ getCourseBlocks(courseId: number, siteId?: string): Promise { @@ -290,8 +290,8 @@ export class CoreCourseProvider { /** * Get cache key for course blocks WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getCourseBlocksCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'courseblocks:' + courseId; @@ -300,9 +300,9 @@ export class CoreCourseProvider { /** * Get the data stored for a course. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the data. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the data. */ getCourseStatusData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -319,9 +319,9 @@ export class CoreCourseProvider { /** * Get a course status. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the status. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the status. */ getCourseStatus(courseId: number, siteId?: string): Promise { return this.getCourseStatusData(courseId, siteId).then((entry) => { @@ -334,15 +334,15 @@ export class CoreCourseProvider { /** * Get a module from Moodle. * - * @param {number} moduleId The module ID. - * @param {number} [courseId] The course ID. Recommended to speed up the process and minimize data usage. - * @param {number} [sectionId] The section ID. - * @param {boolean} [preferCache] True if shouldn't call WS if data is cached, false otherwise. - * @param {boolean} [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 {string} [modName] If set, the app will retrieve all modules of this type with a single WS call. This reduces the - * number of WS calls, but it isn't recommended for modules that can return a lot of contents. - * @return {Promise} Promise resolved with the module. + * @param moduleId The module ID. + * @param courseId The course ID. Recommended to speed up the process and minimize data usage. + * @param sectionId The section ID. + * @param preferCache True if shouldn't call WS if data is cached, false otherwise. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @param modName If set, the app will retrieve all modules of this type with a single WS call. This reduces the + * number of WS calls, but it isn't recommended for modules that can return a lot of contents. + * @return Promise resolved with the module. */ getModule(moduleId: number, courseId?: number, sectionId?: number, preferCache?: boolean, ignoreCache?: boolean, siteId?: string, modName?: string): Promise { @@ -457,9 +457,9 @@ export class CoreCourseProvider { /** * Gets a module basic info by module ID. * - * @param {number} moduleId Module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the module's info. + * @param moduleId Module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the module's info. */ getModuleBasicInfo(moduleId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -488,9 +488,9 @@ export class CoreCourseProvider { * * If the user does not have permision to manage the activity false is returned. * - * @param {number} moduleId Module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the module's grade info. + * @param moduleId Module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the module's grade info. */ getModuleBasicGradeInfo(moduleId: number, siteId?: string): Promise { return this.getModuleBasicInfo(moduleId, siteId).then((info) => { @@ -514,10 +514,10 @@ export class CoreCourseProvider { /** * Gets a module basic info by instance. * - * @param {number} id Instance ID. - * @param {string} module Name of the module. E.g. 'glossary'. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the module's info. + * @param id Instance ID. + * @param module Name of the module. E.g. 'glossary'. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the module's info. */ getModuleBasicInfoByInstance(id: number, module: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -545,9 +545,9 @@ export class CoreCourseProvider { /** * Get cache key for get module by instance WS calls. * - * @param {number} id Instance ID. - * @param {string} module Name of the module. E.g. 'glossary'. - * @return {string} Cache key. + * @param id Instance ID. + * @param module Name of the module. E.g. 'glossary'. + * @return Cache key. */ protected getModuleBasicInfoByInstanceCacheKey(id: number, module: string): string { return this.ROOT_CACHE_KEY + 'moduleByInstance:' + module + ':' + id; @@ -556,8 +556,8 @@ export class CoreCourseProvider { /** * Get cache key for module WS calls. * - * @param {number} moduleId Module ID. - * @return {string} Cache key. + * @param moduleId Module ID. + * @return Cache key. */ protected getModuleCacheKey(moduleId: number): string { return this.ROOT_CACHE_KEY + 'module:' + moduleId; @@ -566,8 +566,8 @@ export class CoreCourseProvider { /** * Get cache key for module by modname WS calls. * - * @param {string} modName Name of the module. - * @return {string} Cache key. + * @param modName Name of the module. + * @return Cache key. */ protected getModuleByModNameCacheKey(modName: string): string { return this.ROOT_CACHE_KEY + 'module:modName:' + modName; @@ -576,9 +576,9 @@ export class CoreCourseProvider { /** * Returns the source to a module icon. * - * @param {string} moduleName The module name. - * @param {string} [modicon] The mod icon string to use in case we are not using a core activity. - * @return {string} The IMG src. + * @param moduleName The module name. + * @param modicon The mod icon string to use in case we are not using a core activity. + * @return The IMG src. */ getModuleIconSrc(moduleName: string, modicon?: string): string { // @TODO: Check modicon url theme to apply other theme icons. @@ -598,9 +598,9 @@ export class CoreCourseProvider { /** * Get the section ID a module belongs to. * - * @param {number} moduleId The module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the section ID. + * @param moduleId The module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the section ID. */ getModuleSectionId(moduleId: number, siteId?: string): Promise { // Try to get the section using getModuleBasicInfo. @@ -612,12 +612,12 @@ export class CoreCourseProvider { /** * Return a specific section. * - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @param {boolean} [excludeModules] Do not return modules, return only the sections structure. - * @param {boolean} [excludeContents] Do not return module contents (i.e: files inside a resource). - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the section. + * @param courseId The course ID. + * @param sectionId The section ID. + * @param excludeModules Do not return modules, return only the sections structure. + * @param excludeContents Do not return module contents (i.e: files inside a resource). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the section. */ getSection(courseId: number, sectionId?: number, excludeModules?: boolean, excludeContents?: boolean, siteId?: string) : Promise { @@ -640,13 +640,13 @@ export class CoreCourseProvider { /** * Get the course sections. * - * @param {number} courseId The course ID. - * @param {boolean} [excludeModules] Do not return modules, return only the sections structure. - * @param {boolean} [excludeContents] Do not return module contents (i.e: files inside a resource). - * @param {CoreSiteWSPreSets} [preSets] Presets to use. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [includeStealthModules] Whether to include stealth modules. Defaults to true. - * @return {Promise} The reject contains the error message, else contains the sections. + * @param courseId The course ID. + * @param excludeModules Do not return modules, return only the sections structure. + * @param excludeContents Do not return module contents (i.e: files inside a resource). + * @param preSets Presets to use. + * @param siteId Site ID. If not defined, current site. + * @param includeStealthModules Whether to include stealth modules. Defaults to true. + * @return The reject contains the error message, else contains the sections. */ getSections(courseId?: number, excludeModules?: boolean, excludeContents?: boolean, preSets?: CoreSiteWSPreSets, siteId?: string, includeStealthModules: boolean = true): Promise { @@ -705,8 +705,8 @@ export class CoreCourseProvider { /** * Get cache key for section WS call. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getSectionsCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'sections:' + courseId; @@ -715,8 +715,8 @@ export class CoreCourseProvider { /** * Given a list of sections, returns the list of modules in the sections. * - * @param {any[]} sections Sections. - * @return {any[]} Modules. + * @param sections Sections. + * @return Modules. */ getSectionsModules(sections: any[]): any[] { if (!sections || !sections.length) { @@ -736,9 +736,9 @@ export class CoreCourseProvider { /** * Invalidates course blocks WS call. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateCourseBlocks(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -749,10 +749,10 @@ export class CoreCourseProvider { /** * Invalidates module WS call. * - * @param {number} moduleId Module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {string} [modName] Module name. E.g. 'label', 'url', ... - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId Module ID. + * @param siteId Site ID. If not defined, current site. + * @param modName Module name. E.g. 'label', 'url', ... + * @return Promise resolved when the data is invalidated. */ invalidateModule(moduleId: number, siteId?: string, modName?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -771,10 +771,10 @@ export class CoreCourseProvider { /** * Invalidates module WS call. * - * @param {number} id Instance ID. - * @param {string} module Name of the module. E.g. 'glossary'. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param id Instance ID. + * @param module Name of the module. E.g. 'glossary'. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateModuleByInstance(id: number, module: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -785,10 +785,10 @@ export class CoreCourseProvider { /** * Invalidates sections WS call. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, current user. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, current user. + * @return Promise resolved when the data is invalidated. */ invalidateSections(courseId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -810,15 +810,15 @@ export class CoreCourseProvider { /** * Load module contents into module.contents if they aren't loaded already. * - * @param {any} module Module to load the contents. - * @param {number} [courseId] The course ID. Recommended to speed up the process and minimize data usage. - * @param {number} [sectionId] The section ID. - * @param {boolean} [preferCache] True if shouldn't call WS if data is cached, false otherwise. - * @param {boolean} [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 {string} [modName] If set, the app will retrieve all modules of this type with a single WS call. This reduces the - * number of WS calls, but it isn't recommended for modules that can return a lot of contents. - * @return {Promise} Promise resolved when loaded. + * @param module Module to load the contents. + * @param courseId The course ID. Recommended to speed up the process and minimize data usage. + * @param sectionId The section ID. + * @param preferCache True if shouldn't call WS if data is cached, false otherwise. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @param modName If set, the app will retrieve all modules of this type with a single WS call. This reduces the + * number of WS calls, but it isn't recommended for modules that can return a lot of contents. + * @return Promise resolved when loaded. */ loadModuleContents(module: any, courseId?: number, sectionId?: number, preferCache?: boolean, ignoreCache?: boolean, siteId?: string, modName?: string): Promise { @@ -836,11 +836,11 @@ export class CoreCourseProvider { /** * Report a course and section as being viewed. * - * @param {number} courseId Course ID. - * @param {number} [sectionNumber] Section number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {string} [name] Name of the course. - * @return {Promise} Promise resolved when the WS call is successful. + * @param courseId Course ID. + * @param sectionNumber Section number. + * @param siteId Site ID. If not defined, current site. + * @param name Name of the course. + * @return Promise resolved when the WS call is successful. */ logView(courseId: number, sectionNumber?: number, siteId?: string, name?: string): Promise { const params: any = { @@ -866,12 +866,12 @@ export class CoreCourseProvider { /** * Offline version for manually marking a module as completed. * - * @param {number} cmId The module ID. - * @param {number} completed Whether the module is completed or not. - * @param {number} courseId Course ID the module belongs to. - * @param {string} [courseName] Course name. Recommended, it is used to display a better warning message. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when completion is successfully sent or stored. + * @param cmId The module ID. + * @param completed Whether the module is completed or not. + * @param courseId Course ID the module belongs to. + * @param courseName Course name. Recommended, it is used to display a better warning message. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when completion is successfully sent or stored. */ markCompletedManually(cmId: number, completed: number, courseId: number, courseName?: string, siteId?: string) : Promise { @@ -911,10 +911,10 @@ export class CoreCourseProvider { /** * Offline version for manually marking a module as completed. * - * @param {number} cmId The module ID. - * @param {number} completed Whether the module is completed or not. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when completion is successfully sent. + * @param cmId The module ID. + * @param completed Whether the module is completed or not. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when completion is successfully sent. */ markCompletedManuallyOnline(cmId: number, completed: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -930,8 +930,8 @@ export class CoreCourseProvider { /** * Check if a module has a view page. E.g. labels don't have a view page. * - * @param {any} module The module object. - * @return {boolean} Whether the module has a view page. + * @param module The module object. + * @return Whether the module has a view page. */ moduleHasView(module: any): boolean { return !!module.url; @@ -947,10 +947,10 @@ export class CoreCourseProvider { * * This function must be in here instead of course helper to prevent circular dependencies. * - * @param {NavController} navCtrl The nav controller to use. If not defined, the course will be opened in main menu. - * @param {any} course Course to open - * @param {any} [params] Other params to pass to the course page. - * @return {Promise} Promise resolved when done. + * @param navCtrl The nav controller to use. If not defined, the course will be opened in main menu. + * @param course Course to open + * @param params Other params to pass to the course page. + * @return Promise resolved when done. */ openCourse(navCtrl: NavController, course: any, params?: any): Promise { const loading = this.domUtils.showModalLoading(); @@ -1000,8 +1000,8 @@ export class CoreCourseProvider { /** * Select a certain tab in the course. Please use currentViewIsCourse() first to verify user is viewing the course. * - * @param {string} [name] Name of the tab. If not provided, course contents. - * @param {any} [params] Other params. + * @param name Name of the tab. If not provided, course contents. + * @param params Other params. */ selectCourseTab(name?: string, params?: any): void { params = params || {}; @@ -1013,9 +1013,9 @@ export class CoreCourseProvider { /** * Change the course status, setting it to the previous status. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the status is changed. Resolve param: new status. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the status is changed. Resolve param: new status. */ setCoursePreviousStatus(courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -1050,10 +1050,10 @@ export class CoreCourseProvider { /** * Store course status. * - * @param {number} courseId Course ID. - * @param {string} status New course status. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the status is stored. + * @param courseId Course ID. + * @param status New course status. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the status is stored. */ setCourseStatus(courseId: number, status: string, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -1107,8 +1107,8 @@ export class CoreCourseProvider { /** * Translate a module name to current language. * - * @param {string} moduleName The module name. - * @return {string} Translated name. + * @param moduleName The module name. + * @return Translated name. */ translateModuleName(moduleName: string): string { if (this.CORE_MODULES.indexOf(moduleName) < 0) { @@ -1124,9 +1124,9 @@ export class CoreCourseProvider { /** * Trigger COURSE_STATUS_CHANGED with the right data. * - * @param {number} courseId Course ID. - * @param {string} status New course status. - * @param {string} [siteId] Site ID. If not defined, current site. + * @param courseId Course ID. + * @param status New course status. + * @param siteId Site ID. If not defined, current site. */ protected triggerCourseStatusChanged(courseId: number, status: string, siteId?: string): void { this.eventsProvider.trigger(CoreEventsProvider.COURSE_STATUS_CHANGED, { diff --git a/src/core/course/providers/default-format.ts b/src/core/course/providers/default-format.ts index e03341376..56a0c2840 100644 --- a/src/core/course/providers/default-format.ts +++ b/src/core/course/providers/default-format.ts @@ -33,7 +33,7 @@ export class CoreCourseFormatDefaultHandler implements CoreCourseFormatHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -42,8 +42,8 @@ export class CoreCourseFormatDefaultHandler implements CoreCourseFormatHandler { /** * Get the title to use in course page. * - * @param {any} course The course. - * @return {string} Title. + * @param course The course. + * @return Title. */ getCourseTitle(course: any): string { if (course.displayname) { @@ -58,8 +58,8 @@ export class CoreCourseFormatDefaultHandler implements CoreCourseFormatHandler { /** * Whether it allows seeing all sections at the same time. Defaults to true. * - * @param {any} course The course to check. - * @type {boolean} Whether it can view all sections. + * @param course The course to check. + * @return Whether it can view all sections. */ canViewAllSections(course: any): boolean { return true; @@ -68,8 +68,8 @@ export class CoreCourseFormatDefaultHandler implements CoreCourseFormatHandler { /** * Whether the option to enable section/module download should be displayed. Defaults to true. * - * @param {any} course The course to check. - * @return {boolean} Whether the option to enable section/module download should be displayed + * @param course The course to check. + * @return Whether the option to enable section/module download should be displayed */ displayEnableDownload(course: any): boolean { return true; @@ -78,8 +78,8 @@ export class CoreCourseFormatDefaultHandler implements CoreCourseFormatHandler { /** * Whether the default section selector should be displayed. Defaults to true. * - * @param {any} course The course to check. - * @type {boolean} Whether the default section selector should be displayed. + * @param course The course to check. + * @return Whether the default section selector should be displayed. */ displaySectionSelector(course: any): boolean { return true; @@ -89,9 +89,9 @@ export class CoreCourseFormatDefaultHandler implements CoreCourseFormatHandler { * Whether the course refresher should be displayed. If it returns false, a refresher must be included in the course format, * and the doRefresh method of CoreCourseSectionPage must be called on refresh. Defaults to true. * - * @param {any} course The course to check. - * @param {any[]} sections List of course sections. - * @return {boolean} Whether the refresher should be displayed. + * @param course The course to check. + * @param sections List of course sections. + * @return Whether the refresher should be displayed. */ displayRefresher?(course: any, sections: any[]): boolean { return true; @@ -100,9 +100,9 @@ export class CoreCourseFormatDefaultHandler implements CoreCourseFormatHandler { /** * Given a list of sections, get the "current" section that should be displayed first. * - * @param {any} course The course to get the title. - * @param {any[]} sections List of sections. - * @return {any|Promise} Current section (or promise resolved with current section). + * @param course The course to get the title. + * @param sections List of sections. + * @return Current section (or promise resolved with current section). */ getCurrentSection(course: any, sections: any[]): any | Promise { let promise; @@ -143,9 +143,9 @@ export class CoreCourseFormatDefaultHandler implements CoreCourseFormatHandler { /** * Invalidate the data required to load the course format. * - * @param {any} course The course to get the title. - * @param {any[]} sections List of sections. - * @return {Promise} Promise resolved when the data is invalidated. + * @param course The course to get the title. + * @param sections List of sections. + * @return Promise resolved when the data is invalidated. */ invalidateData(course: any, sections: any[]): Promise { return this.coursesProvider.invalidateCoursesByField('id', course.id); @@ -157,10 +157,10 @@ export class CoreCourseFormatDefaultHandler implements CoreCourseFormatHandler { * getCourseFormatComponent because it will display the course handlers at the top. * Your page should include the course handlers using CoreCoursesDelegate. * - * @param {NavController} navCtrl The NavController instance to use. If not defined, please use loginHelper.redirect. - * @param {any} course The course to open. It should contain a "format" attribute. - * @param {any} [params] Params to pass to the course page. - * @return {Promise} Promise resolved when done. + * @param navCtrl The NavController instance to use. If not defined, please use loginHelper.redirect. + * @param course The course to open. It should contain a "format" attribute. + * @param params Params to pass to the course page. + * @return Promise resolved when done. */ openCourse(navCtrl: NavController, course: any, params?: any): Promise { params = params || {}; @@ -183,8 +183,8 @@ export class CoreCourseFormatDefaultHandler implements CoreCourseFormatHandler { * Whether the view should be refreshed when completion changes. If your course format doesn't display * activity completion then you should return false. * - * @param {any} course The course. - * @return {boolean|Promise} Whether course view should be refreshed when an activity completion changes. + * @param course The course. + * @return Whether course view should be refreshed when an activity completion changes. */ shouldRefreshWhenCompletionChanges(course: any): boolean | Promise { return true; diff --git a/src/core/course/providers/default-module.ts b/src/core/course/providers/default-module.ts index f82e1b2d9..1e5af3d8d 100644 --- a/src/core/course/providers/default-module.ts +++ b/src/core/course/providers/default-module.ts @@ -31,7 +31,7 @@ export class CoreCourseModuleDefaultHandler implements CoreCourseModuleHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -40,10 +40,10 @@ export class CoreCourseModuleDefaultHandler implements CoreCourseModuleHandler { /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { // Return the default data. @@ -80,10 +80,10 @@ export class CoreCourseModuleDefaultHandler implements CoreCourseModuleHandler { * The component returned must implement CoreCourseModuleMainComponent. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param course The course object. + * @param module The module object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getMainComponent(injector: Injector, course: any, module: any): any | Promise { // We can't inject CoreCourseUnsupportedModuleComponent here due to circular dependencies. @@ -94,7 +94,7 @@ export class CoreCourseModuleDefaultHandler implements CoreCourseModuleHandler { * Whether to display the course refresher in single activity course format. If it returns false, a refresher must be * included in the template that calls the doRefresh method of the component. Defaults to true. * - * @return {boolean} Whether the refresher should be displayed. + * @return Whether the refresher should be displayed. */ displayRefresherInSingleActivity(): boolean { return true; diff --git a/src/core/course/providers/format-delegate.ts b/src/core/course/providers/format-delegate.ts index b65560ced..9fecdf9a3 100644 --- a/src/core/course/providers/format-delegate.ts +++ b/src/core/course/providers/format-delegate.ts @@ -26,7 +26,6 @@ import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate'; export interface CoreCourseFormatHandler extends CoreDelegateHandler { /** * Name of the format the handler supports. E.g. 'singleactivity'. - * @type {string} */ format: string; @@ -34,33 +33,33 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * Get the title to use in course page. If not defined, course fullname. * This function will be called without sections first, and then call it again when the sections are retrieved. * - * @param {any} course The course. - * @param {any[]} [sections] List of sections. - * @return {string} Title. + * @param course The course. + * @param sections List of sections. + * @return Title. */ getCourseTitle?(course: any, sections?: any[]): string; /** * Whether it allows seeing all sections at the same time. Defaults to true. * - * @param {any} course The course to check. - * @type {boolean} Whether it can view all sections. + * @param course The course to check. + * @return Whether it can view all sections. */ canViewAllSections?(course: any): boolean; /** * Whether the option to enable section/module download should be displayed. Defaults to true. * - * @param {any} course The course to check. - * @type {boolean} Whether the option to enable section/module download should be displayed. + * @param course The course to check. + * @return Whether the option to enable section/module download should be displayed. */ displayEnableDownload?(course: any): boolean; /** * Whether the default section selector should be displayed. Defaults to true. * - * @param {any} course The course to check. - * @type {boolean} Whether the default section selector should be displayed. + * @param course The course to check. + * @return Whether the default section selector should be displayed. */ displaySectionSelector?(course: any): boolean; @@ -68,19 +67,19 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * Whether the course refresher should be displayed. If it returns false, a refresher must be included in the course format, * and the doRefresh method of CoreCourseSectionPage must be called on refresh. Defaults to true. * - * @param {any} course The course to check. - * @param {any[]} sections List of course sections. - * @type {boolean} Whether the refresher should be displayed. + * @param course The course to check. + * @param sections List of course sections. + * @return Whether the refresher should be displayed. */ displayRefresher?(course: any, sections: any[]): boolean; /** * Given a list of sections, get the "current" section that should be displayed first. Defaults to first section. * - * @param {any} course The course to get the title. - * @param {any[]} sections List of sections. - * @return {any|Promise} Current section (or promise resolved with current section). If a promise is returned, it should - * never fail. + * @param course The course to get the title. + * @param sections List of sections. + * @return Current section (or promise resolved with current section). If a promise is returned, it should + * never fail. */ getCurrentSection?(course: any, sections: any[]): any | Promise; @@ -90,10 +89,10 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * getCourseFormatComponent because it will display the course handlers at the top. * Your page should include the course handlers using CoreCoursesDelegate. * - * @param {NavController} navCtrl The NavController instance to use. - * @param {any} course The course to open. It should contain a "format" attribute. - * @param {any} [params] Params to pass to the course page. - * @return {Promise} Promise resolved when done. + * @param navCtrl The NavController instance to use. + * @param course The course to open. It should contain a "format" attribute. + * @param params Params to pass to the course page. + * @return Promise resolved when done. */ openCourse?(navCtrl: NavController, course: any, params?: any): Promise; @@ -103,9 +102,9 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * If you want to customize the default format there are several methods to customize parts of it. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} course The course to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param course The course to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getCourseFormatComponent?(injector: Injector, course: any): any | Promise; @@ -113,9 +112,9 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * Return the Component to use to display the course summary inside the default course format. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} course The course to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param course The course to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getCourseSummaryComponent?(injector: Injector, course: any): any | Promise; @@ -123,9 +122,9 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * Return the Component to use to display the section selector inside the default course format. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} course The course to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param course The course to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getSectionSelectorComponent?(injector: Injector, course: any): any | Promise; @@ -134,9 +133,9 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * single section. If all the sections are displayed at once then it won't be used. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} course The course to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param course The course to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getSingleSectionComponent?(injector: Injector, course: any): any | Promise; @@ -144,18 +143,18 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * Return the Component to use to display all sections in a course. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} course The course to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param course The course to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getAllSectionsComponent?(injector: Injector, course: any): any | Promise; /** * Invalidate the data required to load the course format. * - * @param {any} course The course to get the title. - * @param {any[]} sections List of sections. - * @return {Promise} Promise resolved when the data is invalidated. + * @param course The course to get the title. + * @param sections List of sections. + * @return Promise resolved when the data is invalidated. */ invalidateData?(course: any, sections: any[]): Promise; @@ -163,8 +162,8 @@ export interface CoreCourseFormatHandler extends CoreDelegateHandler { * Whether the view should be refreshed when completion changes. If your course format doesn't display * activity completion then you should return false. * - * @param {any} course The course. - * @return {boolean|Promise} Whether course view should be refreshed when an activity completion changes. + * @param course The course. + * @return Whether course view should be refreshed when an activity completion changes. */ shouldRefreshWhenCompletionChanges?(course: any): boolean | Promise; } @@ -185,8 +184,8 @@ export class CoreCourseFormatDelegate extends CoreDelegate { /** * Whether it allows seeing all sections at the same time. Defaults to true. * - * @param {any} course The course to check. - * @return {boolean} Whether it allows seeing all sections at the same time. + * @param course The course to check. + * @return Whether it allows seeing all sections at the same time. */ canViewAllSections(course: any): boolean { return this.executeFunctionOnEnabled(course.format, 'canViewAllSections', [course]); @@ -195,8 +194,8 @@ export class CoreCourseFormatDelegate extends CoreDelegate { /** * Whether the option to enable section/module download should be displayed. Defaults to true. * - * @param {any} course The course to check. - * @return {boolean} Whether the option to enable section/module download should be displayed + * @param course The course to check. + * @return Whether the option to enable section/module download should be displayed */ displayEnableDownload(course: any): boolean { return this.executeFunctionOnEnabled(course.format, 'displayEnableDownload', [course]); @@ -206,9 +205,9 @@ export class CoreCourseFormatDelegate extends CoreDelegate { * Whether the course refresher should be displayed. If it returns false, a refresher must be included in the course format, * and the doRefresh method of CoreCourseSectionPage must be called on refresh. Defaults to true. * - * @param {any} course The course to check. - * @param {any[]} sections List of course sections. - * @return {boolean} Whether the refresher should be displayed. + * @param course The course to check. + * @param sections List of course sections. + * @return Whether the refresher should be displayed. */ displayRefresher(course: any, sections: any[]): boolean { return this.executeFunctionOnEnabled(course.format, 'displayRefresher', [course, sections]); @@ -217,8 +216,8 @@ export class CoreCourseFormatDelegate extends CoreDelegate { /** * Whether the default section selector should be displayed. Defaults to true. * - * @param {any} course The course to check. - * @return {boolean} Whether the section selector should be displayed. + * @param course The course to check. + * @return Whether the section selector should be displayed. */ displaySectionSelector(course: any): boolean { return this.executeFunctionOnEnabled(course.format, 'displaySectionSelector', [course]); @@ -227,9 +226,9 @@ export class CoreCourseFormatDelegate extends CoreDelegate { /** * Get the component to use to display all sections in a course. * - * @param {Injector} injector Injector. - * @param {any} course The course to render. - * @return {Promise} Promise resolved with component to use, undefined if not found. + * @param injector Injector. + * @param course The course to render. + * @return Promise resolved with component to use, undefined if not found. */ getAllSectionsComponent(injector: Injector, course: any): Promise { return Promise.resolve(this.executeFunctionOnEnabled(course.format, 'getAllSectionsComponent', [injector, course])) @@ -241,9 +240,9 @@ export class CoreCourseFormatDelegate extends CoreDelegate { /** * Get the component to use to display a course format. * - * @param {Injector} injector Injector. - * @param {any} course The course to render. - * @return {Promise} Promise resolved with component to use, undefined if not found. + * @param injector Injector. + * @param course The course to render. + * @return Promise resolved with component to use, undefined if not found. */ getCourseFormatComponent(injector: Injector, course: any): Promise { return Promise.resolve(this.executeFunctionOnEnabled(course.format, 'getCourseFormatComponent', [injector, course])) @@ -255,9 +254,9 @@ export class CoreCourseFormatDelegate extends CoreDelegate { /** * Get the component to use to display the course summary in the default course format. * - * @param {Injector} injector Injector. - * @param {any} course The course to render. - * @return {Promise} Promise resolved with component to use, undefined if not found. + * @param injector Injector. + * @param course The course to render. + * @return Promise resolved with component to use, undefined if not found. */ getCourseSummaryComponent(injector: Injector, course: any): Promise { return Promise.resolve(this.executeFunctionOnEnabled(course.format, 'getCourseSummaryComponent', [injector, course])) @@ -269,9 +268,9 @@ export class CoreCourseFormatDelegate extends CoreDelegate { /** * Given a course, return the title to use in the course page. * - * @param {any} course The course to get the title. - * @param {any[]} [sections] List of sections. - * @return {string} Course title. + * @param course The course to get the title. + * @param sections List of sections. + * @return Course title. */ getCourseTitle(course: any, sections?: any[]): string { return this.executeFunctionOnEnabled(course.format, 'getCourseTitle', [course, sections]); @@ -280,9 +279,9 @@ export class CoreCourseFormatDelegate extends CoreDelegate { /** * Given a course and a list of sections, return the current section that should be displayed first. * - * @param {any} course The course to get the title. - * @param {any[]} sections List of sections. - * @return {Promise} Promise resolved with current section. + * @param course The course to get the title. + * @param sections List of sections. + * @return Promise resolved with current section. */ getCurrentSection(course: any, sections: any[]): Promise { @@ -296,9 +295,9 @@ export class CoreCourseFormatDelegate extends CoreDelegate { /** * Get the component to use to display the section selector inside the default course format. * - * @param {Injector} injector Injector. - * @param {any} course The course to render. - * @return {Promise} Promise resolved with component to use, undefined if not found. + * @param injector Injector. + * @param course The course to render. + * @return Promise resolved with component to use, undefined if not found. */ getSectionSelectorComponent(injector: Injector, course: any): Promise { return Promise.resolve(this.executeFunctionOnEnabled(course.format, 'getSectionSelectorComponent', [injector, course])) @@ -311,9 +310,9 @@ export class CoreCourseFormatDelegate extends CoreDelegate { * Get the component to use to display a single section. This component will only be used if the user is viewing * a single section. If all the sections are displayed at once then it won't be used. * - * @param {Injector} injector Injector. - * @param {any} course The course to render. - * @return {Promise} Promise resolved with component to use, undefined if not found. + * @param injector Injector. + * @param course The course to render. + * @return Promise resolved with component to use, undefined if not found. */ getSingleSectionComponent(injector: Injector, course: any): Promise { return Promise.resolve(this.executeFunctionOnEnabled(course.format, 'getSingleSectionComponent', [injector, course])) @@ -325,9 +324,9 @@ export class CoreCourseFormatDelegate extends CoreDelegate { /** * Invalidate the data required to load the course format. * - * @param {any} course The course to get the title. - * @param {any[]} sections List of sections. - * @return {Promise} Promise resolved when the data is invalidated. + * @param course The course to get the title. + * @param sections List of sections. + * @return Promise resolved when the data is invalidated. */ invalidateData(course: any, sections: any[]): Promise { return this.executeFunctionOnEnabled(course.format, 'invalidateData', [course, sections]); @@ -336,10 +335,10 @@ export class CoreCourseFormatDelegate extends CoreDelegate { /** * Open a course. * - * @param {NavController} navCtrl The NavController instance to use. - * @param {any} course The course to open. It should contain a "format" attribute. - * @param {any} [params] Params to pass to the course page. - * @return {Promise} Promise resolved when done. + * @param navCtrl The NavController instance to use. + * @param course The course to open. It should contain a "format" attribute. + * @param params Params to pass to the course page. + * @return Promise resolved when done. */ openCourse(navCtrl: NavController, course: any, params?: any): Promise { return this.executeFunctionOnEnabled(course.format, 'openCourse', [navCtrl, course, params]); @@ -349,8 +348,8 @@ export class CoreCourseFormatDelegate extends CoreDelegate { * Whether the view should be refreshed when completion changes. If your course format doesn't display * activity completion then you should return false. * - * @param {any} course The course. - * @return {Promise} Whether course view should be refreshed when an activity completion changes. + * @param course The course. + * @return Whether course view should be refreshed when an activity completion changes. */ shouldRefreshWhenCompletionChanges(course: any): Promise { return Promise.resolve(this.executeFunctionOnEnabled(course.format, 'shouldRefreshWhenCompletionChanges', [course])); diff --git a/src/core/course/providers/helper.ts b/src/core/course/providers/helper.ts index 73d30973c..a82b1508b 100644 --- a/src/core/course/providers/helper.ts +++ b/src/core/course/providers/helper.ts @@ -45,37 +45,31 @@ import * as moment from 'moment'; export type CoreCourseModulePrefetchInfo = { /** * Downloaded size. - * @type {number} */ size?: number; /** * Downloadable size in a readable format. - * @type {string} */ sizeReadable?: string; /** * Module status. - * @type {string} */ status?: string; /** * Icon's name of the module status. - * @type {string} */ statusIcon?: string; /** * Time when the module was last downloaded. - * @type {number} */ downloadTime?: number; /** * Download time in a readable format. - * @type {string} */ downloadTimeReadable?: string; }; @@ -86,25 +80,21 @@ export type CoreCourseModulePrefetchInfo = { export type CoreCourseCoursesProgress = { /** * Number of courses downloaded so far. - * @type {number} */ count: number; /** * Toal of courses to download. - * @type {number} */ total: number; /** * Whether the download has been successful so far. - * @type {boolean} */ success: boolean; /** * Last downloaded course. - * @type {number} */ courseId?: number; }; @@ -136,11 +126,11 @@ export class CoreCourseHelperProvider { * This function treats every module on the sections provided to load the handler data, treat completion * and navigate to a module page if required. It also returns if sections has content. * - * @param {any[]} sections List of sections to treat modules. - * @param {number} courseId Course ID of the modules. - * @param {any[]} [completionStatus] List of completion status. - * @param {string} [courseName] Course name. Recommended if completionStatus is supplied. - * @return {boolean} Whether the sections have content. + * @param sections List of sections to treat modules. + * @param courseId Course ID of the modules. + * @param completionStatus List of completion status. + * @param courseName Course name. Recommended if completionStatus is supplied. + * @return Whether the sections have content. */ addHandlerDataForModules(sections: any[], courseId: number, completionStatus?: any, courseName?: string): boolean { let hasContent = false; @@ -184,11 +174,11 @@ export class CoreCourseHelperProvider { /** * Calculate the status of a section. * - * @param {any} section Section to calculate its status. It can't be "All sections". - * @param {number} courseId Course ID the section belongs to. - * @param {boolean} [refresh] True if it shouldn't use module status cache (slower). - * @param {boolean} [checkUpdates=true] Whether to use the WS to check updates. Defaults to true. - * @return {Promise} Promise resolved when the status is calculated. + * @param section Section to calculate its status. It can't be "All sections". + * @param courseId Course ID the section belongs to. + * @param refresh True if it shouldn't use module status cache (slower). + * @param checkUpdates Whether to use the WS to check updates. Defaults to true. + * @return Promise resolved when the status is calculated. */ calculateSectionStatus(section: any, courseId: number, refresh?: boolean, checkUpdates: boolean = true): Promise { @@ -228,11 +218,11 @@ export class CoreCourseHelperProvider { /** * Calculate the status of a list of sections, setting attributes to determine the icons/data to be shown. * - * @param {any[]} sections Sections to calculate their status. - * @param {number} courseId Course ID the sections belong to. - * @param {boolean} [refresh] True if it shouldn't use module status cache (slower). - * @param {boolean} [checkUpdates=true] Whether to use the WS to check updates. Defaults to true. - * @return {Promise} Promise resolved when the states are calculated. + * @param sections Sections to calculate their status. + * @param courseId Course ID the sections belong to. + * @param refresh True if it shouldn't use module status cache (slower). + * @param checkUpdates Whether to use the WS to check updates. Defaults to true. + * @return Promise resolved when the states are calculated. */ calculateSectionsStatus(sections: any[], courseId: number, refresh?: boolean, checkUpdates: boolean = true): Promise { const promises = []; @@ -274,12 +264,12 @@ export class CoreCourseHelperProvider { * This function will set the icon to "spinner" when starting and it will also set it back to the initial icon if the * user cancels. All the other updates of the icon should be made when CoreEventsProvider.COURSE_STATUS_CHANGED is received. * - * @param {any} data An object where to store the course icon and title: "prefetchCourseIcon", "title" and "downloadSucceeded". - * @param {any} course Course to prefetch. - * @param {any[]} [sections] List of course sections. - * @param {CoreCourseOptionsHandlerToDisplay[]} courseHandlers List of course handlers. - * @param {CoreCourseOptionsMenuHandlerToDisplay[]} menuHandlers List of course menu handlers. - * @return {Promise} Promise resolved when the download finishes, rejected if an error occurs or the user cancels. + * @param data An object where to store the course icon and title: "prefetchCourseIcon", "title" and "downloadSucceeded". + * @param course Course to prefetch. + * @param sections List of course sections. + * @param courseHandlers List of course handlers. + * @param menuHandlers List of course menu handlers. + * @return Promise resolved when the download finishes, rejected if an error occurs or the user cancels. */ confirmAndPrefetchCourse(data: any, course: any, sections?: any[], courseHandlers?: CoreCourseOptionsHandlerToDisplay[], menuHandlers?: CoreCourseOptionsMenuHandlerToDisplay[]): Promise { @@ -341,9 +331,9 @@ export class CoreCourseHelperProvider { /** * Confirm and prefetches a list of courses. * - * @param {any[]} courses List of courses to download. - * @param {Function} [onProgress] Function to call everytime a course is downloaded. - * @return {Promise} Resolved when downloaded, rejected if error or canceled. + * @param courses List of courses to download. + * @param onProgress Function to call everytime a course is downloaded. + * @return Resolved when downloaded, rejected if error or canceled. */ confirmAndPrefetchCourses(courses: any[], onProgress?: (data: CoreCourseCoursesProgress) => void): Promise { const siteId = this.sitesProvider.getCurrentSiteId(); @@ -399,9 +389,9 @@ export class CoreCourseHelperProvider { /** * Show confirmation dialog and then remove a module files. * - * @param {any} module Module to remove the files. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when done. + * @param module Module to remove the files. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when done. */ confirmAndRemoveFiles(module: any, courseId: number): Promise { return this.domUtils.showConfirm(this.translate.instant('core.course.confirmdeletemodulefiles')).then(() => { @@ -416,11 +406,11 @@ export class CoreCourseHelperProvider { /** * Calculate the size to download a section and show a confirm modal if needed. * - * @param {number} courseId Course ID the section belongs to. - * @param {any} [section] Section. If not provided, all sections. - * @param {any[]} [sections] List of sections. Used when downloading all the sections. - * @param {boolean} [alwaysConfirm] True to show a confirm even if the size isn't high, false otherwise. - * @return {Promise} Promise resolved if the user confirms or there's no need to confirm. + * @param courseId Course ID the section belongs to. + * @param section Section. If not provided, all sections. + * @param sections List of sections. Used when downloading all the sections. + * @param alwaysConfirm True to show a confirm even if the size isn't high, false otherwise. + * @return Promise resolved if the user confirms or there's no need to confirm. */ confirmDownloadSizeSection(courseId: number, section?: any, sections?: any[], alwaysConfirm?: boolean): Promise { let sizePromise, @@ -472,11 +462,11 @@ export class CoreCourseHelperProvider { * Helper function to prefetch a module, showing a confirmation modal if the size is big. * This function is meant to be called from a context menu option. It will also modify some data like the prefetch icon. * - * @param {any} instance The component instance that has the context menu. It should have prefetchStatusIcon and isDestroyed. - * @param {any} module Module to be prefetched - * @param {number} courseId Course ID the module belongs to. - * @param {Function} [done] Function to call when done. It will close the context menu. - * @return {Promise} Promise resolved when done. + * @param instance The component instance that has the context menu. It should have prefetchStatusIcon and isDestroyed. + * @param module Module to be prefetched + * @param courseId Course ID the module belongs to. + * @param done Function to call when done. It will close the context menu. + * @return Promise resolved when done. */ contextMenuPrefetch(instance: any, module: any, courseId: number, done?: () => void): Promise { const initialIcon = instance.prefetchStatusIcon; @@ -503,8 +493,8 @@ export class CoreCourseHelperProvider { /** * Determine the status of a list of courses. * - * @param {any[]} courses Courses - * @return {Promise} Promise resolved with the status. + * @param courses Courses + * @return Promise resolved with the status. */ determineCoursesStatus(courses: any[]): Promise { // Get the status of each course. @@ -530,13 +520,13 @@ export class CoreCourseHelperProvider { * Convenience function to open a module main file, downloading the package if needed. * This is meant for modules like mod_resource. * - * @param {any} module The module to download. - * @param {number} courseId The course ID of the module. - * @param {string} [component] The component to link the files to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {any[]} [files] List of files of the module. If not provided, use module.contents. - * @param {string} [siteId] The site ID. If not defined, current site. - * @return {Promise} Resolved on success. + * @param module The module to download. + * @param courseId The course ID of the module. + * @param component The component to link the files to. + * @param componentId An ID to use in conjunction with the component. + * @param files List of files of the module. If not provided, use module.contents. + * @param siteId The site ID. If not defined, current site. + * @return Resolved on success. */ downloadModuleAndOpenFile(module: any, courseId: number, component?: string, componentId?: string | number, files?: any[], siteId?: string): Promise { @@ -633,13 +623,13 @@ export class CoreCourseHelperProvider { * Convenience function to download a module that has a main file and return the local file's path and other info. * This is meant for modules like mod_resource. * - * @param {any} module The module to download. - * @param {number} courseId The course ID of the module. - * @param {string} [component] The component to link the files to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {any[]} [files] List of files of the module. If not provided, use module.contents. - * @param {string} [siteId] The site ID. If not defined, current site. - * @return {Promise<{fixedUrl: string, path: string, status: string}>} Promise resolved when done. + * @param module The module to download. + * @param courseId The course ID of the module. + * @param component The component to link the files to. + * @param componentId An ID to use in conjunction with the component. + * @param files List of files of the module. If not provided, use module.contents. + * @param siteId The site ID. If not defined, current site. + * @return Promise resolved when done. */ downloadModuleWithMainFileIfNeeded(module: any, courseId: number, component?: string, componentId?: string | number, files?: any[], siteId?: string): Promise<{fixedUrl: string, path: string, status: string}> { @@ -729,13 +719,13 @@ export class CoreCourseHelperProvider { /** * Convenience function to download a module. * - * @param {any} module The module to download. - * @param {number} courseId The course ID of the module. - * @param {string} [component] The component to link the files to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {any[]} [files] List of files of the module. If not provided, use module.contents. - * @param {string} [siteId] The site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module The module to download. + * @param courseId The course ID of the module. + * @param component The component to link the files to. + * @param componentId An ID to use in conjunction with the component. + * @param files List of files of the module. If not provided, use module.contents. + * @param siteId The site ID. If not defined, current site. + * @return Promise resolved when done. */ downloadModule(module: any, courseId: number, component?: string, componentId?: string | number, files?: any[], siteId?: string) : Promise { @@ -760,12 +750,12 @@ export class CoreCourseHelperProvider { /** * Fill the Context Menu for a certain module. * - * @param {any} instance The component instance that has the context menu. - * @param {any} module Module to be prefetched - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [invalidateCache] Invalidates the cache first. - * @param {string} [component] Component of the module. - * @return {Promise} Promise resolved when done. + * @param instance The component instance that has the context menu. + * @param module Module to be prefetched + * @param courseId Course ID the module belongs to. + * @param invalidateCache Invalidates the cache first. + * @param component Component of the module. + * @return Promise resolved when done. */ fillContextMenu(instance: any, module: any, courseId: number, invalidateCache?: boolean, component?: string): Promise { return this.getModulePrefetchInfo(module, courseId, invalidateCache, component).then((moduleInfo) => { @@ -796,9 +786,9 @@ export class CoreCourseHelperProvider { /** * Get a course. It will first check the user courses, and fallback to another WS if not enrolled. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise<{enrolled: boolean, course: any}>} Promise resolved with the course. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the course. */ getCourse(courseId: number, siteId?: string): Promise<{enrolled: boolean, course: any}> { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -824,10 +814,10 @@ export class CoreCourseHelperProvider { * Get a course, wait for any course format plugin to load, and open the course page. It basically chains the functions * getCourse and openCourse. * - * @param {NavController} navCtrl The nav controller to use. If not defined, the course will be opened in main menu. - * @param {number} courseId Course ID. - * @param {any} [params] Other params to pass to the course page. - * @param {string} [siteId] Site ID. If not defined, current site. + * @param navCtrl The nav controller to use. If not defined, the course will be opened in main menu. + * @param courseId Course ID. + * @param params Other params to pass to the course page. + * @param siteId Site ID. If not defined, current site. */ getAndOpenCourse(navCtrl: NavController, courseId: number, params?: any, siteId?: string): Promise { const modal = this.domUtils.showModalLoading(); @@ -847,10 +837,10 @@ export class CoreCourseHelperProvider { /** * Check if the course has a block with that name. * - * @param {number} courseId Course ID. - * @param {string} name Block name to search. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if the block exists or false otherwise. + * @param courseId Course ID. + * @param name Block name to search. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if the block exists or false otherwise. * @since 3.3 */ hasABlockNamed(courseId: number, name: string, siteId?: string): Promise { @@ -866,10 +856,10 @@ export class CoreCourseHelperProvider { /** * Initialize the prefetch icon for selected courses. * - * @param {any[]} courses Courses array to get info from. - * @param {any} prefetch Prefetch information. - * @param {number} [minCourses=2] Min course to show icon. - * @return {Promise} Resolved with the prefetch information updated when done. + * @param courses Courses array to get info from. + * @param prefetch Prefetch information. + * @param minCourses Min course to show icon. + * @return Resolved with the prefetch information updated when done. */ initPrefetchCoursesIcons(courses: any[], prefetch: any, minCourses: number = 2): Promise { if (!courses || courses.length < minCourses) { @@ -895,10 +885,10 @@ export class CoreCourseHelperProvider { * Load offline completion into a list of sections. * This should be used in 3.6 sites or higher, where the course contents already include the completion. * - * @param {number} courseId The course to get the completion. - * @param {any[]} sections List of sections of the course. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param courseId The course to get the completion. + * @param sections List of sections of the course. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ loadOfflineCompletion(courseId: number, sections: any[], siteId?: string): Promise { return this.courseOffline.getCourseManualCompletions(courseId, siteId).then((offlineCompletions) => { @@ -944,9 +934,9 @@ export class CoreCourseHelperProvider { /** * Prefetch all the courses in the array. * - * @param {any[]} courses Courses array to prefetch. - * @param {any} prefetch Prefetch information to be updated. - * @return {Promise} Promise resolved when done. + * @param courses Courses array to prefetch. + * @param prefetch Prefetch information to be updated. + * @return Promise resolved when done. */ prefetchCourses(courses: any[], prefetch: any): Promise { prefetch.icon = 'spinner'; @@ -964,9 +954,9 @@ export class CoreCourseHelperProvider { /** * Get a course download promise (if any). * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Download promise, undefined if not found. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Download promise, undefined if not found. */ getCourseDownloadPromise(courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -977,9 +967,9 @@ export class CoreCourseHelperProvider { /** * Get a course status icon and the langkey to use as a title. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise<{icon: string, title: string}>} Promise resolved with the icon name and the title key. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the icon name and the title key. */ getCourseStatusIconAndTitle(courseId: number, siteId?: string): Promise<{icon: string, title: string}> { return this.courseProvider.getCourseStatus(courseId, siteId).then((status) => { @@ -990,8 +980,8 @@ export class CoreCourseHelperProvider { /** * Get a course status icon and the langkey to use as a title from status. * - * @param {string} status Course status. - * @return {{icon: string, title: string}} Title and icon name. + * @param status Course status. + * @return Title and icon name. */ getCourseStatusIconAndTitleFromStatus(status: string): {icon: string, title: string} { if (status == CoreConstants.DOWNLOADED) { @@ -1016,10 +1006,10 @@ export class CoreCourseHelperProvider { /** * Get the course ID from a module instance ID, showing an error message if it can't be retrieved. * - * @param {number} id Instance ID. - * @param {string} module Name of the module. E.g. 'glossary'. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the module's course ID. + * @param id Instance ID. + * @param module Name of the module. E.g. 'glossary'. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the module's course ID. */ getModuleCourseIdByInstance(id: number, module: any, siteId?: string): Promise { return this.courseProvider.getModuleBasicInfoByInstance(id, module, siteId).then((cm) => { @@ -1034,11 +1024,11 @@ export class CoreCourseHelperProvider { /** * Get prefetch info for a module. * - * @param {any} module Module to get the info from. - * @param {number} courseId Course ID the section belongs to. - * @param {boolean} [invalidateCache] Invalidates the cache first. - * @param {string} [component] Component of the module. - * @return {Promise} Promise resolved with the info. + * @param module Module to get the info from. + * @param courseId Course ID the section belongs to. + * @param invalidateCache Invalidates the cache first. + * @param component Component of the module. + * @return Promise resolved with the info. */ getModulePrefetchInfo(module: any, courseId: number, invalidateCache?: boolean, component?: string) : Promise { @@ -1102,8 +1092,8 @@ export class CoreCourseHelperProvider { /** * Get the download ID of a section. It's used to interact with CoreCourseModulePrefetchDelegate. * - * @param {any} section Section. - * @return {string} Section download ID. + * @param section Section. + * @return Section download ID. */ getSectionDownloadId(section: any): string { return 'Section-' + section.id; @@ -1112,16 +1102,16 @@ export class CoreCourseHelperProvider { /** * Navigate to a module. * - * @param {number} moduleId Module's ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [courseId] Course ID. If not defined we'll try to retrieve it from the site. - * @param {number} [sectionId] Section the module belongs to. If not defined we'll try to retrieve it from the site. - * @param {string} [modName] If set, the app will retrieve all modules of this type with a single WS call. This reduces the - * number of WS calls, but it isn't recommended for modules that can return a lot of contents. - * @param {any} [modParams] Params to pass to the module - * @param {NavController} [navCtrl] NavController for adding new pages to the current history. Optional for legacy support, but - * generates a warning if omitted. - * @return {Promise} Promise resolved when done. + * @param moduleId Module's ID. + * @param siteId Site ID. If not defined, current site. + * @param courseId Course ID. If not defined we'll try to retrieve it from the site. + * @param sectionId Section the module belongs to. If not defined we'll try to retrieve it from the site. + * @param modName If set, the app will retrieve all modules of this type with a single WS call. This reduces the + * number of WS calls, but it isn't recommended for modules that can return a lot of contents. + * @param modParams Params to pass to the module + * @param navCtrl NavController for adding new pages to the current history. Optional for legacy support, but + * generates a warning if omitted. + * @return Promise resolved when done. */ navigateToModule(moduleId: number, siteId?: string, courseId?: number, sectionId?: number, modName?: string, modParams?: any, navCtrl?: NavController) @@ -1201,12 +1191,12 @@ export class CoreCourseHelperProvider { /** * Open a module. * - * @param {NavController} navCtrl The NavController to use. - * @param {any} module The module to open. - * @param {number} courseId The course ID of the module. - * @param {number} [sectionId] The section ID of the module. - * @param {any} [modParams] Params to pass to the module - * @param {boolean} True if module can be opened, false otherwise. + * @param navCtrl The NavController to use. + * @param module The module to open. + * @param courseId The course ID of the module. + * @param sectionId The section ID of the module. + * @param modParams Params to pass to the module + * @param True if module can be opened, false otherwise. */ openModule(navCtrl: NavController, module: any, courseId: number, sectionId?: number, modParams?: any): boolean { if (!module.handlerData) { @@ -1225,12 +1215,12 @@ export class CoreCourseHelperProvider { /** * Prefetch all the activities in a course and also the course addons. * - * @param {any} course The course to prefetch. - * @param {any[]} sections List of course sections. - * @param {CoreCourseOptionsHandlerToDisplay[]} courseHandlers List of course options handlers. - * @param {CoreCourseOptionsMenuHandlerToDisplay[]} courseMenuHandlers List of course menu handlers. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the download finishes. + * @param course The course to prefetch. + * @param sections List of course sections. + * @param courseHandlers List of course options handlers. + * @param courseMenuHandlers List of course menu handlers. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the download finishes. */ prefetchCourse(course: any, sections: any[], courseHandlers: CoreCourseOptionsHandlerToDisplay[], courseMenuHandlers: CoreCourseOptionsMenuHandlerToDisplay[], siteId?: string): Promise { @@ -1300,12 +1290,12 @@ export class CoreCourseHelperProvider { * Helper function to prefetch a module, showing a confirmation modal if the size is big * and invalidating contents if refreshing. * - * @param {handler} handler Prefetch handler to use. Must implement 'prefetch' and 'invalidateContent'. - * @param {any} module Module to download. - * @param {any} size Object containing size to download (in bytes) and a boolean to indicate if its totally calculated. - * @param {number} courseId Course ID of the module. - * @param {boolean} [refresh] True if refreshing, false otherwise. - * @return {Promise} Promise resolved when downloaded. + * @param handler Prefetch handler to use. Must implement 'prefetch' and 'invalidateContent'. + * @param module Module to download. + * @param size Object containing size to download (in bytes) and a boolean to indicate if its totally calculated. + * @param courseId Course ID of the module. + * @param refresh True if refreshing, false otherwise. + * @return Promise resolved when downloaded. */ prefetchModule(handler: any, module: any, size: any, courseId: number, refresh?: boolean): Promise { // Show confirmation if needed. @@ -1325,10 +1315,10 @@ export class CoreCourseHelperProvider { * Prefetch one section or all the sections. * If the section is "All sections" it will prefetch all the sections. * - * @param {any} section Section. - * @param {number} courseId Course ID the section belongs to. - * @param {any[]} [sections] List of sections. Used when downloading all the sections. - * @return {Promise} Promise resolved when the prefetch is finished. + * @param section Section. + * @param courseId Course ID the section belongs to. + * @param sections List of sections. Used when downloading all the sections. + * @return Promise resolved when the prefetch is finished. */ prefetchSection(section: any, courseId: number, sections?: any[]): Promise { if (section.id != CoreCourseProvider.ALL_SECTIONS_ID) { @@ -1370,9 +1360,9 @@ export class CoreCourseHelperProvider { * Prefetch a certain section if it needs to be prefetched. * If the section is "All sections" it will be ignored. * - * @param {any} section Section to prefetch. - * @param {number} courseId Course ID the section belongs to. - * @return {Promise} Promise resolved when the section is prefetched. + * @param section Section to prefetch. + * @param courseId Course ID the section belongs to. + * @return Promise resolved when the section is prefetched. */ protected prefetchSingleSectionIfNeeded(section: any, courseId: number): Promise { if (section.id == CoreCourseProvider.ALL_SECTIONS_ID) { @@ -1422,10 +1412,10 @@ export class CoreCourseHelperProvider { * Start or restore the prefetch of a section. * If the section is "All sections" it will be ignored. * - * @param {any} section Section to download. - * @param {any} result Result of CoreCourseModulePrefetchDelegate.getModulesStatus for this section. - * @param {number} courseId Course ID the section belongs to. - * @return {Promise} Promise resolved when the section has been prefetched. + * @param section Section to download. + * @param result Result of CoreCourseModulePrefetchDelegate.getModulesStatus for this section. + * @param courseId Course ID the section belongs to. + * @return Promise resolved when the section has been prefetched. */ protected prefetchSingleSection(section: any, result: any, courseId: number): Promise { if (section.id == CoreCourseProvider.ALL_SECTIONS_ID) { @@ -1454,8 +1444,8 @@ export class CoreCourseHelperProvider { /** * Check if a section has content. * - * @param {any} section Section to check. - * @return {boolean} Whether the section has content. + * @param section Section to check. + * @return Whether the section has content. */ sectionHasContent(section: any): boolean { if (section.hiddenbynumsections) { @@ -1474,11 +1464,11 @@ export class CoreCourseHelperProvider { * will be displayed until it is complete, before the course page is opened. If the promise is already complete, * they will see the result immediately. * - * @param {NavController} navCtrl The nav controller to use. If not defined, the course will be opened in main menu. - * @param {any} course Course to open - * @param {any} [params] Params to pass to the course page. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param navCtrl The nav controller to use. If not defined, the course will be opened in main menu. + * @param course Course to open + * @param params Params to pass to the course page. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ openCourse(navCtrl: NavController, course: any, params?: any, siteId?: string): Promise { if (!siteId || siteId == this.sitesProvider.getCurrentSiteId()) { diff --git a/src/core/course/providers/log-cron-handler.ts b/src/core/course/providers/log-cron-handler.ts index e708cf056..deb0a7474 100644 --- a/src/core/course/providers/log-cron-handler.ts +++ b/src/core/course/providers/log-cron-handler.ts @@ -30,9 +30,9 @@ export class CoreCourseLogCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -43,7 +43,7 @@ export class CoreCourseLogCronHandler implements CoreCronHandler { /** * Check whether it's a synchronization process or not. * - * @return {boolean} Whether it's a synchronization process or not. + * @return Whether it's a synchronization process or not. */ isSync(): boolean { return false; @@ -52,7 +52,7 @@ export class CoreCourseLogCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return 240000; // 4 minutes. By default platform will see the user as online if lastaccess is less than 5 minutes. diff --git a/src/core/course/providers/log-helper.ts b/src/core/course/providers/log-helper.ts index 36ccf4ab8..8e69c34c3 100644 --- a/src/core/course/providers/log-helper.ts +++ b/src/core/course/providers/log-helper.ts @@ -70,10 +70,10 @@ export class CoreCourseLogHelperProvider { /** * Delete the offline saved activity logs. * - * @param {string} component Component name. - * @param {number} componentId Component ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when deleted, rejected if failure. + * @param component Component name. + * @param componentId Component ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when deleted, rejected if failure. */ protected deleteLogs(component: string, componentId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -86,11 +86,11 @@ export class CoreCourseLogHelperProvider { /** * Delete a WS based log. * - * @param {string} component Component name. - * @param {number} componentId Component ID. - * @param {string} ws WS name. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when deleted, rejected if failure. + * @param component Component name. + * @param componentId Component ID. + * @param ws WS name. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when deleted, rejected if failure. */ protected deleteWSLogsByComponent(component: string, componentId: number, ws: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -103,10 +103,10 @@ export class CoreCourseLogHelperProvider { /** * Delete the offline saved activity logs using call data. * - * @param {string} ws WS name. - * @param {any} data Data to send to the WS. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when deleted, rejected if failure. + * @param ws WS name. + * @param data Data to send to the WS. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when deleted, rejected if failure. */ protected deleteWSLogs(ws: string, data: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -119,8 +119,8 @@ export class CoreCourseLogHelperProvider { /** * Get all the offline saved activity logs. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the list of offline logs. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of offline logs. */ protected getAllLogs(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -132,10 +132,10 @@ export class CoreCourseLogHelperProvider { /** * Get the offline saved activity logs. * - * @param {string} component Component name. - * @param {number} componentId Component ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the list of offline logs. + * @param component Component name. + * @param componentId Component ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of offline logs. */ protected getLogs(component: string, componentId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -148,12 +148,12 @@ export class CoreCourseLogHelperProvider { /** * Perform log online. Data will be saved offline for syncing. * - * @param {string} ws WS name. - * @param {any} data Data to send to the WS. - * @param {string} component Component name. - * @param {number} componentId Component ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param ws WS name. + * @param data Data to send to the WS. + * @param component Component name. + * @param componentId Component ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ log(ws: string, data: any, component: string, componentId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -177,11 +177,11 @@ export class CoreCourseLogHelperProvider { /** * Perform the log online. * - * @param {string} ws WS name. - * @param {any} data Data to send to the WS. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when log is successfully submitted. Rejected with object containing - * the error message (if any) and a boolean indicating if the error was returned by WS. + * @param ws WS name. + * @param data Data to send to the WS. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when log is successfully submitted. Rejected with object containing + * the error message (if any) and a boolean indicating if the error was returned by WS. */ protected logOnline(ws: string, data: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -201,15 +201,15 @@ export class CoreCourseLogHelperProvider { * Perform log online. Data will be saved offline for syncing. * It also triggers a Firebase view_item event. * - * @param {string} ws WS name. - * @param {any} data Data to send to the WS. - * @param {string} component Component name. - * @param {number} componentId Component ID. - * @param {string} [name] Name of the viewed item. - * @param {string} [category] Category of the viewed item. - * @param {string} [eventData] Data to pass to the Firebase event. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param ws WS name. + * @param data Data to send to the WS. + * @param component Component name. + * @param componentId Component ID. + * @param name Name of the viewed item. + * @param category Category of the viewed item. + * @param eventData Data to pass to the Firebase event. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ logSingle(ws: string, data: any, component: string, componentId: number, name?: string, category?: string, eventData?: any, siteId?: string): Promise { @@ -222,14 +222,14 @@ export class CoreCourseLogHelperProvider { * Perform log online. Data will be saved offline for syncing. * It also triggers a Firebase view_item_list event. * - * @param {string} ws WS name. - * @param {any} data Data to send to the WS. - * @param {string} component Component name. - * @param {number} componentId Component ID. - * @param {string} category Category of the viewed item. - * @param {string} [eventData] Data to pass to the Firebase event. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param ws WS name. + * @param data Data to send to the WS. + * @param component Component name. + * @param componentId Component ID. + * @param category Category of the viewed item. + * @param eventData Data to pass to the Firebase event. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ logList(ws: string, data: any, component: string, componentId: number, category: string, eventData?: any, siteId?: string) : Promise { @@ -241,12 +241,12 @@ export class CoreCourseLogHelperProvider { /** * Save activity log for offline sync. * - * @param {string} ws WS name. - * @param {any} data Data to send to the WS. - * @param {string} component Component name. - * @param {number} componentId Component ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolved with the inserted rowId field. + * @param ws WS name. + * @param data Data to send to the WS. + * @param component Component name. + * @param componentId Component ID. + * @param siteId Site ID. If not defined, current site. + * @return Resolved with the inserted rowId field. */ protected storeOffline(ws: string, data: any, component: string, componentId: number, siteId?: string): Promise { @@ -266,8 +266,8 @@ export class CoreCourseLogHelperProvider { /** * Sync all the offline saved activity logs. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ syncSite(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -297,10 +297,10 @@ export class CoreCourseLogHelperProvider { /** * Sync the offline saved activity logs. * - * @param {string} component Component name. - * @param {number} componentId Component ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param component Component name. + * @param componentId Component ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ syncIfNeeded(component: string, componentId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -329,9 +329,9 @@ export class CoreCourseLogHelperProvider { /** * Sync and delete given logs. * - * @param {any[]} logs Array of log objects. - * @param {string} siteId Site Id. - * @return {Promise} Promise resolved when done. + * @param logs Array of log objects. + * @param siteId Site Id. + * @return Promise resolved when done. */ protected syncLogs(logs: any[], siteId: string): Promise { return Promise.all(logs.map((log) => { diff --git a/src/core/course/providers/module-delegate.ts b/src/core/course/providers/module-delegate.ts index 4a3824784..eacadec21 100644 --- a/src/core/course/providers/module-delegate.ts +++ b/src/core/course/providers/module-delegate.ts @@ -29,7 +29,6 @@ import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate'; export interface CoreCourseModuleHandler extends CoreDelegateHandler { /** * Name of the module. It should match the "modname" of the module returned in core_course_get_contents. - * @type {string} */ modName: string; @@ -37,17 +36,16 @@ export interface CoreCourseModuleHandler extends CoreDelegateHandler { * List of supported features. The keys should be the name of the feature. * This is to replicate the "plugin_supports" function of Moodle. * If you need some dynamic checks please implement the supportsFeature function. - * @type {{[name: string]: any}} */ supportedFeatures?: {[name: string]: any}; /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData; @@ -56,10 +54,10 @@ export interface CoreCourseModuleHandler extends CoreDelegateHandler { * The component returned must implement CoreCourseModuleMainComponent. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param course The course object. + * @param module The module object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getMainComponent(injector: Injector, course: any, module: any): any | Promise; @@ -67,14 +65,14 @@ export interface CoreCourseModuleHandler extends CoreDelegateHandler { * Whether to display the course refresher in single activity course format. If it returns false, a refresher must be * included in the template that calls the doRefresh method of the component. Defaults to true. * - * @return {boolean} Whether the refresher should be displayed. + * @return Whether the refresher should be displayed. */ displayRefresherInSingleActivity?(): boolean; /** * Get the icon src for the module. * - * @return {string} The icon src. + * @return The icon src. */ getIconSrc?(): string; @@ -82,8 +80,8 @@ export interface CoreCourseModuleHandler extends CoreDelegateHandler { * Check if this type of module supports a certain feature. * If this function is implemented, the supportedFeatures object will be ignored. * - * @param {string} feature The feature to check. - * @return {any} The result of the supports check. + * @param feature The feature to check. + * @return The result of the supports check. */ supportsFeature?(feature: string): any; } @@ -94,37 +92,31 @@ export interface CoreCourseModuleHandler extends CoreDelegateHandler { export interface CoreCourseModuleHandlerData { /** * The title to display in the module. - * @type {string} */ title: string; /** * The accessibility title to use in the module. If not provided, title will be used. - * @type {string} */ a11yTitle?: string; /** * The image to use as icon (path to the image). - * @type {string} */ icon?: string | SafeUrl; /** * The class to assign to the item. - * @type {string} */ class?: string; /** * The text to show in an extra badge. - * @type {string} */ extraBadge?: string; /** * The color of the extra badge. Default: primary. - * @type {string} */ extraBadgeColor?: string; @@ -132,38 +124,35 @@ export interface CoreCourseModuleHandlerData { * Whether to display a button to download/refresh the module if it's downloadable. * If it's set to true, the app will show a download/refresh button when needed and will handle the download of the * module using CoreCourseModulePrefetchDelegate. - * @type {boolean} */ showDownloadButton?: boolean; /** * The buttons to display in the module item. - * @type {CoreCourseModuleHandlerButton[]} */ buttons?: CoreCourseModuleHandlerButton[]; /** * Whether to display a spinner in the module item. - * @type {boolean} */ spinner?: boolean; /** * Action to perform when the module is clicked. * - * @param {Event} event The click event. - * @param {NavController} navCtrl NavController instance. - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {NavOptions} [options] Options for the navigation. - * @param {any} [params] Params for the new page. + * @param event The click event. + * @param navCtrl NavController instance. + * @param module The module object. + * @param courseId The course ID. + * @param options Options for the navigation. + * @param params Params for the new page. */ action?(event: Event, navCtrl: NavController, module: any, courseId: number, options?: NavOptions, params?: any): void; /** * Updates the status of the module. * - * @param {string} status Module status. + * @param status Module status. */ updateStatus?(status: string): void; @@ -180,9 +169,9 @@ export interface CoreCourseModuleMainComponent { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @param {Function} [done] Function to call when done. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @param done Function to call when done. + * @return Promise resolved when done. */ doRefresh(refresher?: any, done?: () => void): Promise; } @@ -193,41 +182,36 @@ export interface CoreCourseModuleMainComponent { export interface CoreCourseModuleHandlerButton { /** * The label to add to the button. - * @type {string} */ label: string; /** * The name of the button icon. - * @type {string} */ icon: string; /** * Whether the button should be hidden. - * @type {boolean} */ hidden?: boolean; /** * The name of the button icon to use in iOS instead of "icon". - * @type {string} */ iosIcon?: string; /** * The name of the button icon to use in MaterialDesign instead of "icon". - * @type {string} */ mdIcon?: string; /** * Action to perform when the button is clicked. * - * @param {Event} event The click event. - * @param {NavController} navCtrl NavController instance. - * @param {any} module The module object. - * @param {number} courseId The course ID. + * @param event The click event. + * @param navCtrl NavController instance. + * @param module The module object. + * @param courseId The course ID. */ action(event: Event, navCtrl: NavController, module: any, courseId: number): void; } @@ -248,10 +232,10 @@ export class CoreCourseModuleDelegate extends CoreDelegate { /** * Get the component to render the module. * - * @param {Injector} injector Injector. - * @param {any} course The course object. - * @param {any} module The module object. - * @return {Promise} Promise resolved with component to use, undefined if not found. + * @param injector Injector. + * @param course The course object. + * @param module The module object. + * @return Promise resolved with component to use, undefined if not found. */ getMainComponent(injector: Injector, course: any, module: any): Promise { return Promise.resolve(this.executeFunctionOnEnabled(module.modname, 'getMainComponent', [injector, course, module])) @@ -263,11 +247,11 @@ export class CoreCourseModuleDelegate extends CoreDelegate { /** * Get the data required to display the module in the course contents view. * - * @param {string} modname The name of the module type. - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param modname The name of the module type. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getModuleDataFor(modname: string, module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { return this.executeFunctionOnEnabled(modname, 'getData', [module, courseId, sectionId]); @@ -276,9 +260,9 @@ export class CoreCourseModuleDelegate extends CoreDelegate { /** * Check if a certain module type is disabled in a site. * - * @param {string} modname The name of the module type. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether module is disabled. + * @param modname The name of the module type. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether module is disabled. */ isModuleDisabled(modname: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -289,9 +273,9 @@ export class CoreCourseModuleDelegate extends CoreDelegate { /** * Check if a certain module type is disabled in a site. * - * @param {string} modname The name of the module type. - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether module is disabled. + * @param modname The name of the module type. + * @param site Site. If not defined, use current site. + * @return Whether module is disabled. */ isModuleDisabledInSite(modname: string, site?: CoreSite): boolean { const handler = this.getHandler(modname, true); @@ -309,8 +293,8 @@ export class CoreCourseModuleDelegate extends CoreDelegate { * Whether to display the course refresher in single activity course format. If it returns false, a refresher must be * included in the template that calls the doRefresh method of the component. Defaults to true. * - * @param {any} modname The name of the module type. - * @return {boolean} Whether the refresher should be displayed. + * @param modname The name of the module type. + * @return Whether the refresher should be displayed. */ displayRefresherInSingleActivity(modname: string): boolean { return this.executeFunctionOnEnabled(modname, 'displayRefresherInSingleActivity'); @@ -319,9 +303,9 @@ export class CoreCourseModuleDelegate extends CoreDelegate { /** * Get the icon src for a certain type of module. * - * @param {any} modname The name of the module type. - * @param {string} [modicon] The mod icon string. - * @return {string} The icon src. + * @param modname The name of the module type. + * @param modicon The mod icon string. + * @return The icon src. */ getModuleIconSrc(modname: string, modicon?: string): string { return this.executeFunctionOnEnabled(modname, 'getIconSrc') || this.courseProvider.getModuleIconSrc(modname, modicon); @@ -330,10 +314,10 @@ export class CoreCourseModuleDelegate extends CoreDelegate { /** * Check if a certain type of module supports a certain feature. * - * @param {string} modname The modname. - * @param {string} feature The feature to check. - * @param {any} defaultValue Value to return if the module is not supported or doesn't know if it's supported. - * @return {any} The result of the supports check. + * @param modname The modname. + * @param feature The feature to check. + * @param defaultValue Value to return if the module is not supported or doesn't know if it's supported. + * @return The result of the supports check. */ supportsFeature(modname: string, feature: string, defaultValue: any): any { const handler = this.enabledHandlers[modname]; diff --git a/src/core/course/providers/module-prefetch-delegate.ts b/src/core/course/providers/module-prefetch-delegate.ts index 267027d84..65278fe82 100644 --- a/src/core/course/providers/module-prefetch-delegate.ts +++ b/src/core/course/providers/module-prefetch-delegate.ts @@ -34,13 +34,11 @@ import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate'; export type CoreCourseModulesProgress = { /** * Number of modules downloaded so far. - * @type {number} */ count: number; /** * Toal of modules to download. - * @type {number} */ total: number; }; @@ -48,7 +46,7 @@ export type CoreCourseModulesProgress = { /** * Progress function for downloading a list of modules. * - * @param {CoreCourseModulesProgress} data Progress data. + * @param data Progress data. */ export type CoreCourseModulesProgressFunction = (data: CoreCourseModulesProgress) => void; @@ -58,65 +56,60 @@ export type CoreCourseModulesProgressFunction = (data: CoreCourseModulesProgress export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { /** * Name of the handler. - * @type {string} */ name: string; /** * Name of the module. It should match the "modname" of the module returned in core_course_get_contents. - * @type {string} */ modName: string; /** * The handler's component. - * @type {string} */ component: string; /** * The RegExp to check updates. If a module has an update whose name matches this RegExp, the module will be marked * as outdated. This RegExp is ignored if hasUpdates function is defined. - * @type {RegExp} */ updatesNames?: RegExp; /** * If true, this module will be treated as not downloadable when determining the status of a list of modules. The module will * still be downloaded when downloading the section/course, it only affects whether the button should be displayed. - * @type {boolean} */ skipListStatus: boolean; /** * Get the download size of a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise<{size: number, total: boolean}>} Promise resolved with the size and a boolean indicating if it was able - * to calculate the total size. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved with the size and a boolean indicating if it was able + * to calculate the total size. */ getDownloadSize(module: any, courseId: number, single?: boolean): Promise<{ size: number, total: boolean }>; /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string): Promise; /** * Download the module. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when all content is downloaded. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when all content is downloaded. */ download?(module: any, courseId: number, dirPath?: string): Promise; @@ -125,9 +118,9 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { * If not defined, it will assume all modules can be checked. * The modules that return false will always be shown as outdated when they're downloaded. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {boolean|Promise} Whether the module can use check_updates. The promise should never be rejected. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Whether the module can use check_updates. The promise should never be rejected. */ canUseCheckUpdates?(module: any, courseId: number): boolean | Promise; @@ -135,38 +128,38 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { * Return the status to show based on current status. E.g. a module might want to show outdated instead of downloaded. * If not implemented, the original status will be returned. * - * @param {any} module Module. - * @param {string} status The current status. - * @param {boolean} canCheck Whether the site allows checking for updates. - * @return {string} Status to display. + * @param module Module. + * @param status The current status. + * @param canCheck Whether the site allows checking for updates. + * @return Status to display. */ determineStatus?(module: any, status: string, canCheck: boolean): string; /** * Get the downloaded size of a module. If not defined, we'll use getFiles to calculate it (it can be slow). * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {number|Promise} Size, or promise resolved with the size. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Size, or promise resolved with the size. */ getDownloadedSize?(module: any, courseId: number): number | Promise; /** * Get the list of files of the module. If not defined, we'll assume they are in module.contents. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {any[]|Promise} List of files, or promise resolved with the files. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return List of files, or promise resolved with the files. */ getFiles?(module: any, courseId: number): any[] | Promise; /** * Check if a certain module has updates based on the result of check updates. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {any[]} moduleUpdates List of updates for the module. - * @return {boolean|Promise} Whether the module has updates. The promise should never be rejected. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param moduleUpdates List of updates for the module. + * @return Whether the module has updates. The promise should never be rejected. */ hasUpdates?(module: any, courseId: number, moduleUpdates: any[]): boolean | Promise; @@ -174,46 +167,46 @@ export interface CoreCourseModulePrefetchHandler extends CoreDelegateHandler { * Invalidate WS calls needed to determine module status (usually, to check if module is downloadable). * It doesn't need to invalidate check updates. It should NOT invalidate files nor all the prefetched data. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when invalidated. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when invalidated. */ invalidateModule?(module: any, courseId: number): Promise; /** * Check if a module can be downloaded. If the function is not defined, we assume that all modules are downloadable. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {boolean|Promise} Whether the module can be downloaded. The promise should never be rejected. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Whether the module can be downloaded. The promise should never be rejected. */ isDownloadable?(module: any, courseId: number): boolean | Promise; /** * Load module contents in module.contents if they aren't loaded already. This is meant for resources. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when done. */ loadContents?(module: any, courseId: number): Promise; /** * Remove module downloaded files. If not defined, we'll use getFiles to remove them (slow). * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when done. */ removeFiles?(module: any, courseId: number): Promise; /** * Sync a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ sync?(module: any, courseId: number, siteId?: any): Promise; } @@ -282,7 +275,7 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Check if current site can check updates using core_course_check_updates. * - * @return {boolean} True if can check updates, false otherwise. + * @return True if can check updates, false otherwise. */ canCheckUpdates(): boolean { return this.sitesProvider.wsAvailableInCurrentSite('core_course_check_updates'); @@ -291,9 +284,9 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Check if a certain module can use core_course_check_updates. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved with boolean: whether the module can use check updates WS. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved with boolean: whether the module can use check updates WS. */ canModuleUseCheckUpdates(module: any, courseId: number): Promise { const handler = this.getPrefetchHandlerFor(module); @@ -321,9 +314,9 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Creates the list of modules to check for get course updates. * - * @param {any[]} modules List of modules. - * @param {number} courseId Course ID the modules belong to. - * @return {Promise<{toCheck: any[], cannotUse: any[]}>} Promise resolved with the lists. + * @param modules List of modules. + * @param courseId Course ID the modules belong to. + * @return Promise resolved with the lists. */ protected createToCheckList(modules: any[], courseId: number): Promise<{ toCheck: any[], cannotUse: any[] }> { const result = { @@ -368,10 +361,10 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Determines a module status based on current status, restoring downloads if needed. * - * @param {any} module Module. - * @param {string} status Current status. - * @param {boolean} [canCheck] True if updates can be checked using core_course_check_updates. - * @return {string} Module status. + * @param module Module. + * @param status Current status. + * @param canCheck True if updates can be checked using core_course_check_updates. + * @return Module status. */ determineModuleStatus(module: any, status: string, canCheck?: boolean): string { const handler = this.getPrefetchHandlerFor(module), @@ -399,10 +392,10 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Check for updates in a course. * - * @param {any[]} modules List of modules. - * @param {number} courseId Course ID the modules belong to. - * @return {Promise} Promise resolved with the updates. If a module is set to false, it means updates cannot be - * checked for that module in the current site. + * @param modules List of modules. + * @param courseId Course ID the modules belong to. + * @return Promise resolved with the updates. If a module is set to false, it means updates cannot be + * checked for that module in the current site. */ getCourseUpdates(modules: any[], courseId: number): Promise { if (!this.canCheckUpdates()) { @@ -491,8 +484,8 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Check for updates in a course. * - * @param {number} courseId Course ID the modules belong to. - * @return {Promise} Promise resolved with the updates. + * @param courseId Course ID the modules belong to. + * @return Promise resolved with the updates. */ getCourseUpdatesByCourseId(courseId: number): Promise { if (!this.canCheckUpdates()) { @@ -508,8 +501,8 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Get cache key for course updates WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getCourseUpdatesCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'courseUpdates:' + courseId; @@ -518,10 +511,10 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Get modules download size. Only treat the modules with status not downloaded or outdated. * - * @param {any[]} modules List of modules. - * @param {number} courseId Course ID the modules belong to. - * @return {Promise<{size: number, total: boolean}>} Promise resolved with the size and a boolean indicating if it was able - * to calculate the total size. + * @param modules List of modules. + * @param courseId Course ID the modules belong to. + * @return Promise resolved with the size and a boolean indicating if it was able + * to calculate the total size. */ getDownloadSize(modules: any[], courseId: number): Promise<{ size: number, total: boolean }> { // Get the status of each module. @@ -549,11 +542,11 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Get the download size of a module. * - * @param {any} module Module to get size. - * @param {Number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise<{size: number, total: boolean}>} Promise resolved with the size and a boolean indicating if it was able - * to calculate the total size. + * @param module Module to get size. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved with the size and a boolean indicating if it was able + * to calculate the total size. */ getModuleDownloadSize(module: any, courseId: number, single?: boolean): Promise<{ size: number, total: boolean }> { const handler = this.getPrefetchHandlerFor(module); @@ -592,9 +585,9 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Get the download size of a module. * - * @param {any} module Module to get size. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved with the size. + * @param module Module to get size. + * @param courseId Course ID the module belongs to. + * @return Promise resolved with the size. */ getModuleDownloadedSize(module: any, courseId: number): Promise { const handler = this.getPrefetchHandlerFor(module); @@ -664,9 +657,9 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Get module files. * - * @param {any} module Module to get the files. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved with the list of files. + * @param module Module to get the files. + * @param courseId Course ID the module belongs to. + * @return Promise resolved with the list of files. */ getModuleFiles(module: any, courseId: number): Promise { const handler = this.getPrefetchHandlerFor(module); @@ -687,13 +680,13 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Get the module status. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {any} [updates] Result of getCourseUpdates for all modules in the course. If not provided, it will be - * calculated (slower). If it's false it means the site doesn't support check updates. - * @param {boolean} [refresh] True if it should ignore the cache. - * @param {number} [sectionId] ID of the section the module belongs to. - * @return {Promise} Promise resolved with the status. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param updates Result of getCourseUpdates for all modules in the course. If not provided, it will be + * calculated (slower). If it's false it means the site doesn't support check updates. + * @param refresh True if it should ignore the cache. + * @param sectionId ID of the section the module belongs to. + * @return Promise resolved with the status. */ getModuleStatus(module: any, courseId: number, updates?: any, refresh?: boolean, sectionId?: number): Promise { const handler = this.getPrefetchHandlerFor(module), @@ -790,19 +783,19 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { * Get the status of a list of modules, along with the lists of modules for each status. * @see {@link CoreFilepoolProvider.determinePackagesStatus} * - * @param {any[]} modules List of modules to prefetch. - * @param {number} courseId Course ID the modules belong to. - * @param {number} [sectionId] ID of the section the modules belong to. - * @param {boolean} [refresh] True if it should always check the DB (slower). - * @param {boolean} [onlyToDisplay] True if the status will only be used to determine which button should be displayed. - * @param {boolean} [checkUpdates=true] Whether to use the WS to check updates. Defaults to true. - * @return {Promise} Promise resolved with an object with the following properties: - * - status (string) Status of the module. - * - total (number) Number of modules. - * - CoreConstants.NOT_DOWNLOADED (any[]) Modules with state NOT_DOWNLOADED. - * - CoreConstants.DOWNLOADED (any[]) Modules with state DOWNLOADED. - * - CoreConstants.DOWNLOADING (any[]) Modules with state DOWNLOADING. - * - CoreConstants.OUTDATED (any[]) Modules with state OUTDATED. + * @param modules List of modules to prefetch. + * @param courseId Course ID the modules belong to. + * @param sectionId ID of the section the modules belong to. + * @param refresh True if it should always check the DB (slower). + * @param onlyToDisplay True if the status will only be used to determine which button should be displayed. + * @param checkUpdates Whether to use the WS to check updates. Defaults to true. + * @return Promise resolved with an object with the following properties: + * - status (string) Status of the module. + * - total (number) Number of modules. + * - CoreConstants.NOT_DOWNLOADED (any[]) Modules with state NOT_DOWNLOADED. + * - CoreConstants.DOWNLOADED (any[]) Modules with state DOWNLOADED. + * - CoreConstants.DOWNLOADING (any[]) Modules with state DOWNLOADING. + * - CoreConstants.OUTDATED (any[]) Modules with state OUTDATED. */ getModulesStatus(modules: any[], courseId: number, sectionId?: number, refresh?: boolean, onlyToDisplay?: boolean, checkUpdates: boolean = true): any { @@ -875,9 +868,9 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Get a module status and download time. It will only return the download time if the module is downloaded or outdated. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise<{status: string, downloadTime?: number}>} Promise resolved with the data. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved with the data. */ protected getModuleStatusAndDownloadTime(module: any, courseId: number): Promise<{ status: string, downloadTime?: number }> { const handler = this.getPrefetchHandlerFor(module), @@ -923,11 +916,11 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { * Get updates for a certain module. * It will only return the updates if the module can use check updates and it's downloaded or outdated. * - * @param {any} module Module to check. - * @param {number} courseId Course the module belongs to. - * @param {boolean} [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. - * @return {Promise} Promise resolved with the updates. + * @param module Module to check. + * @param courseId Course the module belongs to. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the updates. */ getModuleUpdates(module: any, courseId: number, ignoreCache?: boolean, siteId?: string): Promise { @@ -980,9 +973,9 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Get cache key for module updates WS calls. * - * @param {number} courseId Course ID. - * @param {number} moduleId Module ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @param moduleId Module ID. + * @return Cache key. */ protected getModuleUpdatesCacheKey(courseId: number, moduleId: number): string { return this.getCourseUpdatesCacheKey(courseId) + ':' + moduleId; @@ -991,8 +984,8 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Get a prefetch handler. * - * @param {any} module The module to work on. - * @return {CoreCourseModulePrefetchHandler} Prefetch handler. + * @param module The module to work on. + * @return Prefetch handler. */ getPrefetchHandlerFor(module: any): CoreCourseModulePrefetchHandler { return this.getHandler(module.modname, true); @@ -1001,8 +994,8 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Invalidate check updates WS call. * - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved when data is invalidated. + * @param courseId Course ID. + * @return Promise resolved when data is invalidated. */ invalidateCourseUpdates(courseId: number): Promise { return this.sitesProvider.getCurrentSite().invalidateWsCacheForKey(this.getCourseUpdatesCacheKey(courseId)); @@ -1011,9 +1004,9 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Invalidate a list of modules in a course. This should only invalidate WS calls, not downloaded files. * - * @param {any[]} modules List of modules. - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved when modules are invalidated. + * @param modules List of modules. + * @param courseId Course ID. + * @return Promise resolved when modules are invalidated. */ invalidateModules(modules: any[], courseId: number): Promise { const promises = []; @@ -1040,7 +1033,7 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Invalidates the cache for a given module. * - * @param {any} module Module to be invalidated. + * @param module Module to be invalidated. */ invalidateModuleStatusCache(module: any): void { const handler = this.getPrefetchHandlerFor(module); @@ -1052,10 +1045,10 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Invalidate check updates WS call for a certain module. * - * @param {number} courseId Course ID. - * @param {number} moduleId Module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when data is invalidated. + * @param courseId Course ID. + * @param moduleId Module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when data is invalidated. */ invalidateModuleUpdates(courseId: number, moduleId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1066,8 +1059,8 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Check if a list of modules is being downloaded. * - * @param {string} id An ID to identify the download. - * @return {boolean} True if it's being downloaded, false otherwise. + * @param id An ID to identify the download. + * @return True if it's being downloaded, false otherwise. */ isBeingDownloaded(id: string): boolean { const siteId = this.sitesProvider.getCurrentSiteId(); @@ -1078,9 +1071,9 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Check if a module is downloadable. * - * @param {any} module Module. - * @param {Number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved with true if downloadable, false otherwise. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @return Promise resolved with true if downloadable, false otherwise. */ isModuleDownloadable(module: any, courseId: number): Promise { if (module.uservisible === false) { @@ -1118,10 +1111,10 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Check if a module has updates based on the result of getCourseUpdates. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {any} updates Result of getCourseUpdates. - * @return {Promise} Promise resolved with boolean: whether the module has updates. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param updates Result of getCourseUpdates. + * @return Promise resolved with boolean: whether the module has updates. */ moduleHasUpdates(module: any, courseId: number, updates: any): Promise { const handler = this.getPrefetchHandlerFor(module), @@ -1151,10 +1144,10 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Prefetch a module. * - * @param {any} module Module to prefetch. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise} Promise resolved when finished. + * @param module Module to prefetch. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved when finished. */ prefetchModule(module: any, courseId: number, single?: boolean): Promise { const handler = this.getPrefetchHandlerFor(module); @@ -1172,9 +1165,9 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Sync a group of modules. * - * @param {any[]} modules Array of modules to sync. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when finished. + * @param modules Array of modules to sync. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when finished. */ syncModules(modules: any[], courseId: number): Promise { return Promise.all(modules.map((module) => { @@ -1190,9 +1183,9 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Sync a module. * - * @param {any} module Module to sync. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when finished. + * @param module Module to sync. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when finished. */ syncModule(module: any, courseId: number): Promise { const handler = this.getPrefetchHandlerFor(module); @@ -1215,11 +1208,11 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { * Prefetches a list of modules using their prefetch handlers. * If a prefetch already exists for this site and id, returns the current promise. * - * @param {string} id An ID to identify the download. It can be used to retrieve the download promise. - * @param {any[]} modules List of modules to prefetch. - * @param {number} courseId Course ID the modules belong to. - * @param {CoreCourseModulesProgressFunction} [onProgress] Function to call everytime a module is downloaded. - * @return {Promise} Promise resolved when all modules have been prefetched. + * @param id An ID to identify the download. It can be used to retrieve the download promise. + * @param modules List of modules to prefetch. + * @param courseId Course ID the modules belong to. + * @param onProgress Function to call everytime a module is downloaded. + * @return Promise resolved when all modules have been prefetched. */ prefetchModules(id: string, modules: any[], courseId: number, onProgress?: CoreCourseModulesProgressFunction): Promise { @@ -1294,9 +1287,9 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Remove module Files from handler. * - * @param {any} module Module to remove the files. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when done. + * @param module Module to remove the files. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when done. */ removeModuleFiles(module: any, courseId: number): Promise { const handler = this.getPrefetchHandlerFor(module), @@ -1334,8 +1327,8 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Set an on progress function for the download of a list of modules. * - * @param {string} id An ID to identify the download. - * @param {CoreCourseModulesProgressFunction} onProgress Function to call everytime a module is downloaded. + * @param id An ID to identify the download. + * @param onProgress Function to call everytime a module is downloaded. */ setOnProgress(id: string, onProgress: CoreCourseModulesProgressFunction): void { const siteId = this.sitesProvider.getCurrentSiteId(), @@ -1350,9 +1343,9 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * If courseId or sectionId is set, save them in the cache. * - * @param {string} packageId The package ID. - * @param {number} [courseId] Course ID. - * @param {number} [sectionId] Section ID. + * @param packageId The package ID. + * @param courseId Course ID. + * @param sectionId Section ID. */ storeCourseAndSection(packageId: string, courseId?: number, sectionId?: number): void { if (courseId) { @@ -1366,12 +1359,12 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Treat the result of the check updates WS call. * - * @param {any[]} toCheckList List of modules to check (from createToCheckList). - * @param {any} response WS call response. - * @param {any} result Object where to store the result. - * @param {number} [previousTime] Time of the previous check updates execution. If set, modules downloaded - * after this time will be ignored. - * @return {any} Result. + * @param toCheckList List of modules to check (from createToCheckList). + * @param response WS call response. + * @param result Object where to store the result. + * @param previousTime Time of the previous check updates execution. If set, modules downloaded + * after this time will be ignored. + * @return Result. */ protected treatCheckUpdatesResult(toCheckList: any[], response: any, result: any, previousTime?: number): any { // Format the response to index it by module ID. @@ -1399,11 +1392,11 @@ export class CoreCourseModulePrefetchDelegate extends CoreDelegate { /** * Update the status of a module in the "cache". * - * @param {string} status New status. - * @param {string} component Package's component. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {number} [courseId] Course ID of the module. - * @param {number} [sectionId] Section ID of the module. + * @param status New status. + * @param component Package's component. + * @param componentId An ID to use in conjunction with the component. + * @param courseId Course ID of the module. + * @param sectionId Section ID of the module. */ updateStatusCache(status: string, component: string, componentId?: string | number, courseId?: number, sectionId?: number) : void { diff --git a/src/core/course/providers/modules-tag-area-handler.ts b/src/core/course/providers/modules-tag-area-handler.ts index 4b7dcfc0a..a3285e10e 100644 --- a/src/core/course/providers/modules-tag-area-handler.ts +++ b/src/core/course/providers/modules-tag-area-handler.ts @@ -29,7 +29,7 @@ export class CoreCourseModulesTagAreaHandler implements CoreTagAreaHandler { /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return true; @@ -38,8 +38,8 @@ export class CoreCourseModulesTagAreaHandler implements CoreTagAreaHandler { /** * Parses the rendered content of a tag index and returns the items. * - * @param {string} content Rendered content. - * @return {any[]|Promise} Area items (or promise resolved with the items). + * @param content Rendered content. + * @return Area items (or promise resolved with the items). */ parseContent(content: string): any[] | Promise { return this.tagHelper.parseFeedContent(content); @@ -48,8 +48,8 @@ export class CoreCourseModulesTagAreaHandler implements CoreTagAreaHandler { /** * Get the component to use to display items. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return CoreTagFeedComponent; diff --git a/src/core/course/providers/options-delegate.ts b/src/core/course/providers/options-delegate.ts index 8f0ac6124..0fb67a195 100644 --- a/src/core/course/providers/options-delegate.ts +++ b/src/core/course/providers/options-delegate.ts @@ -27,51 +27,49 @@ import { CoreCourseProvider } from './course'; export interface CoreCourseOptionsHandler extends CoreDelegateHandler { /** * The highest priority is displayed first. - * @type {number} */ priority: number; /** * True if this handler should appear in menu rather than as a tab. - * @type {boolean} */ isMenuHandler?: boolean; /** * Whether or not the handler is enabled for a certain course. * - * @param {number} courseId The course ID. - * @param {any} accessData Access type and data. Default, guest, ... - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @param courseId The course ID. + * @param accessData Access type and data. Default, guest, ... + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return True or promise resolved with true if enabled. */ isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise; /** * Returns the data needed to render the handler. * - * @param {Injector} injector Injector. - * @param {number} course The course. - * @return {CoreCourseOptionsHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param course The course. + * @return Data or promise resolved with the data. */ getDisplayData?(injector: Injector, course: any): CoreCourseOptionsHandlerData | Promise; /** * Should invalidate the data to determine if the handler is enabled for a certain course. * - * @param {number} courseId The course ID. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {Promise} Promise resolved when done. + * @param courseId The course ID. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved when done. */ invalidateEnabledForCourse?(courseId: number, navOptions?: any, admOptions?: any): Promise; /** * 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. - * @return {Promise} Promise resolved when done. + * @param course The course. + * @return Promise resolved when done. */ prefetch?(course: any): Promise; } @@ -83,9 +81,9 @@ export interface CoreCourseOptionsMenuHandler extends CoreCourseOptionsHandler { /** * Returns the data needed to render the handler. * - * @param {Injector} injector Injector. - * @param {number} course The course. - * @return {CoreCourseOptionsMenuHandlerData|Promise} Data or promise resolved with data. + * @param injector Injector. + * @param course The course. + * @return Data or promise resolved with data. */ getMenuDisplayData(injector: Injector, course: any): CoreCourseOptionsMenuHandlerData | Promise; @@ -97,13 +95,11 @@ export interface CoreCourseOptionsMenuHandler extends CoreCourseOptionsHandler { export interface CoreCourseOptionsHandlerData { /** * Title to display for the handler. - * @type {string} */ title: string; /** * Class to add to the displayed handler. - * @type {string} */ class?: string; @@ -115,7 +111,6 @@ export interface CoreCourseOptionsHandlerData { /** * Data to pass to the component. All the properties in this object will be passed to the component as inputs. - * @type {any} */ componentData?: any; } @@ -126,31 +121,26 @@ export interface CoreCourseOptionsHandlerData { export interface CoreCourseOptionsMenuHandlerData { /** * Title to display for the handler. - * @type {string} */ title: string; /** * Class to add to the displayed handler. - * @type {string} */ class?: string; /** * Name of the page to load for the handler. - * @type {string} */ page: string; /** * Params to pass to the page (other than 'course' which is always sent). - * @type {any} */ pageParams?: any; /** * Name of the icon to display for the handler. - * @type {string} */ icon: string; // Name of the icon to display in the tab. } @@ -161,27 +151,24 @@ export interface CoreCourseOptionsMenuHandlerData { export interface CoreCourseOptionsHandlerToDisplay { /** * Data to display. - * @type {CoreCourseOptionsHandlerData} */ data: CoreCourseOptionsHandlerData; /** * Name of the handler, or name and sub context (AddonMessages, AddonMessages:blockContact, ...). - * @type {string} */ name: string; /** * The highest priority is displayed first. - * @type {number} */ priority?: number; /** * 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. - * @return {Promise} Promise resolved when done. + * @param course The course. + * @return Promise resolved when done. */ prefetch?(course: any): Promise; } @@ -192,27 +179,24 @@ export interface CoreCourseOptionsHandlerToDisplay { export interface CoreCourseOptionsMenuHandlerToDisplay { /** * Data to display. - * @type {CoreCourseOptionsMenuHandlerData} */ data: CoreCourseOptionsMenuHandlerData; /** * Name of the handler, or name and sub context (AddonMessages, AddonMessages:blockContact, ...). - * @type {string} */ name: string; /** * The highest priority is displayed first. - * @type {number} */ priority?: number; /** * 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. - * @return {Promise} Promise resolved when done. + * @param course The course. + * @return Promise resolved when done. */ prefetch?(course: any): Promise; } @@ -245,8 +229,8 @@ export class CoreCourseOptionsDelegate extends CoreDelegate { /** * Check if handlers are loaded for a certain course. * - * @param {number} courseId The course ID to check. - * @return {boolean} True if handlers are loaded, false otherwise. + * @param courseId The course ID to check. + * @return True if handlers are loaded, false otherwise. */ areHandlersLoaded(courseId: number): boolean { return !!this.loaded[courseId]; @@ -255,7 +239,7 @@ export class CoreCourseOptionsDelegate extends CoreDelegate { /** * Clear all course options handlers. * - * @param {number} [courseId] The course ID. If not defined, all handlers will be cleared. + * @param courseId The course ID. If not defined, all handlers will be cleared. */ protected clearCoursesHandlers(courseId?: number): void { if (courseId) { @@ -270,8 +254,8 @@ export class CoreCourseOptionsDelegate extends CoreDelegate { /** * Clear all courses handlers and invalidate its options. * - * @param {number} [courseId] The course ID. If not defined, all handlers will be cleared. - * @return {Promise} Promise resolved when done. + * @param courseId The course ID. If not defined, all handlers will be cleared. + * @return Promise resolved when done. */ clearAndInvalidateCoursesOptions(courseId?: number): Promise { const promises = []; @@ -301,12 +285,12 @@ export class CoreCourseOptionsDelegate extends CoreDelegate { /** * Get the handlers for a course using a certain access type. * - * @param {number} courseId The course ID. - * @param {boolean} refresh True if it should refresh the list. - * @param {any} accessData Access type and data. Default, guest, ... - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {Promise} Promise resolved with array of handlers. + * @param courseId The course ID. + * @param refresh True if it should refresh the list. + * @param accessData Access type and data. Default, guest, ... + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved with array of handlers. */ protected getHandlersForAccess(courseId: number, refresh: boolean, accessData: any, navOptions?: any, admOptions?: any): Promise { @@ -336,13 +320,13 @@ export class CoreCourseOptionsDelegate extends CoreDelegate { * Get the list of handlers that should be displayed for a course. * This function should be called only when the handlers need to be displayed, since it can call several WebServices. * - * @param {Injector} injector Injector. - * @param {any} course The course object. - * @param {boolean} [refresh] True if it should refresh the list. - * @param {boolean} [isGuest] Whether it's guest. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {Promise} Promise resolved with array of handlers. + * @param injector Injector. + * @param course The course object. + * @param refresh True if it should refresh the list. + * @param isGuest Whether it's guest. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved with array of handlers. */ getHandlersToDisplay(injector: Injector, course: any, refresh?: boolean, isGuest?: boolean, navOptions?: any, admOptions?: any): Promise { @@ -354,13 +338,13 @@ export class CoreCourseOptionsDelegate extends CoreDelegate { * Get the list of menu handlers that should be displayed for a course. * This function should be called only when the handlers need to be displayed, since it can call several WebServices. * - * @param {Injector} injector Injector. - * @param {any} course The course object. - * @param {boolean} [refresh] True if it should refresh the list. - * @param {boolean} [isGuest] Whether it's guest. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {Promise} Promise resolved with array of handlers. + * @param injector Injector. + * @param course The course object. + * @param refresh True if it should refresh the list. + * @param isGuest Whether it's guest. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved with array of handlers. */ getMenuHandlersToDisplay(injector: Injector, course: any, refresh?: boolean, isGuest?: boolean, navOptions?: any, admOptions?: any): Promise { @@ -372,14 +356,14 @@ export class CoreCourseOptionsDelegate extends CoreDelegate { * Get the list of menu handlers that should be displayed for a course. * This function should be called only when the handlers need to be displayed, since it can call several WebServices. * - * @param {boolean} menu If true, gets menu handlers; false, gets tab handlers - * @param {Injector} injector Injector. - * @param {any} course The course object. - * @param {boolean} refresh True if it should refresh the list. - * @param {boolean} isGuest Whether it's guest. - * @param {any} navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {Promise} Promise resolved with array of handlers. + * @param menu If true, gets menu handlers; false, gets tab handlers + * @param injector Injector. + * @param course The course object. + * @param refresh True if it should refresh the list. + * @param isGuest Whether it's guest. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved with array of handlers. */ protected getHandlersToDisplayInternal(menu: boolean, injector: Injector, course: any, refresh: boolean, isGuest: boolean, navOptions: any, admOptions: any): Promise { @@ -439,9 +423,9 @@ export class CoreCourseOptionsDelegate extends CoreDelegate { /** * Check if a course has any handler enabled for default access, using course object. * - * @param {any} course The course object. - * @param {boolean} [refresh] True if it should refresh the list. - * @return {Promise} Promise resolved with boolean: true if it has handlers, false otherwise. + * @param course The course object. + * @param refresh True if it should refresh the list. + * @return Promise resolved with boolean: true if it has handlers, false otherwise. */ hasHandlersForCourse(course: any, refresh?: boolean): Promise { // Load course options if missing. @@ -453,11 +437,11 @@ export class CoreCourseOptionsDelegate extends CoreDelegate { /** * Check if a course has any handler enabled for default access. * - * @param {number} courseId The course ID. - * @param {boolean} [refresh] True if it should refresh the list. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {Promise} Promise resolved with boolean: true if it has handlers, false otherwise. + * @param courseId The course ID. + * @param refresh True if it should refresh the list. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved with boolean: true if it has handlers, false otherwise. */ hasHandlersForDefault(courseId: number, refresh?: boolean, navOptions?: any, admOptions?: any): Promise { // Default access. @@ -473,11 +457,11 @@ export class CoreCourseOptionsDelegate extends CoreDelegate { /** * Check if a course has any handler enabled for guest access. * - * @param {number} courseId The course ID. - * @param {boolean} [refresh] True if it should refresh the list. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {Promise} Promise resolved with boolean: true if it has handlers, false otherwise. + * @param courseId The course ID. + * @param refresh True if it should refresh the list. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved with boolean: true if it has handlers, false otherwise. */ hasHandlersForGuest(courseId: number, refresh?: boolean, navOptions?: any, admOptions?: any): Promise { // Guest access. @@ -493,8 +477,8 @@ export class CoreCourseOptionsDelegate extends CoreDelegate { /** * Invalidate the data to be able to determine if handlers are enabled for a certain course. * - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved when done. + * @param courseId Course ID. + * @return Promise resolved when done. */ invalidateCourseHandlers(courseId: number): Promise { const promises = [], @@ -518,9 +502,9 @@ export class CoreCourseOptionsDelegate extends CoreDelegate { * Check if a time belongs to the last update handlers for course call. * This is to handle the cases where updateHandlersForCourse don't finish in the same order as they're called. * - * @param {number} courseId Course ID. - * @param {number} time Time to check. - * @return {boolean} Whether it's the last call. + * @param courseId Course ID. + * @param time Time to check. + * @return Whether it's the last call. */ isLastUpdateCourseCall(courseId: number, time: number): boolean { if (!this.lastUpdateHandlersForCoursesStart[courseId]) { @@ -533,9 +517,9 @@ export class CoreCourseOptionsDelegate extends CoreDelegate { /** * Load course options if missing. * - * @param {any} course The course object. - * @param {boolean} [refresh] True if it should refresh the list. - * @return {Promise} Promise resolved when done. + * @param course The course object. + * @param refresh True if it should refresh the list. + * @return Promise resolved when done. */ protected loadCourseOptions(course: any, refresh?: boolean): Promise { if (this.coursesProvider.canGetAdminAndNavOptions() && @@ -564,11 +548,11 @@ export class CoreCourseOptionsDelegate extends CoreDelegate { /** * Update the handlers for a certain course. * - * @param {number} courseId The course ID. - * @param {any} accessData Access type and data. Default, guest, ... - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {Promise} Resolved when updated. + * @param courseId The course ID. + * @param accessData Access type and data. Default, guest, ... + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Resolved when updated. */ updateHandlersForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): Promise { const promises = [], diff --git a/src/core/course/providers/sync-cron-handler.ts b/src/core/course/providers/sync-cron-handler.ts index 8f3adc3a6..4b07c449e 100644 --- a/src/core/course/providers/sync-cron-handler.ts +++ b/src/core/course/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class CoreCourseSyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.courseSync.syncAllCourses(siteId); @@ -40,7 +40,7 @@ export class CoreCourseSyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return this.courseSync.syncInterval; diff --git a/src/core/course/providers/sync.ts b/src/core/course/providers/sync.ts index 2c091a863..c7cb473ce 100644 --- a/src/core/course/providers/sync.ts +++ b/src/core/course/providers/sync.ts @@ -48,9 +48,9 @@ export class CoreCourseSyncProvider extends CoreSyncBaseProvider { /** * Try to synchronize all the courses in a certain site or in all sites. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncAllCourses(siteId?: string, force?: boolean): Promise { return this.syncOnSites('courses', this.syncAllCoursesFunc.bind(this), [force], siteId); @@ -59,9 +59,9 @@ export class CoreCourseSyncProvider extends CoreSyncBaseProvider { /** * Sync all courses on a site. * - * @param {string} siteId Site ID to sync. If not defined, sync all sites. - * @param {boolean} force Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved if sync is successful, rejected if sync fails. */ protected syncAllCoursesFunc(siteId: string, force: boolean): Promise { const p1 = []; @@ -94,9 +94,9 @@ export class CoreCourseSyncProvider extends CoreSyncBaseProvider { /** * Sync a course if it's needed. * - * @param {number} courseId Course ID to be synced. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the course is synced or it doesn't need to be synced. + * @param courseId Course ID to be synced. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the course is synced or it doesn't need to be synced. */ syncCourseIfNeeded(courseId: number, siteId?: string): Promise { // Usually we call isSyncNeeded to check if a certain time has passed. @@ -107,9 +107,9 @@ export class CoreCourseSyncProvider extends CoreSyncBaseProvider { /** * Synchronize a course. * - * @param {number} courseId Course ID to be synced. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param courseId Course ID to be synced. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ syncCourse(courseId: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); diff --git a/src/core/courses/components/course-list-item/course-list-item.ts b/src/core/courses/components/course-list-item/course-list-item.ts index c11f17f69..7c5e34f62 100644 --- a/src/core/courses/components/course-list-item/course-list-item.ts +++ b/src/core/courses/components/course-list-item/course-list-item.ts @@ -78,7 +78,7 @@ export class CoreCoursesCourseListItemComponent implements OnInit { /** * Open a course. * - * @param {any} course The course to open. + * @param course The course to open. */ openCourse(course: any): void { if (course.isEnrolled) { diff --git a/src/core/courses/components/course-options-menu/course-options-menu.ts b/src/core/courses/components/course-options-menu/course-options-menu.ts index a63dbedf5..99abb36a9 100644 --- a/src/core/courses/components/course-options-menu/course-options-menu.ts +++ b/src/core/courses/components/course-options-menu/course-options-menu.ts @@ -43,7 +43,7 @@ export class CoreCoursesCourseOptionsMenuComponent implements OnInit { /** * Do an action over the course. - * @param {string} action Action name to take. + * @param action Action name to take. */ action(action: string): void { this.viewCtrl.dismiss(action); diff --git a/src/core/courses/components/course-progress/course-progress.ts b/src/core/courses/components/course-progress/course-progress.ts index 814b00c55..1db3c9098 100644 --- a/src/core/courses/components/course-progress/course-progress.ts +++ b/src/core/courses/components/course-progress/course-progress.ts @@ -130,7 +130,7 @@ export class CoreCoursesCourseProgressComponent implements OnInit, OnDestroy { /** * Open a course. * - * @param {any} course The course to open. + * @param course The course to open. */ openCourse(course: any): void { this.courseHelper.openCourse(this.navCtrl, course); @@ -139,7 +139,7 @@ export class CoreCoursesCourseProgressComponent implements OnInit, OnDestroy { /** * Prefetch the course. * - * @param {Event} e Click event. + * @param e Click event. */ prefetchCourse(e: Event): void { e.preventDefault(); @@ -155,7 +155,7 @@ export class CoreCoursesCourseProgressComponent implements OnInit, OnDestroy { /** * Update the course status icon and title. * - * @param {string} status Status to show. + * @param status Status to show. */ protected updateCourseStatus(status: string): void { const statusData = this.courseHelper.getCourseStatusIconAndTitleFromStatus(status); @@ -167,7 +167,7 @@ export class CoreCoursesCourseProgressComponent implements OnInit, OnDestroy { /** * Show the context menu. * - * @param {Event} e Click Event. + * @param e Click Event. */ showCourseOptionsMenu(e: Event): void { e.preventDefault(); @@ -210,7 +210,7 @@ export class CoreCoursesCourseProgressComponent implements OnInit, OnDestroy { /** * Hide/Unhide the course from the course list. * - * @param {boolean} hide True to hide and false to show. + * @param hide True to hide and false to show. */ protected setCourseHidden(hide: boolean): void { this.showSpinner = true; @@ -232,7 +232,7 @@ export class CoreCoursesCourseProgressComponent implements OnInit, OnDestroy { /** * Favourite/Unfavourite the course from the course list. * - * @param {boolean} favourite True to favourite and false to unfavourite. + * @param favourite True to favourite and false to unfavourite. */ protected setCourseFavourite(favourite: boolean): void { this.showSpinner = true; diff --git a/src/core/courses/components/my-courses/my-courses.ts b/src/core/courses/components/my-courses/my-courses.ts index fc0817350..3135892c8 100644 --- a/src/core/courses/components/my-courses/my-courses.ts +++ b/src/core/courses/components/my-courses/my-courses.ts @@ -84,7 +84,7 @@ export class CoreCoursesMyCoursesComponent implements OnInit, OnDestroy { /** * Fetch the user courses. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchCourses(): Promise { return this.coursesProvider.getUserCourses().then((courses) => { @@ -121,7 +121,7 @@ export class CoreCoursesMyCoursesComponent implements OnInit, OnDestroy { /** * Refresh the courses. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshCourses(refresher: any): void { const promises = []; @@ -158,7 +158,7 @@ export class CoreCoursesMyCoursesComponent implements OnInit, OnDestroy { /** * The filter has changed. * - * @param {any} Received Event. + * @param Received Event. */ filterChanged(event: any): void { const newValue = event.target.value && event.target.value.trim().toLowerCase(); @@ -181,7 +181,7 @@ export class CoreCoursesMyCoursesComponent implements OnInit, OnDestroy { /** * Prefetch all the courses. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ prefetchCourses(): Promise { const initialIcon = this.prefetchCoursesData.icon; diff --git a/src/core/courses/pages/available-courses/available-courses.ts b/src/core/courses/pages/available-courses/available-courses.ts index 5e244e7cb..9a69fe49b 100644 --- a/src/core/courses/pages/available-courses/available-courses.ts +++ b/src/core/courses/pages/available-courses/available-courses.ts @@ -45,7 +45,7 @@ export class CoreCoursesAvailableCoursesPage { /** * Load the courses. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected loadCourses(): Promise { const frontpageCourseId = this.sitesProvider.getCurrentSite().getSiteHomeId(); @@ -62,7 +62,7 @@ export class CoreCoursesAvailableCoursesPage { /** * Refresh the courses. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshCourses(refresher: any): void { const promises = []; diff --git a/src/core/courses/pages/categories/categories.ts b/src/core/courses/pages/categories/categories.ts index ab9a35cb1..10b84803e 100644 --- a/src/core/courses/pages/categories/categories.ts +++ b/src/core/courses/pages/categories/categories.ts @@ -56,7 +56,7 @@ export class CoreCoursesCategoriesPage { /** * Fetch the categories. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchCategories(): Promise { return this.coursesProvider.getCategories(this.categoryId, true).then((cats) => { @@ -98,7 +98,7 @@ export class CoreCoursesCategoriesPage { /** * Refresh the categories. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshCategories(refresher: any): void { const promises = []; @@ -117,7 +117,7 @@ export class CoreCoursesCategoriesPage { /** * Open a category. * - * @param {number} categoryId The category ID. + * @param categoryId The category ID. */ openCategory(categoryId: number): void { this.navCtrl.push('CoreCoursesCategoriesPage', { categoryId: categoryId }); diff --git a/src/core/courses/pages/course-preview/course-preview.ts b/src/core/courses/pages/course-preview/course-preview.ts index 6e1569c2d..0be65494d 100644 --- a/src/core/courses/pages/course-preview/course-preview.ts +++ b/src/core/courses/pages/course-preview/course-preview.ts @@ -157,8 +157,8 @@ export class CoreCoursesCoursePreviewPage implements OnDestroy { /** * Check if the user can access as guest. * - * @return {Promise} Promise resolved if can access as guest, rejected otherwise. Resolve param indicates if - * password is required for guest access. + * @return Promise resolved if can access as guest, rejected otherwise. Resolve param indicates if + * password is required for guest access. */ protected canAccessAsGuest(): Promise { if (!this.isGuestEnabled) { @@ -192,7 +192,7 @@ export class CoreCoursesCoursePreviewPage implements OnDestroy { /** * Convenience function to get course. We use this to determine if a user can see the course or not. * - * @param {boolean} refresh Whether the user is refreshing the data. + * @param refresh Whether the user is refreshing the data. */ protected getCourse(refresh?: boolean): Promise { // Get course enrolment methods. @@ -336,7 +336,7 @@ export class CoreCoursesCoursePreviewPage implements OnDestroy { /** * User clicked in a self enrol button. * - * @param {number} instanceId The instance ID of the enrolment method. + * @param instanceId The instance ID of the enrolment method. */ selfEnrolClicked(instanceId: number): void { this.domUtils.showConfirm(this.translate.instant('core.courses.confirmselfenrol')).then(() => { @@ -349,9 +349,9 @@ export class CoreCoursesCoursePreviewPage implements OnDestroy { /** * Self enrol in a course. * - * @param {string} password Password to use. - * @param {number} instanceId The instance ID. - * @return {Promise} Promise resolved when self enrolled. + * @param password Password to use. + * @param instanceId The instance ID. + * @return Promise resolved when self enrolled. */ selfEnrolInCourse(password: string, instanceId: number): Promise { const modal = this.domUtils.showModalLoading('core.loading', true); @@ -390,7 +390,7 @@ export class CoreCoursesCoursePreviewPage implements OnDestroy { /** * Refresh the data. * - * @param {any} [refresher] The refresher if this was triggered by a Pull To Refresh. + * @param refresher The refresher if this was triggered by a Pull To Refresh. */ refreshData(refresher?: any): Promise { const promises = []; @@ -418,7 +418,7 @@ export class CoreCoursesCoursePreviewPage implements OnDestroy { /** * Update the course status icon and title. * - * @param {string} status Status to show. + * @param status Status to show. */ protected updateCourseStatus(status: string): void { const statusData = this.courseHelper.getCourseStatusIconAndTitleFromStatus(status); @@ -430,8 +430,8 @@ export class CoreCoursesCoursePreviewPage implements OnDestroy { /** * Wait for the user to be enrolled in the course. * - * @param {boolean} first If it's the first call (true) or it's a recursive call (false). - * @return {Promise} Promise resolved when enrolled or timeout. + * @param first If it's the first call (true) or it's a recursive call (false). + * @return Promise resolved when enrolled or timeout. */ protected waitForEnrolled(first?: boolean): Promise { if (first) { diff --git a/src/core/courses/pages/dashboard/dashboard.ts b/src/core/courses/pages/dashboard/dashboard.ts index 94bd5243a..2c2ccd993 100644 --- a/src/core/courses/pages/dashboard/dashboard.ts +++ b/src/core/courses/pages/dashboard/dashboard.ts @@ -139,7 +139,7 @@ export class CoreCoursesDashboardPage implements OnDestroy { /** * Convenience function to fetch the dashboard data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected loadDashboardContent(): Promise { return this.dashboardProvider.isAvailable().then((available) => { @@ -171,7 +171,7 @@ export class CoreCoursesDashboardPage implements OnDestroy { /** * Refresh the dashboard data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshDashboard(refresher: any): void { const promises = []; @@ -195,7 +195,7 @@ export class CoreCoursesDashboardPage implements OnDestroy { /** * Refresh the dashboard data and My Courses. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshMyCourses(refresher: any): void { // First of all, refresh dashboard blocks, maybe a new block was added and now we can display the dashboard. @@ -222,7 +222,7 @@ export class CoreCoursesDashboardPage implements OnDestroy { /** * Convenience function to switch download enabled. * - * @param {boolean} enable If enable or disable. + * @param enable If enable or disable. */ protected switchDownload(enable: boolean): void { this.downloadEnabled = (this.downloadCourseEnabled || this.downloadCoursesEnabled) && enable; diff --git a/src/core/courses/pages/search/search.ts b/src/core/courses/pages/search/search.ts index e73c88b90..c64795460 100644 --- a/src/core/courses/pages/search/search.ts +++ b/src/core/courses/pages/search/search.ts @@ -39,7 +39,7 @@ export class CoreCoursesSearchPage { /** * Search a new text. * - * @param {string} text The text to search. + * @param text The text to search. */ search(text: string): void { this.currentSearch = text; @@ -55,7 +55,7 @@ export class CoreCoursesSearchPage { /** * Load more results. * - * @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. */ loadMoreResults(infiniteComplete?: any): void { this.searchCourses().finally(() => { @@ -66,7 +66,7 @@ export class CoreCoursesSearchPage { /** * Search courses or load the next page of current search. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected searchCourses(): Promise { this.loadMoreError = false; diff --git a/src/core/courses/pages/self-enrol-password/self-enrol-password.ts b/src/core/courses/pages/self-enrol-password/self-enrol-password.ts index 276cf7718..e304ad8b5 100644 --- a/src/core/courses/pages/self-enrol-password/self-enrol-password.ts +++ b/src/core/courses/pages/self-enrol-password/self-enrol-password.ts @@ -36,8 +36,8 @@ export class CoreCoursesSelfEnrolPasswordPage { /** * Submit password. * - * @param {Event} e Event. - * @param {string} password Password to submit. + * @param e Event. + * @param password Password to submit. */ submitPassword(e: Event, password: string): void { e.preventDefault(); diff --git a/src/core/courses/providers/course-link-handler.ts b/src/core/courses/providers/course-link-handler.ts index 5ffe35cb6..249ef5594 100644 --- a/src/core/courses/providers/course-link-handler.ts +++ b/src/core/courses/providers/course-link-handler.ts @@ -49,11 +49,11 @@ export class CoreCoursesCourseLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -104,11 +104,11 @@ export class CoreCoursesCourseLinkHandler extends CoreContentLinksHandlerBase { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { courseId = parseInt(params.id, 10); @@ -126,12 +126,12 @@ export class CoreCoursesCourseLinkHandler extends CoreContentLinksHandlerBase { /** * Action to perform when an enrol link is clicked. * - * @param {number} courseId Course ID. - * @param {string} url Treated URL. - * @param {any} pageParams Params to send to the new page. - * @param {NavController} [navCtrl] NavController for adding new pages to the current history. Optional for legacy support, but - * generates a warning if omitted. - * @return {Promise} Promise resolved when done. + * @param courseId Course ID. + * @param url Treated URL. + * @param pageParams Params to send to the new page. + * @param navCtrl NavController for adding new pages to the current history. Optional for legacy support, but + * generates a warning if omitted. + * @return Promise resolved when done. */ protected actionEnrol(courseId: number, url: string, pageParams: any, navCtrl?: NavController): Promise { const modal = this.domUtils.showModalLoading(), @@ -216,8 +216,8 @@ export class CoreCoursesCourseLinkHandler extends CoreContentLinksHandlerBase { /** * Check if a user can be "automatically" self enrolled in a course. * - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved if user can be enrolled in a course, rejected otherwise. + * @param courseId Course ID. + * @return Promise resolved if user can be enrolled in a course, rejected otherwise. */ protected canSelfEnrol(courseId: number): Promise { // Check that the course has self enrolment enabled. @@ -242,9 +242,9 @@ export class CoreCoursesCourseLinkHandler extends CoreContentLinksHandlerBase { /** * Try to self enrol a user in a course. * - * @param {number} courseId Course ID. - * @param {string} [password] Password. - * @return {Promise} Promise resolved when the user is enrolled, rejected otherwise. + * @param courseId Course ID. + * @param password Password. + * @return Promise resolved when the user is enrolled, rejected otherwise. */ protected selfEnrol(courseId: number, password?: string): Promise { const modal = this.domUtils.showModalLoading(); @@ -285,9 +285,9 @@ export class CoreCoursesCourseLinkHandler extends CoreContentLinksHandlerBase { /** * Wait for the user to be enrolled in a course. * - * @param {number} courseId The course ID. - * @param {boolean} first If it's the first call (true) or it's a recursive call (false). - * @return {Promise} Promise resolved when enrolled or timeout. + * @param courseId The course ID. + * @param first If it's the first call (true) or it's a recursive call (false). + * @return Promise resolved when enrolled or timeout. */ protected waitForEnrolled(courseId: number, first?: boolean): Promise { if (first) { diff --git a/src/core/courses/providers/courses-index-link-handler.ts b/src/core/courses/providers/courses-index-link-handler.ts index bbea7ec34..150fb9421 100644 --- a/src/core/courses/providers/courses-index-link-handler.ts +++ b/src/core/courses/providers/courses-index-link-handler.ts @@ -34,11 +34,11 @@ export class CoreCoursesIndexLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[] | Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { diff --git a/src/core/courses/providers/courses.ts b/src/core/courses/providers/courses.ts index c63780c5c..160fe5b5d 100644 --- a/src/core/courses/providers/courses.ts +++ b/src/core/courses/providers/courses.ts @@ -41,7 +41,7 @@ export class CoreCoursesProvider { /** * Whether current site supports getting course options. * - * @return {boolean} Whether current site supports getting course options. + * @return Whether current site supports getting course options. */ canGetAdminAndNavOptions(): boolean { return this.sitesProvider.wsAvailableInCurrentSite('core_course_get_user_navigation_options') && @@ -51,10 +51,10 @@ export class CoreCoursesProvider { /** * Get categories. They can be filtered by id. * - * @param {number} categoryId Category ID to get. - * @param {boolean} [addSubcategories] If it should add subcategories to the list. - * @param {string} [siteId] Site to get the courses from. If not defined, use current site. - * @return {Promise} Promise resolved with the categories. + * @param categoryId Category ID to get. + * @param addSubcategories If it should add subcategories to the list. + * @param siteId Site to get the courses from. If not defined, use current site. + * @return Promise resolved with the categories. */ getCategories(categoryId: number, addSubcategories?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -78,9 +78,9 @@ export class CoreCoursesProvider { /** * Get cache key for get categories methods WS call. * - * @param {number} categoryId Category ID to get. - * @param {boolean} [addSubcategories] If add subcategories to the list. - * @return {string} Cache key. + * @param categoryId Category ID to get. + * @param addSubcategories If add subcategories to the list. + * @return Cache key. */ protected getCategoriesCacheKey(categoryId: number, addSubcategories?: boolean): string { return this.ROOT_CACHE_KEY + 'categories:' + categoryId + ':' + !!addSubcategories; @@ -89,9 +89,9 @@ export class CoreCoursesProvider { /** * Given a list of course IDs to get course admin and nav options, return the list of courseIds to use. * - * @param {number[]} courseIds Course IDs. - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with the list of course IDs. + * @param courseIds Course IDs. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with the list of course IDs. */ protected getCourseIdsForAdminAndNavOptions(courseIds: number[], siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -153,8 +153,8 @@ export class CoreCoursesProvider { /** * Check if download a whole course is disabled in a certain site. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. */ isDownloadCourseDisabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -165,8 +165,8 @@ export class CoreCoursesProvider { /** * Check if download a whole course is disabled in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's disabled. + * @param site Site. If not defined, use current site. + * @return Whether it's disabled. */ isDownloadCourseDisabledInSite(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -177,8 +177,8 @@ export class CoreCoursesProvider { /** * Check if download all courses is disabled in a certain site. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. */ isDownloadCoursesDisabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -189,8 +189,8 @@ export class CoreCoursesProvider { /** * Check if download all courses is disabled in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's disabled. + * @param site Site. If not defined, use current site. + * @return Whether it's disabled. */ isDownloadCoursesDisabledInSite(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -201,8 +201,8 @@ export class CoreCoursesProvider { /** * Check if My Courses is disabled in a certain site. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. */ isMyCoursesDisabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -213,8 +213,8 @@ export class CoreCoursesProvider { /** * Check if My Courses is disabled in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's disabled. + * @param site Site. If not defined, use current site. + * @return Whether it's disabled. */ isMyCoursesDisabledInSite(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -225,8 +225,8 @@ export class CoreCoursesProvider { /** * Check if Search Courses is disabled in a certain site. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. */ isSearchCoursesDisabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -237,8 +237,8 @@ export class CoreCoursesProvider { /** * Check if Search Courses is disabled in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's disabled. + * @param site Site. If not defined, use current site. + * @return Whether it's disabled. */ isSearchCoursesDisabledInSite(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -249,9 +249,9 @@ export class CoreCoursesProvider { /** * Get course. * - * @param {number} id ID of the course to get. - * @param {string} [siteId] Site to get the courses from. If not defined, use current site. - * @return {Promise} Promise resolved with the course. + * @param id ID of the course to get. + * @param siteId Site to get the courses from. If not defined, use current site. + * @return Promise resolved with the course. */ getCourse(id: number, siteId?: string): Promise { return this.getCourses([id], siteId).then((courses) => { @@ -266,9 +266,9 @@ export class CoreCoursesProvider { /** * Get the enrolment methods from a course. * - * @param {number} id ID of the course. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -287,8 +287,8 @@ export class CoreCoursesProvider { /** * Get cache key for get course enrolment methods WS call. * - * @param {number} id Course ID. - * @return {string} Cache key. + * @param id Course ID. + * @return Cache key. */ protected getCourseEnrolmentMethodsCacheKey(id: number): string { return this.ROOT_CACHE_KEY + 'enrolmentmethods:' + id; @@ -297,9 +297,9 @@ export class CoreCoursesProvider { /** * Get info from a course guest enrolment method. * - * @param {number} instanceId Guest instance ID. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved when the info is retrieved. + * @param instanceId Guest instance ID. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved when the info is retrieved. */ getCourseGuestEnrolmentInfo(instanceId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -320,8 +320,8 @@ export class CoreCoursesProvider { /** * Get cache key for get course guest enrolment methods WS call. * - * @param {number} instanceId Guest instance ID. - * @return {string} Cache key. + * @param instanceId Guest instance ID. + * @return Cache key. */ protected getCourseGuestEnrolmentInfoCacheKey(instanceId: number): string { return this.ROOT_CACHE_KEY + 'guestinfo:' + instanceId; @@ -332,9 +332,9 @@ export class CoreCoursesProvider { * Warning: if the user doesn't have permissions to view some of the courses passed the WS call will fail. * The user must be able to view ALL the courses passed. * - * @param {number[]} ids List of IDs of the courses to get. - * @param {string} [siteId] Site to get the courses from. If not defined, use current site. - * @return {Promise} Promise resolved with the courses. + * @param ids List of IDs of the courses to get. + * @param siteId Site to get the courses from. If not defined, use current site. + * @return Promise resolved with the courses. */ getCourses(ids: number[], siteId?: string): Promise { if (!Array.isArray(ids)) { @@ -361,8 +361,8 @@ export class CoreCoursesProvider { /** * Get cache key for get courses WS call. * - * @param {number[]} ids Courses IDs. - * @return {string} Cache key. + * @param ids Courses IDs. + * @return Cache key. */ protected getCoursesCacheKey(ids: number[]): string { return this.ROOT_CACHE_KEY + 'course:' + JSON.stringify(ids); @@ -373,10 +373,10 @@ export class CoreCoursesProvider { * When requesting a single course that belongs to enrolled courses, request all enrolled courses because * the WS call is probably cached. * - * @param {string} [field] The field to search. - * @param {any} [value] The value to match. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise<{field: string, value: any}>} Promise resolved with the field and value to use. + * @param field The field to search. + * @param value The value to match. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with the field and value to use. */ protected fixCoursesByFieldParams(field?: string, value?: any, siteId?: string): Promise<{field: string, value: any}> { @@ -400,15 +400,15 @@ export class CoreCoursesProvider { /** * Get the first course returned by getCoursesByField. * - * @param {string} [field] The field to search. Can be left empty for all courses or: - * id: course id. - * ids: comma separated course ids. - * shortname: course short name. - * idnumber: course id number. - * category: category id the course belongs to. - * @param {any} [value] The value to match. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved with the first course. + * @param field The field to search. Can be left empty for all courses or: + * id: course id. + * ids: comma separated course ids. + * shortname: course short name. + * idnumber: course id number. + * category: category id the course belongs to. + * @param value The value to match. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with the first course. * @since 3.2 */ getCourseByField(field?: string, value?: any, siteId?: string): Promise { @@ -424,15 +424,15 @@ export class CoreCoursesProvider { /** * Get courses. They can be filtered by field. * - * @param {string} [field] The field to search. Can be left empty for all courses or: - * id: course id. - * ids: comma separated course ids. - * shortname: course short name. - * idnumber: course id number. - * category: category id the course belongs to. - * @param {any} [value] The value to match. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved with the courses. + * @param field The field to search. Can be left empty for all courses or: + * id: course id. + * ids: comma separated course ids. + * shortname: course short name. + * idnumber: course id number. + * category: category id the course belongs to. + * @param value The value to match. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with the courses. * @since 3.2 */ getCoursesByField(field?: string, value?: any, siteId?: string): Promise { @@ -503,9 +503,9 @@ export class CoreCoursesProvider { /** * Get cache key for get courses WS call. * - * @param {string} [field] The field to search. - * @param {any} [value] The value to match. - * @return {string} Cache key. + * @param field The field to search. + * @param value The value to match. + * @return Cache key. */ protected getCoursesByFieldCacheKey(field?: string, value?: any): string { field = field || ''; @@ -517,8 +517,8 @@ export class CoreCoursesProvider { /** * Check if get courses by field WS is available in a certain site. * - * @param {CoreSite} [site] Site to check. - * @return {boolean} Whether get courses by field is available. + * @param site Site to check. + * @return Whether get courses by field is available. * @since 3.2 */ isGetCoursesByFieldAvailable(site?: CoreSite): boolean { @@ -530,8 +530,8 @@ export class CoreCoursesProvider { /** * Check if get courses by field WS is available in a certain site, by site ID. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether get courses by field is available. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with boolean: whether get courses by field is available. * @since 3.2 */ isGetCoursesByFieldAvailableInSite(siteId?: string): Promise { @@ -543,9 +543,9 @@ export class CoreCoursesProvider { /** * Get the navigation and administration options for the given courses. * - * @param {number[]} courseIds IDs of courses to get. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise<{navOptions: any, admOptions: any}>} Promise resolved with the options for each course. + * @param courseIds IDs of courses to get. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the options for each course. */ getCoursesAdminAndNavOptions(courseIds: number[], siteId?: string): Promise<{ navOptions: any, admOptions: any }> { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -580,7 +580,7 @@ export class CoreCoursesProvider { /** * Get the common part of the cache keys for user administration options WS calls. * - * @return {string} Cache key. + * @return Cache key. */ protected getUserAdministrationOptionsCommonCacheKey(): string { return this.ROOT_CACHE_KEY + 'administrationOptions:'; @@ -589,8 +589,8 @@ export class CoreCoursesProvider { /** * Get cache key for get user administration options WS call. * - * @param {number[]} courseIds IDs of courses to get. - * @return {string} Cache key. + * @param courseIds IDs of courses to get. + * @return Cache key. */ protected getUserAdministrationOptionsCacheKey(courseIds: number[]): string { return this.getUserAdministrationOptionsCommonCacheKey() + courseIds.join(','); @@ -599,9 +599,9 @@ export class CoreCoursesProvider { /** * Get user administration options for a set of courses. * - * @param {number[]} courseIds IDs of courses to get. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with administration options for each course. + * @param courseIds IDs of courses to get. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with administration options for each course. */ getUserAdministrationOptions(courseIds: number[], siteId?: string): Promise { if (!courseIds || courseIds.length == 0) { @@ -627,8 +627,8 @@ export class CoreCoursesProvider { /** * Get the common part of the cache keys for user navigation options WS calls. * - * @param {number[]} courseIds IDs of courses to get. - * @return {string} Cache key. + * @param courseIds IDs of courses to get. + * @return Cache key. */ protected getUserNavigationOptionsCommonCacheKey(): string { return this.ROOT_CACHE_KEY + 'navigationOptions:'; @@ -637,7 +637,7 @@ export class CoreCoursesProvider { /** * Get cache key for get user navigation options WS call. * - * @return {string} Cache key. + * @return Cache key. */ protected getUserNavigationOptionsCacheKey(courseIds: number[]): string { return this.getUserNavigationOptionsCommonCacheKey() + courseIds.join(','); @@ -646,9 +646,9 @@ export class CoreCoursesProvider { /** * Get user navigation options for a set of courses. * - * @param {number[]} courseIds IDs of courses to get. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with navigation options for each course. + * @param courseIds IDs of courses to get. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with navigation options for each course. */ getUserNavigationOptions(courseIds: number[], siteId?: string): Promise { if (!courseIds || courseIds.length == 0) { @@ -674,8 +674,8 @@ export class CoreCoursesProvider { /** * Format user navigation or administration options. * - * @param {any[]} courses Navigation or administration options for each course. - * @return {any} Formatted options. + * @param courses Navigation or administration options for each course. + * @return Formatted options. */ protected formatUserAdminOrNavOptions(courses: any[]): any { const result = {}; @@ -699,10 +699,10 @@ export class CoreCoursesProvider { * Get a course the user is enrolled in. This function relies on getUserCourses. * preferCache=true will try to speed up the response, but the data returned might not be updated. * - * @param {number} id ID of the course to get. - * @param {boolean} [preferCache] True if shouldn't call WS if data is cached, false otherwise. - * @param {string} [siteId] Site to get the courses from. If not defined, use current site. - * @return {Promise} Promise resolved with the course. + * @param id ID of the course to get. + * @param preferCache True if shouldn't call WS if data is cached, false otherwise. + * @param siteId Site to get the courses from. If not defined, use current site. + * @return Promise resolved with the course. */ getUserCourse(id: number, preferCache?: boolean, siteId?: string): Promise { if (!id) { @@ -725,9 +725,9 @@ export class CoreCoursesProvider { /** * Get user courses. * - * @param {boolean} [preferCache] True if shouldn't call WS if data is cached, false otherwise. - * @param {string} [siteId] Site to get the courses from. If not defined, use current site. - * @return {Promise} Promise resolved with the courses. + * @param preferCache True if shouldn't call WS if data is cached, false otherwise. + * @param siteId Site to get the courses from. If not defined, use current site. + * @return Promise resolved with the courses. */ getUserCourses(preferCache?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -800,7 +800,7 @@ export class CoreCoursesProvider { /** * Get cache key for get user courses WS call. * - * @return {string} Cache key. + * @return Cache key. */ protected getUserCoursesCacheKey(): string { return this.ROOT_CACHE_KEY + 'usercourses'; @@ -809,10 +809,10 @@ export class CoreCoursesProvider { /** * Invalidates get categories WS call. * - * @param {number} categoryId Category ID to get. - * @param {boolean} [addSubcategories] If it should add subcategories to the list. - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param categoryId Category ID to get. + * @param addSubcategories If it should add subcategories to the list. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateCategories(categoryId: number, addSubcategories?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -823,9 +823,9 @@ export class CoreCoursesProvider { /** * Invalidates get course WS call. * - * @param {number} id Course ID. - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param id Course ID. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateCourse(id: number, siteId?: string): Promise { return this.invalidateCourses([id], siteId); @@ -834,9 +834,9 @@ export class CoreCoursesProvider { /** * Invalidates get course enrolment methods WS call. * - * @param {number} id Course ID. - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param id Course ID. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateCourseEnrolmentMethods(id: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -847,9 +847,9 @@ export class CoreCoursesProvider { /** * Invalidates get course guest enrolment info WS call. * - * @param {number} instanceId Guest instance ID. - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param instanceId Guest instance ID. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateCourseGuestEnrolmentInfo(instanceId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -860,9 +860,9 @@ export class CoreCoursesProvider { /** * Invalidates the navigation and administration options for the given courses. * - * @param {number[]} courseIds IDs of courses to get. - * @param {string} [siteId] Site ID to invalidate. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseIds IDs of courses to get. + * @param siteId Site ID to invalidate. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateCoursesAdminAndNavOptions(courseIds: number[], siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -880,9 +880,9 @@ export class CoreCoursesProvider { /** * Invalidates get courses WS call. * - * @param {number[]} ids Courses IDs. - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param ids Courses IDs. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateCourses(ids: number[], siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -893,10 +893,10 @@ export class CoreCoursesProvider { /** * Invalidates get courses by field WS call. * - * @param {string} [field] See getCoursesByField for info. - * @param {any} [value] The value to match. - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param field See getCoursesByField for info. + * @param value The value to match. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateCoursesByField(field?: string, value?: any, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -914,8 +914,8 @@ export class CoreCoursesProvider { /** * Invalidates all user administration options. * - * @param {string} [siteId] Site ID to invalidate. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param siteId Site ID to invalidate. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateUserAdministrationOptions(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -926,9 +926,9 @@ export class CoreCoursesProvider { /** * Invalidates user administration options for certain courses. * - * @param {number[]} courseIds IDs of courses. - * @param {string} [siteId] Site ID to invalidate. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseIds IDs of courses. + * @param siteId Site ID to invalidate. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateUserAdministrationOptionsForCourses(courseIds: number[], siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -939,8 +939,8 @@ export class CoreCoursesProvider { /** * Invalidates get user courses WS call. * - * @param {string} [siteId] Site ID to invalidate. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param siteId Site ID to invalidate. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateUserCourses(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -951,8 +951,8 @@ export class CoreCoursesProvider { /** * Invalidates all user navigation options. * - * @param {string} [siteId] Site ID to invalidate. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param siteId Site ID to invalidate. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateUserNavigationOptions(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -963,9 +963,9 @@ export class CoreCoursesProvider { /** * Invalidates user navigation options for certain courses. * - * @param {number[]} courseIds IDs of courses. - * @param {string} [siteId] Site ID to invalidate. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseIds IDs of courses. + * @param siteId Site ID to invalidate. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateUserNavigationOptionsForCourses(courseIds: number[], siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -976,7 +976,7 @@ export class CoreCoursesProvider { /** * Check if WS to retrieve guest enrolment data is available. * - * @return {boolean} Whether guest WS is available. + * @return Whether guest WS is available. */ isGuestWSAvailable(): boolean { const currentSite = this.sitesProvider.getCurrentSite(); @@ -987,11 +987,11 @@ export class CoreCoursesProvider { /** * Search courses. * - * @param {string} text Text to search. - * @param {number} [page=0] Page to get. - * @param {number} [perPage] Number of courses per page. Defaults to CoreCoursesProvider.SEARCH_PER_PAGE. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise<{total: number, courses: any[]}>} Promise resolved with the courses and the total of matches. + * @param text Text to search. + * @param page Page to get. + * @param perPage Number of courses per page. Defaults to CoreCoursesProvider.SEARCH_PER_PAGE. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with the courses and the total of matches. */ search(text: string, page: number = 0, perPage?: number, siteId?: string): Promise<{ total: number, courses: any[] }> { perPage = perPage || CoreCoursesProvider.SEARCH_PER_PAGE; @@ -1016,12 +1016,12 @@ export class CoreCoursesProvider { /** * Self enrol current user in a certain course. * - * @param {number} courseId Course ID. - * @param {string} [password] Password to use. - * @param {number} [instanceId] Enrol instance ID. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved if the user is enrolled. If the password is invalid, the promise is rejected - * with an object with code = CoreCoursesProvider.ENROL_INVALID_KEY. + * @param courseId Course ID. + * @param password Password to use. + * @param instanceId Enrol instance ID. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved if the user is enrolled. If the password is invalid, the promise is rejected + * with an object with code = CoreCoursesProvider.ENROL_INVALID_KEY. */ selfEnrol(courseId: number, password: string = '', instanceId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1064,10 +1064,10 @@ export class CoreCoursesProvider { /** * Set favourite property on a course. * - * @param {number} courseId Course ID. - * @param {boolean} favourite If favourite or unfavourite. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved when done. + * @param courseId Course ID. + * @param favourite If favourite or unfavourite. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved when done. */ setFavouriteCourse(courseId: number, favourite: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/core/courses/providers/dashboard-link-handler.ts b/src/core/courses/providers/dashboard-link-handler.ts index aaa0d7ab5..32c25891b 100644 --- a/src/core/courses/providers/dashboard-link-handler.ts +++ b/src/core/courses/providers/dashboard-link-handler.ts @@ -33,11 +33,11 @@ export class CoreCoursesDashboardLinkHandler extends CoreContentLinksHandlerBase /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -52,11 +52,11 @@ export class CoreCoursesDashboardLinkHandler extends CoreContentLinksHandlerBase /** * Check if the handler is enabled for a certain site (site + user) and a URL. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return this.mainMenuHandler.isEnabledForSite(siteId); diff --git a/src/core/courses/providers/dashboard.ts b/src/core/courses/providers/dashboard.ts index beb6204d0..ebf5c538b 100644 --- a/src/core/courses/providers/dashboard.ts +++ b/src/core/courses/providers/dashboard.ts @@ -29,8 +29,8 @@ export class CoreCoursesDashboardProvider { /** * Get cache key for dashboard blocks WS calls. * - * @param {number} [userId] User ID. Default, 0 means current user. - * @return {string} Cache key. + * @param userId User ID. Default, 0 means current user. + * @return Cache key. */ protected getDashboardBlocksCacheKey(userId: number = 0): string { return this.ROOT_CACHE_KEY + 'blocks:' + userId; @@ -39,9 +39,9 @@ export class CoreCoursesDashboardProvider { /** * Get dashboard blocks. * - * @param {number} [userId] User ID. Default, current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the list of blocks. + * @param userId User ID. Default, current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of blocks. * @since 3.6 */ getDashboardBlocks(userId?: number, siteId?: string): Promise { @@ -67,9 +67,9 @@ export class CoreCoursesDashboardProvider { /** * Invalidates dashboard blocks WS call. * - * @param {number} [userId] User ID. Default, current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param userId User ID. Default, current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateDashboardBlocks(userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -80,8 +80,8 @@ export class CoreCoursesDashboardProvider { /** * Returns whether or not block based Dashboard is available for a certain site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with true if available, resolved with false or rejected otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if available, resolved with false or rejected otherwise. * @since 3.6 */ isAvailable(siteId?: string): Promise { @@ -98,8 +98,8 @@ export class CoreCoursesDashboardProvider { /** * Check if Site Home is disabled in a certain site. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. */ isDisabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -110,8 +110,8 @@ export class CoreCoursesDashboardProvider { /** * Check if Site Home is disabled in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's disabled. + * @param site Site. If not defined, use current site. + * @return Whether it's disabled. */ isDisabledInSite(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); diff --git a/src/core/courses/providers/enrol-push-click-handler.ts b/src/core/courses/providers/enrol-push-click-handler.ts index 795b0c603..93016330f 100644 --- a/src/core/courses/providers/enrol-push-click-handler.ts +++ b/src/core/courses/providers/enrol-push-click-handler.ts @@ -33,8 +33,8 @@ export class CoreCoursesEnrolPushClickHandler implements CorePushNotificationsCl /** * Check if a notification click is handled by this handler. * - * @param {any} notification The notification to check. - * @return {boolean} Whether the notification click is handled by this handler + * @param notification The notification to check. + * @return Whether the notification click is handled by this handler */ handles(notification: any): boolean | Promise { return this.utils.isTrueOrOne(notification.notif) && notification.moodlecomponent.indexOf('enrol_') === 0 && @@ -44,8 +44,8 @@ export class CoreCoursesEnrolPushClickHandler implements CorePushNotificationsCl /** * Handle the notification click. * - * @param {any} notification The notification to check. - * @return {Promise} Promise resolved when done. + * @param notification The notification to check. + * @return Promise resolved when done. */ handleClick(notification: any): Promise { const courseId = Number(notification.courseid), diff --git a/src/core/courses/providers/helper.ts b/src/core/courses/providers/helper.ts index abd9634fe..7289734d3 100644 --- a/src/core/courses/providers/helper.ts +++ b/src/core/courses/providers/helper.ts @@ -35,8 +35,8 @@ export class CoreCoursesHelperProvider { /** * Get the courses to display the course picker popover. If a courseId is specified, it will also return its categoryId. * - * @param {number} [courseId] Course ID to get the category. - * @return {Promise<{courses: any[], categoryId: number}>} Promise resolved with the list of courses and the category. + * @param courseId Course ID to get the category. + * @return Promise resolved with the list of courses and the category. */ getCoursesForPopover(courseId?: number): Promise<{courses: any[], categoryId: number}> { return this.coursesProvider.getUserCourses(false).then((courses) => { @@ -71,8 +71,8 @@ export class CoreCoursesHelperProvider { * Given a course object returned by core_enrol_get_users_courses and another one returned by core_course_get_courses_by_field, * load some extra data to the first one. * - * @param {any} course Course returned by core_enrol_get_users_courses. - * @param {any} courseByField Course returned by core_course_get_courses_by_field. + * @param course Course returned by core_enrol_get_users_courses. + * @param courseByField Course returned by core_course_get_courses_by_field. */ loadCourseExtraInfo(course: any, courseByField: any): void { if (courseByField) { @@ -93,8 +93,8 @@ export class CoreCoursesHelperProvider { * Given a list of courses returned by core_enrol_get_users_courses, load some extra data using the WebService * core_course_get_courses_by_field if available. * - * @param {any[]} courses List of courses. - * @return {Promise} Promise resolved when done. + * @param courses List of courses. + * @return Promise resolved when done. */ loadCoursesExtraInfo(courses: any[]): Promise { if (courses[0] && typeof courses[0].overviewfiles != 'undefined' && typeof courses[0].displayname != 'undefined') { @@ -128,10 +128,10 @@ export class CoreCoursesHelperProvider { /** * Get user courses with admin and nav options. * - * @param {string} [sort=fullname] Sort courses after get them. If sort is not defined it won't be sorted. - * @param {number} [slice=0] Slice results to get the X first one. If slice > 0 it will be done after sorting. - * @param {string} [filter] Filter using some field. - * @return {Promise} Courses filled with options. + * @param sort Sort courses after get them. If sort is not defined it won't be sorted. + * @param slice Slice results to get the X first one. If slice > 0 it will be done after sorting. + * @param filter Filter using some field. + * @return Courses filled with options. */ getUserCoursesWithOptions(sort: string = 'fullname', slice: number = 0, filter?: string): Promise { return this.coursesProvider.getUserCourses().then((courses) => { @@ -220,10 +220,10 @@ export class CoreCoursesHelperProvider { * Show a context menu to select a course, and return the courseId and categoryId of the selected course (-1 for all courses). * Returns an empty object if popover closed without picking a course. * - * @param {MouseEvent} event Click event. - * @param {any[]} courses List of courses, from CoreCoursesHelperProvider.getCoursesForPopover. - * @param {number} courseId The course to select at start. - * @return {Promise<{courseId?: number, categoryId?: number}>} Promise resolved with the course ID and category ID. + * @param event Click event. + * @param courses List of courses, from CoreCoursesHelperProvider.getCoursesForPopover. + * @param courseId The course to select at start. + * @return Promise resolved with the course ID and category ID. */ selectCourse(event: MouseEvent, courses: any[], courseId: number): Promise<{courseId?: number, categoryId?: number}> { return new Promise((resolve, reject): any => { diff --git a/src/core/courses/providers/mainmenu-handler.ts b/src/core/courses/providers/mainmenu-handler.ts index 4b32ced23..81f5f3e01 100644 --- a/src/core/courses/providers/mainmenu-handler.ts +++ b/src/core/courses/providers/mainmenu-handler.ts @@ -36,7 +36,7 @@ export class CoreDashboardMainMenuHandler implements CoreMainMenuHandler { /** * Check if the handler is enabled on a site level. * - * @return {boolean | Promise} 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 { return this.isEnabledForSite(); @@ -45,8 +45,8 @@ export class CoreDashboardMainMenuHandler implements CoreMainMenuHandler { /** * Check if the handler is enabled on a certain site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean | Promise} Whether or not the handler is enabled on a site level. + * @param siteId Site ID. If not defined, current site. + * @return Whether or not the handler is enabled on a site level. */ isEnabledForSite(siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -92,7 +92,7 @@ export class CoreDashboardMainMenuHandler implements CoreMainMenuHandler { /** * 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 { return { diff --git a/src/core/courses/providers/request-push-click-handler.ts b/src/core/courses/providers/request-push-click-handler.ts index af8688605..4f9246595 100644 --- a/src/core/courses/providers/request-push-click-handler.ts +++ b/src/core/courses/providers/request-push-click-handler.ts @@ -39,8 +39,8 @@ export class CoreCoursesRequestPushClickHandler implements CorePushNotifications /** * Check if a notification click is handled by this handler. * - * @param {any} notification The notification to check. - * @return {boolean} Whether the notification click is handled by this handler + * @param notification The notification to check. + * @return Whether the notification click is handled by this handler */ handles(notification: any): boolean | Promise { // Don't support 'courserequestrejected', that way the app will open the notifications page. @@ -51,8 +51,8 @@ export class CoreCoursesRequestPushClickHandler implements CorePushNotifications /** * Handle the notification click. * - * @param {any} notification The notification to check. - * @return {Promise} Promise resolved when done. + * @param notification The notification to check. + * @return Promise resolved when done. */ handleClick(notification: any): Promise { const courseId = Number(notification.courseid); diff --git a/src/core/emulator/classes/filesystem.ts b/src/core/emulator/classes/filesystem.ts index d750073dc..8aa3333dc 100644 --- a/src/core/emulator/classes/filesystem.ts +++ b/src/core/emulator/classes/filesystem.ts @@ -34,10 +34,10 @@ export class EntryMock { /** * Copy the file or directory. * - * @param {Entry} parent The folder where to move the file to. - * @param {string} newName The new name for the file. - * @param {Function} successCallback Success callback. - * @param {Function} errorCallback Error callback. + * @param parent The folder where to move the file to. + * @param newName The new name for the file. + * @param successCallback Success callback. + * @param errorCallback Error callback. */ copyTo(parent: Entry, newName: string, successCallback: Function, errorCallback: Function): void { newName = newName || this.name; @@ -69,8 +69,8 @@ export class EntryMock { /** * Get the entry's metadata. * - * @param {Function} successCallback Success callback. - * @param {Function} errorCallback Error callback. + * @param successCallback Success callback. + * @param errorCallback Error callback. */ getMetadata(successCallback: Function, errorCallback: Function): void { this.fs.stat(this.fullPath, (err, stats) => { @@ -88,8 +88,8 @@ export class EntryMock { /** * Get the parent directory. * - * @param {Function} successCallback Success callback. - * @param {Function} errorCallback Error callback. + * @param successCallback Success callback. + * @param errorCallback Error callback. */ getParent(successCallback: Function, errorCallback: Function): void { // Remove last slash if present and get the path of the parent. @@ -111,10 +111,10 @@ export class EntryMock { /** * Move the file or directory. * - * @param {Entry} parent The folder where to move the file to. - * @param {string} newName The new name for the file. - * @param {Function} successCallback Success callback. - * @param {Function} errorCallback Error callback. + * @param parent The folder where to move the file to. + * @param newName The new name for the file. + * @param successCallback Success callback. + * @param errorCallback Error callback. */ moveTo(parent: Entry, newName: string, successCallback: Function, errorCallback: Function): void { newName = newName || this.name; @@ -136,8 +136,8 @@ export class EntryMock { /** * Remove the entry. * - * @param {Function} successCallback Success callback. - * @param {Function} errorCallback Error callback. + * @param successCallback Success callback. + * @param errorCallback Error callback. */ remove(successCallback: Function, errorCallback: Function): void { const removeFn = this.isDirectory ? this.fs.rmdir : this.fs.unlink; @@ -153,9 +153,9 @@ export class EntryMock { /** * Set the entry's metadata. * - * @param {Function} successCallback Success callback. - * @param {Function} errorCallback Error callback. - * @param {any} metadataObject The metadata to set. + * @param successCallback Success callback. + * @param errorCallback Error callback. + * @param metadataObject The metadata to set. */ setMetadata(successCallback: Function, errorCallback: Function, metadataObject: any): void { // Not supported. @@ -165,7 +165,7 @@ export class EntryMock { /** * Get the internal URL of the Entry. * - * @return {string} Internal URL. + * @return Internal URL. */ toInternalURL(): string { return 'file://' + this.fullPath; @@ -174,7 +174,7 @@ export class EntryMock { /** * Get the URL of the Entry. * - * @return {string} URL. + * @return URL. */ toURL(): string { return this.fullPath; @@ -203,7 +203,7 @@ export class DirectoryEntryMock extends EntryMock { /** * Create reader. * - * @return {DirectoryReader} Reader. + * @return Reader. */ createReader(): DirectoryReader { return new DirectoryReaderMock(this.textUtils, this.mimeUtils, this.fullPath); @@ -212,9 +212,9 @@ export class DirectoryEntryMock extends EntryMock { /** * Delete an empty folder. * - * @param {string} path Path of the folder. - * @param {Function} successCallback Success callback. - * @param {Function} errorCallback Error callback. + * @param path Path of the folder. + * @param successCallback Success callback. + * @param errorCallback Error callback. */ protected deleteEmptyFolder(path: string, successCallback: Function, errorCallback: Function): void { this.fs.rmdir(path, (err) => { @@ -230,10 +230,10 @@ export class DirectoryEntryMock extends EntryMock { /** * Get a directory inside this directory entry. * - * @param {string} path Path of the dir. - * @param {any} options Options. - * @param {Function} successCallback Success callback. - * @param {Function} errorCallback Error callback. + * @param path Path of the dir. + * @param options Options. + * @param successCallback Success callback. + * @param errorCallback Error callback. */ getDirectory(path: string, options: any, successCallback: Function, errorCallback: Function): void { this.getDirOrFile(true, path, options, successCallback, errorCallback); @@ -242,11 +242,11 @@ export class DirectoryEntryMock extends EntryMock { /** * Helper function for getDirectory and getFile. * - * @param {boolean} isDir True if getting a directory, false if getting a file. - * @param {string} path Path of the file or dir. - * @param {any} options Options. - * @param {Function} successCallback Success callback. - * @param {Function} errorCallback Error callback. + * @param isDir True if getting a directory, false if getting a file. + * @param path Path of the file or dir. + * @param options Options. + * @param successCallback Success callback. + * @param errorCallback Error callback. */ protected getDirOrFile(isDir: boolean, path: string, options: any, successCallback: Function, errorCallback: Function): void { @@ -315,10 +315,10 @@ export class DirectoryEntryMock extends EntryMock { /** * Get a file inside this directory entry. * - * @param {string} path Path of the dir. - * @param {any} options Options. - * @param {Function} successCallback Success callback. - * @param {Function} errorCallback Error callback. + * @param path Path of the dir. + * @param options Options. + * @param successCallback Success callback. + * @param errorCallback Error callback. */ getFile(path: string, options: any, successCallback: Function, errorCallback: Function): void { this.getDirOrFile(false, path, options, successCallback, errorCallback); @@ -327,8 +327,8 @@ export class DirectoryEntryMock extends EntryMock { /** * Remove the directory and all its contents. * - * @param {Function} successCallback Success callback. - * @param {Function} errorCallback Error callback. + * @param successCallback Success callback. + * @param errorCallback Error callback. */ removeRecursively(successCallback: Function, errorCallback: Function): void { // Use a promise to make sure only one callback is called. @@ -344,9 +344,9 @@ export class DirectoryEntryMock extends EntryMock { /** * Delete a file or folder recursively. * - * @param {string} path Path of the folder. - * @param {Function} successCallback Success callback. - * @param {Function} errorCallback Error callback. + * @param path Path of the folder. + * @param successCallback Success callback. + * @param errorCallback Error callback. */ protected removeRecursiveFn(path: string, successCallback: Function, errorCallback: Function): void { // Check if it exists. @@ -415,8 +415,8 @@ export class FileEntryMock extends EntryMock { /** * Create writer. * - * @param {Function} successCallback Success callback. - * @param {Function} errorCallback Error callback. + * @param successCallback Success callback. + * @param errorCallback Error callback. */ createWriter(successCallback: Function, errorCallback: Function): void { this.file((file) => { @@ -427,8 +427,8 @@ export class FileEntryMock extends EntryMock { /** * Get the file data. * - * @param {Function} successCallback Success callback. - * @param {Function} errorCallback Error callback. + * @param successCallback Success callback. + * @param errorCallback Error callback. */ file(successCallback: Function, errorCallback: Function): void { // Get the metadata to know the time modified. @@ -469,8 +469,8 @@ export class DirectoryReaderMock implements DirectoryReader { /** * Read entries inside a folder. * - * @param {Function} successCallback Success callback. - * @param {Function} errorCallback Error callback. + * @param successCallback Success callback. + * @param errorCallback Error callback. */ readEntries(successCallback: Function, errorCallback: Function): void { this.fs.readdir(this.localURL, (err, files) => { @@ -545,8 +545,8 @@ export class FileWriterMock { /** * The file position at which the next write will occur. * - * @param {number} offset If nonnegative, an absolute byte offset into the file. - * If negative, an offset back from the end of the file. + * @param offset If nonnegative, an absolute byte offset into the file. + * If negative, an offset back from the end of the file. */ seek(offset: number): void { this.position = offset; @@ -556,7 +556,7 @@ export class FileWriterMock { * Changes the length of the file to that specified. If shortening the file, data beyond the new length * will be discarded. If extending the file, the existing data will be zero-padded up to the new length. * - * @param {number} size The size to which the length of the file is to be adjusted, measured in bytes. + * @param size The size to which the length of the file is to be adjusted, measured in bytes. */ truncate(size: number): void { this.size = size; @@ -565,7 +565,7 @@ export class FileWriterMock { /** * Write some data into the file. * - * @param {any} data The data to write. + * @param data The data to write. */ write(data: any): void { if (data && data.toString() == '[object Blob]') { @@ -589,7 +589,7 @@ export class FileWriterMock { /** * Write some data into the file. * - * @param {Buffer} data The data to write. + * @param data The data to write. */ protected writeFile(data: Buffer): void { /* Create a write stream so we can specify where to start writing. Node's Writable stream doesn't allow specifying the diff --git a/src/core/emulator/classes/inappbrowserobject.ts b/src/core/emulator/classes/inappbrowserobject.ts index 1f45c7ba1..513061406 100644 --- a/src/core/emulator/classes/inappbrowserobject.ts +++ b/src/core/emulator/classes/inappbrowserobject.ts @@ -109,8 +109,8 @@ export class InAppBrowserObjectMock { /** * Execute a JS script. * - * @param {any} details Details of the script to run, specifying either a file or code key. - * @return {Promise} Promise resolved when done. + * @param details Details of the script to run, specifying either a file or code key. + * @return Promise resolved when done. */ executeScript(details: any): Promise { return new Promise((resolve, reject): void => { @@ -129,8 +129,8 @@ export class InAppBrowserObjectMock { /** * Recursive function to get the launch URL from the contents of a BrowserWindow. * - * @param {number} [retry=0] Retry number. - * @return {Promise} Promise resolved with the launch URL. + * @param retry Retry number. + * @return Promise resolved with the launch URL. */ protected getLaunchUrl(retry: number = 0): Promise { @@ -172,8 +172,8 @@ export class InAppBrowserObjectMock { /** * Insert CSS. * - * @param {any} details Details of the CSS to insert, specifying either a file or code key. - * @return {Promise} Promise resolved when done. + * @param details Details of the CSS to insert, specifying either a file or code key. + * @return Promise resolved when done. */ insertCSS(details: any): Promise { return new Promise((resolve, reject): void => { @@ -194,9 +194,9 @@ export class InAppBrowserObjectMock { /** * Listen to events happening. * - * @param {string} name Name of the event. - * @return {Observable} Observable that will listen to the event on subscribe, and will stop listening - * to the event on unsubscribe. + * @param name Name of the event. + * @return Observable that will listen to the event on subscribe, and will stop listening + * to the event on unsubscribe. */ on(name: string): Observable { // Create the observable. diff --git a/src/core/emulator/classes/sqlitedb.ts b/src/core/emulator/classes/sqlitedb.ts index 5aedfcfe3..fd39efa59 100644 --- a/src/core/emulator/classes/sqlitedb.ts +++ b/src/core/emulator/classes/sqlitedb.ts @@ -25,7 +25,7 @@ export class SQLiteDBMock extends SQLiteDB { /** * Create and open the database. * - * @param {string} name Database name. + * @param name Database name. */ constructor(public name: string) { super(name, null, null); @@ -34,7 +34,7 @@ export class SQLiteDBMock extends SQLiteDB { /** * Close the database. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ close(): Promise { // WebSQL databases aren't closed. @@ -44,7 +44,7 @@ export class SQLiteDBMock extends SQLiteDB { /** * Drop all the data in the database. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ emptyDatabase(): Promise { return new Promise((resolve, reject): void => { @@ -84,9 +84,9 @@ export class SQLiteDBMock extends SQLiteDB { * IMPORTANT: Use this function only if you cannot use any of the other functions in this API. Please take into account that * these query will be run in SQLite (Mobile) and Web SQL (desktop), so your query should work in both environments. * - * @param {string} sql SQL query to execute. - * @param {any[]} params Query parameters. - * @return {Promise} Promise resolved with the result. + * @param sql SQL query to execute. + * @param params Query parameters. + * @return Promise resolved with the result. */ execute(sql: string, params?: any[]): Promise { return new Promise((resolve, reject): void => { @@ -107,8 +107,8 @@ export class SQLiteDBMock extends SQLiteDB { * IMPORTANT: Use this function only if you cannot use any of the other functions in this API. Please take into account that * these query will be run in SQLite (Mobile) and Web SQL (desktop), so your query should work in both environments. * - * @param {any[]} sqlStatements SQL statements to execute. - * @return {Promise} Promise resolved with the result. + * @param sqlStatements SQL statements to execute. + * @return Promise resolved with the result. */ executeBatch(sqlStatements: any[]): Promise { return new Promise((resolve, reject): void => { @@ -156,7 +156,7 @@ export class SQLiteDBMock extends SQLiteDB { /** * Open the database. Only needed if it was closed before, a database is automatically opened when created. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ open(): Promise { // WebSQL databases can't closed, so the open method isn't needed. diff --git a/src/core/emulator/pages/capture-media/capture-media.ts b/src/core/emulator/pages/capture-media/capture-media.ts index 360183441..5c9377569 100644 --- a/src/core/emulator/pages/capture-media/capture-media.ts +++ b/src/core/emulator/pages/capture-media/capture-media.ts @@ -157,7 +157,7 @@ export class CoreEmulatorCaptureMediaPage implements OnInit, OnDestroy { * Initialize the audio drawer. This code has been extracted from MDN's example on MediaStream Recording: * https://github.com/mdn/web-dictaphone * - * @param {MediaStream} stream Stream returned by getUserMedia. + * @param stream Stream returned by getUserMedia. */ protected initAudioDrawer(stream: MediaStream): void { let skip = true, @@ -318,7 +318,7 @@ export class CoreEmulatorCaptureMediaPage implements OnInit, OnDestroy { /** * Close the modal, returning some data (success). * - * @param {any} data Data to return. + * @param data Data to return. */ dismissWithData(data: any): void { this.viewCtrl.dismiss(data, 'success'); @@ -327,9 +327,9 @@ export class CoreEmulatorCaptureMediaPage implements OnInit, OnDestroy { /** * Close the modal, returning an error. * - * @param {number} code Error code. Will not be used if it's a Camera capture. - * @param {string} message Error message. - * @param {string} [cameraMessage] A specific message to use if it's a Camera capture. If not set, message will be used. + * @param code Error code. Will not be used if it's a Camera capture. + * @param message Error message. + * @param cameraMessage A specific message to use if it's a Camera capture. If not set, message will be used. */ dismissWithError(code: number, message: string, cameraMessage?: string): void { const isCamera = this.isImage && !this.isCaptureImage, diff --git a/src/core/emulator/providers/badge.ts b/src/core/emulator/providers/badge.ts index 713ef67a1..f3d843c9f 100644 --- a/src/core/emulator/providers/badge.ts +++ b/src/core/emulator/providers/badge.ts @@ -26,8 +26,6 @@ export class BadgeMock implements Badge { /** * Clear the badge of the app icon. - * - * @returns {Promise} */ clear(): Promise { return Promise.reject('clear is only supported in mobile devices'); @@ -35,8 +33,7 @@ export class BadgeMock implements Badge { /** * Set the badge of the app icon. - * @param {number} badgeNumber The new badge number. - * @returns {Promise} + * @param badgeNumber The new badge number. */ set(badgeNumber: number): Promise { if (!this.appProvider.isDesktop()) { @@ -57,8 +54,6 @@ export class BadgeMock implements Badge { /** * Get the badge of the app icon. - * - * @returns {Promise} */ get(): Promise { if (!this.appProvider.isDesktop()) { @@ -77,8 +72,7 @@ export class BadgeMock implements Badge { /** * Increase the badge number. * - * @param {number} increaseBy Count to add to the current badge number - * @returns {Promise} + * @param increaseBy Count to add to the current badge number */ increase(increaseBy: number): Promise { return Promise.reject('increase is only supported in mobile devices'); @@ -87,8 +81,7 @@ export class BadgeMock implements Badge { /** * Decrease the badge number. * - * @param {number} decreaseBy Count to subtract from the current badge number - * @returns {Promise} + * @param decreaseBy Count to subtract from the current badge number */ decrease(decreaseBy: number): Promise { return Promise.reject('decrease is only supported in mobile devices'); @@ -96,8 +89,6 @@ export class BadgeMock implements Badge { /** * Check support to show badges. - * - * @returns {Promise} */ isSupported(): Promise { return Promise.reject('isSupported is only supported in mobile devices'); @@ -105,8 +96,6 @@ export class BadgeMock implements Badge { /** * Determine if the app has permission to show badges. - * - * @returns {Promise} */ hasPermission(): Promise { return Promise.reject('hasPermission is only supported in mobile devices'); @@ -114,8 +103,6 @@ export class BadgeMock implements Badge { /** * Register permission to set badge notifications - * - * @returns {Promise} */ requestPermission(): Promise { return Promise.reject('requestPermission is only supported in mobile devices'); diff --git a/src/core/emulator/providers/camera.ts b/src/core/emulator/providers/camera.ts index 323b6d7fe..4fe7eaa00 100644 --- a/src/core/emulator/providers/camera.ts +++ b/src/core/emulator/providers/camera.ts @@ -29,7 +29,7 @@ export class CameraMock extends Camera { /** * Remove intermediate image files that are kept in temporary storage after calling camera.getPicture. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ cleanup(): Promise { // This function is iOS only, nothing to do. @@ -39,8 +39,8 @@ export class CameraMock extends Camera { /** * Take a picture. * - * @param {CameraOptions} options Options that you want to pass to the camera. - * @return {Promise} Promise resolved when captured. + * @param options Options that you want to pass to the camera. + * @return Promise resolved when captured. */ getPicture(options: CameraOptions): Promise { return this.captureHelper.captureMedia('image', options); diff --git a/src/core/emulator/providers/capture-helper.ts b/src/core/emulator/providers/capture-helper.ts index cf66fbf92..33d174d09 100644 --- a/src/core/emulator/providers/capture-helper.ts +++ b/src/core/emulator/providers/capture-helper.ts @@ -44,9 +44,9 @@ export class CoreEmulatorCaptureHelperProvider { /** * Capture media (image, audio, video). * - * @param {string} type Type of media: image, audio, video. - * @param {any} [options] Optional options. - * @return {Promise} Promise resolved when captured, rejected if error. + * @param type Type of media: image, audio, video. + * @param options Optional options. + * @return Promise resolved when captured, rejected if error. */ captureMedia(type: string, options: any): Promise { options = options || {}; @@ -118,9 +118,9 @@ export class CoreEmulatorCaptureHelperProvider { /** * Get the mimetype and extension to capture media. * - * @param {string} type Type of media: image, audio, video. - * @param {string[]} [mimetypes] List of supported mimetypes. If undefined, all mimetypes supported. - * @return {{extension: string, mimetype: string}} An object with mimetype and extension to use. + * @param type Type of media: image, audio, video. + * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. + * @return An object with mimetype and extension to use. */ protected getMimeTypeAndExtension(type: string, mimetypes: string[]): { extension: string, mimetype: string } { const result: any = {}; @@ -157,7 +157,7 @@ export class CoreEmulatorCaptureHelperProvider { /** * Init the getUserMedia function, using a deprecated function as fallback if the new one doesn't exist. * - * @return {boolean} Whether the function is supported. + * @return Whether the function is supported. */ protected initGetUserMedia(): boolean { const nav = navigator; @@ -209,7 +209,7 @@ export class CoreEmulatorCaptureHelperProvider { /** * Load the Mocks that need it. * - * @return {Promise} Promise resolved when loaded. + * @return Promise resolved when loaded. */ load(): Promise { if (typeof this.win.MediaRecorder != 'undefined' && this.initGetUserMedia()) { diff --git a/src/core/emulator/providers/clipboard.ts b/src/core/emulator/providers/clipboard.ts index 40390a883..bf3a8e081 100644 --- a/src/core/emulator/providers/clipboard.ts +++ b/src/core/emulator/providers/clipboard.ts @@ -43,8 +43,8 @@ export class ClipboardMock extends Clipboard { /** * Copy some text to the clipboard. * - * @param {string} text The text to copy. - * @return {Promise} Promise resolved when copied. + * @param text The text to copy. + * @return Promise resolved when copied. */ copy(text: string): Promise { return new Promise((resolve, reject): void => { @@ -74,7 +74,7 @@ export class ClipboardMock extends Clipboard { /* * Get the text stored in the clipboard. * - * @return {Promise} Promise resolved with the text. + * @return Promise resolved with the text. */ paste(): Promise { return new Promise((resolve, reject): void => { diff --git a/src/core/emulator/providers/file-opener.ts b/src/core/emulator/providers/file-opener.ts index e5ae16579..d739950c5 100644 --- a/src/core/emulator/providers/file-opener.ts +++ b/src/core/emulator/providers/file-opener.ts @@ -29,8 +29,8 @@ export class FileOpenerMock extends FileOpener { /** * Check if an app is already installed. * - * @param {string} packageId Package ID. - * @returns {Promise} Promise resolved when done. + * @param packageId Package ID. + * @return Promise resolved when done. */ appIsInstalled(packageId: string): Promise { return Promise.reject('appIsInstalled not supported in browser or dekstop.'); @@ -39,9 +39,9 @@ export class FileOpenerMock extends FileOpener { /** * Open an file. * - * @param {string} filePath File path. - * @param {string} fileMIMEType File MIME type. - * @returns {Promise} Promise resolved when done. + * @param filePath File path. + * @param fileMIMEType File MIME type. + * @return Promise resolved when done. */ open(filePath: string, fileMIMEType: string): Promise { if (this.appProvider.isDesktop()) { @@ -61,8 +61,8 @@ export class FileOpenerMock extends FileOpener { /** * Uninstalls a package. * - * @param {string} packageId Package ID. - * @returns {Promise} Promise resolved when done. + * @param packageId Package ID. + * @return Promise resolved when done. */ uninstall(packageId: string): Promise { return Promise.reject('uninstall not supported in browser or dekstop.'); diff --git a/src/core/emulator/providers/file-transfer.ts b/src/core/emulator/providers/file-transfer.ts index f8ab362c9..c3b250c9c 100644 --- a/src/core/emulator/providers/file-transfer.ts +++ b/src/core/emulator/providers/file-transfer.ts @@ -44,8 +44,6 @@ export class FileTransferMock extends FileTransfer { /** * Creates a new FileTransferObjectMock object. - * - * @return {FileTransferObjectMock} */ create(): FileTransferObjectMock { return new FileTransferObjectMock(this.appProvider, this.fileProvider); @@ -80,11 +78,11 @@ export class FileTransferObjectMock extends FileTransferObject { /** * Downloads a file from server. * - * @param {string} source URL of the server to download the file, as encoded by encodeURI(). - * @param {string} target Filesystem url representing the file on the device. - * @param {boolean} [trustAllHosts] If set to true, it accepts all security certificates. - * @param {object} [options] Optional parameters, currently only supports headers. - * @returns {Promise} Returns a Promise that resolves to a FileEntry object. + * @param source URL of the server to download the file, as encoded by encodeURI(). + * @param target Filesystem url representing the file on the device. + * @param trustAllHosts If set to true, it accepts all security certificates. + * @param options Optional parameters, currently only supports headers. + * @return Returns a Promise that resolves to a FileEntry object. */ download(source: string, target: string, trustAllHosts?: boolean, options?: { [s: string]: any; }): Promise { return new Promise((resolve, reject): void => { @@ -165,8 +163,8 @@ export class FileTransferObjectMock extends FileTransferObject { * Given a URL, check if it has a credentials in it and, if so, return them in a header object. * This code is extracted from Cordova FileTransfer plugin. * - * @param {string} urlString The URL to get the credentials from. - * @return {any} The header with the credentials, null if no credentials. + * @param urlString The URL to get the credentials from. + * @return The header with the credentials, null if no credentials. */ protected getBasicAuthHeader(urlString: string): any { let header = null; @@ -191,8 +189,8 @@ export class FileTransferObjectMock extends FileTransferObject { /** * Given an instance of XMLHttpRequest, get the response headers as an object. * - * @param {XMLHttpRequest} xhr XMLHttpRequest instance. - * @return {{[s: string]: any}} Object with the headers. + * @param xhr XMLHttpRequest instance. + * @return Object with the headers. */ protected getHeadersAsObject(xhr: XMLHttpRequest): { [s: string]: any } { const headersString = xhr.getAllResponseHeaders(), @@ -216,8 +214,8 @@ export class FileTransferObjectMock extends FileTransferObject { * Get the credentials from a URL. * This code is extracted from Cordova FileTransfer plugin. * - * @param {string} urlString The URL to get the credentials from. - * @return {string} Retrieved credentials. + * @param urlString The URL to get the credentials from. + * @return Retrieved credentials. */ protected getUrlCredentials(urlString: string): string { const credentialsPattern = /^https?\:\/\/(?:(?:(([^:@\/]*)(?::([^@\/]*))?)?@)?([^:\/?#]*)(?::(\d*))?).*$/, @@ -229,7 +227,7 @@ export class FileTransferObjectMock extends FileTransferObject { /** * Registers a listener that gets called whenever a new chunk of data is transferred. * - * @param {Function} listener Listener that takes a progress event. + * @param listener Listener that takes a progress event. */ onProgress(listener: (event: ProgressEvent) => any): void { this.progressListener = listener; @@ -238,8 +236,8 @@ export class FileTransferObjectMock extends FileTransferObject { /** * Same as Javascript's JSON.parse, but it will handle errors. * - * @param {string} json JSON text. - * @return {any} JSON parsed as object or what it gets. + * @param json JSON text. + * @return JSON parsed as object or what it gets. */ protected parseJSON(json: string): any { try { @@ -254,8 +252,8 @@ export class FileTransferObjectMock extends FileTransferObject { /** * Parse a response, converting it into text and the into an object if needed. * - * @param {any} response The response to parse. - * @return {Promise} Promise resolved with the parsed response. + * @param response The response to parse. + * @return Promise resolved with the parsed response. */ protected parseResponse(response: any): Promise { return new Promise((resolve, reject): void => { @@ -283,11 +281,11 @@ export class FileTransferObjectMock extends FileTransferObject { /** * Sends a file to a server. * - * @param {string} fileUrl Filesystem URL representing the file on the device or a data URI. - * @param {string} url URL of the server to receive the file, as encoded by encodeURI(). - * @param {FileUploadOptions} [options] Optional parameters. - * @param {boolean} [trustAllHosts] If set to true, it accepts all security certificates. - * @returns {Promise} Promise that resolves to a FileUploadResult and rejects with FileTransferError. + * @param fileUrl Filesystem URL representing the file on the device or a data URI. + * @param url URL of the server to receive the file, as encoded by encodeURI(). + * @param options Optional parameters. + * @param trustAllHosts If set to true, it accepts all security certificates. + * @return Promise that resolves to a FileUploadResult and rejects with FileTransferError. */ upload(fileUrl: string, url: string, options?: FileUploadOptions, trustAllHosts?: boolean): Promise { return new Promise((resolve, reject): void => { diff --git a/src/core/emulator/providers/file.ts b/src/core/emulator/providers/file.ts index 891d983be..46c1b89e9 100644 --- a/src/core/emulator/providers/file.ts +++ b/src/core/emulator/providers/file.ts @@ -35,9 +35,9 @@ export class FileMock extends File { /** * Check if a directory exists in a certain path, directory. * - * @param {string} path Base FileSystem. - * @param {string} dir Name of directory to check - * @returns {Promise} Returns a Promise that resolves to true if the directory exists or rejects with an error. + * @param path Base FileSystem. + * @param dir Name of directory to check + * @return Returns a Promise that resolves to true if the directory exists or rejects with an error. */ checkDir(path: string, dir: string): Promise { const fullPath = this.textUtils.concatenatePaths(path, dir); @@ -50,9 +50,9 @@ export class FileMock extends File { /** * Check if a file exists in a certain path, directory. * - * @param {string} path Base FileSystem. - * @param {string} file Name of file to check. - * @returns {Promise} Returns a Promise that resolves with a boolean or rejects with an error. + * @param path Base FileSystem. + * @param file Name of file to check. + * @return Returns a Promise that resolves with a boolean or rejects with an error. */ checkFile(path: string, file: string): Promise { return this.resolveLocalFilesystemUrl(this.textUtils.concatenatePaths(path, file)).then((fse) => { @@ -70,10 +70,10 @@ export class FileMock extends File { /** * Copy a file or directory. * - * @param {Entry} srce The Entry to copy. - * @param {DirectoryEntry} destDir The directory where to put the copy. - * @param {string} newName New name of the file/dir. - * @returns {Promise} Returns a Promise that resolves to the new Entry object or rejects with an error. + * @param srce The Entry to copy. + * @param destDir The directory where to put the copy. + * @param newName New name of the file/dir. + * @return Returns a Promise that resolves to the new Entry object or rejects with an error. */ private copyMock(srce: Entry, destDir: DirectoryEntry, newName: string): Promise { return new Promise((resolve, reject): void => { @@ -91,11 +91,11 @@ export class FileMock extends File { /** * Copy a directory in various methods. If destination directory exists, will fail to copy. * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above. - * @param {string} dirName Name of directory to copy. - * @param {string} newPath Base FileSystem of new location. - * @param {string} newDirName New name of directory to copy to (leave blank to remain the same). - * @returns {Promise} Returns a Promise that resolves to the new Entry object or rejects with an error. + * @param path Base FileSystem. Please refer to the iOS and Android filesystems above. + * @param dirName Name of directory to copy. + * @param newPath Base FileSystem of new location. + * @param newDirName New name of directory to copy to (leave blank to remain the same). + * @return Returns a Promise that resolves to the new Entry object or rejects with an error. */ copyDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { return this.resolveDirectoryUrl(path).then((fse) => { @@ -110,11 +110,11 @@ export class FileMock extends File { /** * Copy a file in various methods. If file exists, will fail to copy. * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above - * @param {string} fileName Name of file to copy - * @param {string} newPath Base FileSystem of new location - * @param {string} newFileName New name of file to copy to (leave blank to remain the same) - * @returns {Promise} Returns a Promise that resolves to an Entry or rejects with an error. + * @param path Base FileSystem. Please refer to the iOS and Android filesystems above + * @param fileName Name of file to copy + * @param newPath Base FileSystem of new location + * @param newFileName New name of file to copy to (leave blank to remain the same) + * @return Returns a Promise that resolves to an Entry or rejects with an error. */ copyFile(path: string, fileName: string, newPath: string, newFileName: string): Promise { newFileName = newFileName || fileName; @@ -133,10 +133,10 @@ export class FileMock extends File { * The replace boolean value determines whether to replace an existing directory with the same name. * If an existing directory exists and the replace value is false, the promise will fail and return an error. * - * @param {string} path Base FileSystem. - * @param {string} dirName Name of directory to create - * @param {boolean} replace If true, replaces file with same name. If false returns error - * @returns {Promise} Returns a Promise that resolves with a DirectoryEntry or rejects with an error. + * @param path Base FileSystem. + * @param dirName Name of directory to create + * @param replace If true, replaces file with same name. If false returns error + * @return Returns a Promise that resolves with a DirectoryEntry or rejects with an error. */ createDir(path: string, dirName: string, replace: boolean): Promise { const options: any = { @@ -157,10 +157,10 @@ export class FileMock extends File { * The replace boolean value determines whether to replace an existing file with the same name. * If an existing file exists and the replace value is false, the promise will fail and return an error. * - * @param {string} path Base FileSystem. - * @param {string} fileName Name of file to create. - * @param {boolean} replace If true, replaces file with same name. If false returns error. - * @returns {Promise} Returns a Promise that resolves to a FileEntry or rejects with an error. + * @param path Base FileSystem. + * @param fileName Name of file to create. + * @param replace If true, replaces file with same name. If false returns error. + * @return Returns a Promise that resolves to a FileEntry or rejects with an error. */ createFile(path: string, fileName: string, replace: boolean): Promise { const options: any = { @@ -179,8 +179,8 @@ export class FileMock extends File { /** * Create a file writer for a certain file. * - * @param {FileEntry} fe File entry object. - * @returns {Promise} Promise resolved with the FileWriter. + * @param fe File entry object. + * @return Promise resolved with the FileWriter. */ private createWriterMock(fe: FileEntry): Promise { return new Promise((resolve, reject): void => { @@ -197,7 +197,7 @@ export class FileMock extends File { * Emulate Cordova file plugin using NodeJS functions. This is only for NodeJS environments, * browser works with the default resolveLocalFileSystemURL. * - * @param {any} fs Node module 'fs'. + * @param fs Node module 'fs'. */ protected emulateCordovaFileForDesktop(fs: any): void { if (!this.appProvider.isDesktop()) { @@ -224,7 +224,7 @@ export class FileMock extends File { /** * Fill the message for an error. * - * @param {any} err Error. + * @param err Error. */ private fillErrorMessageMock(err: any): void { try { @@ -237,10 +237,9 @@ export class FileMock extends File { /** * Get a directory. * - * @param directoryEntry {DirectoryEntry} Directory entry, obtained by resolveDirectoryUrl method - * @param directoryName {string} Directory name - * @param flags {Flags} Options - * @returns {Promise} + * @param directoryEntry Directory entry, obtained by resolveDirectoryUrl method + * @param directoryName Directory name + * @param flags Options */ getDirectory(directoryEntry: DirectoryEntry, directoryName: string, flags: Flags): Promise { return new Promise((resolve, reject): void => { @@ -262,10 +261,9 @@ export class FileMock extends File { /** * Get a file - * @param directoryEntry {DirectoryEntry} Directory entry, obtained by resolveDirectoryUrl method - * @param fileName {string} File name - * @param flags {Flags} Options - * @returns {Promise} + * @param directoryEntry Directory entry, obtained by resolveDirectoryUrl method + * @param fileName File name + * @param flags Options */ getFile(directoryEntry: DirectoryEntry, fileName: string, flags: Flags): Promise { return new Promise((resolve, reject): void => { @@ -286,7 +284,7 @@ export class FileMock extends File { /** * Get free disk space. * - * @return {Promise} Promise resolved with the free space. + * @return Promise resolved with the free space. */ getFreeDiskSpace(): Promise { // FRequest a file system instance with a minimum size until we get an error. @@ -329,9 +327,9 @@ export class FileMock extends File { /** * List files and directory from a given path. * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above - * @param {string} dirName Name of directory - * @returns {Promise} Returns a Promise that resolves to an array of Entry objects or rejects with an error. + * @param path Base FileSystem. Please refer to the iOS and Android filesystems above + * @param dirName Name of directory + * @return Returns a Promise that resolves to an array of Entry objects or rejects with an error. */ listDir(path: string, dirName: string): Promise { return this.resolveDirectoryUrl(path).then((fse) => { @@ -346,7 +344,7 @@ export class FileMock extends File { /** * Loads an initialize the API for browser and desktop. * - * @return {Promise} Promise resolved when loaded. + * @return Promise resolved when loaded. */ load(): Promise { return new Promise((resolve, reject): void => { @@ -404,10 +402,10 @@ export class FileMock extends File { /** * Move a file or directory. * - * @param {Entry} srce The Entry to copy. - * @param {DirectoryEntry} destDir The directory where to move the file/dir. - * @param {string} newName New name of the file/dir. - * @returns {Promise} Returns a Promise that resolves to the new Entry object or rejects with an error. + * @param srce The Entry to copy. + * @param destDir The directory where to move the file/dir. + * @param newName New name of the file/dir. + * @return Returns a Promise that resolves to the new Entry object or rejects with an error. */ private moveMock(srce: Entry, destDir: DirectoryEntry, newName: string): Promise { return new Promise((resolve, reject): void => { @@ -425,12 +423,12 @@ export class FileMock extends File { /** * Move a directory to a given path. * - * @param {string} path The source path to the directory. - * @param {string} dirName The source directory name. - * @param {string} newPath The destionation path to the directory. - * @param {string} newDirName The destination directory name. - * @returns {Promise} Returns a Promise that resolves to the new DirectoryEntry object or rejects with - * an error. + * @param path The source path to the directory. + * @param dirName The source directory name. + * @param newPath The destionation path to the directory. + * @param newDirName The destination directory name. + * @return Returns a Promise that resolves to the new DirectoryEntry object or rejects with + * an error. */ moveDir(path: string, dirName: string, newPath: string, newDirName: string): Promise { return this.resolveDirectoryUrl(path).then((fse) => { @@ -445,11 +443,11 @@ export class FileMock extends File { /** * Move a file to a given path. * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above - * @param {string} fileName Name of file to move - * @param {string} newPath Base FileSystem of new location - * @param {string} newFileName New name of file to move to (leave blank to remain the same) - * @returns {Promise} Returns a Promise that resolves to the new Entry or rejects with an error. + * @param path Base FileSystem. Please refer to the iOS and Android filesystems above + * @param fileName Name of file to move + * @param newPath Base FileSystem of new location + * @param newFileName New name of file to move to (leave blank to remain the same) + * @return Returns a Promise that resolves to the new Entry or rejects with an error. */ moveFile(path: string, fileName: string, newPath: string, newFileName: string): Promise { newFileName = newFileName || fileName; @@ -465,10 +463,10 @@ export class FileMock extends File { /** * Read file and return data as an ArrayBuffer. - * @param {string} path Base FileSystem. - * @param {string} file Name of file, relative to path. - * @returns {Promise} Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects - * with an error. + * @param path Base FileSystem. + * @param file Name of file, relative to path. + * @return Returns a Promise that resolves with the contents of the file as ArrayBuffer or rejects + * with an error. */ readAsArrayBuffer(path: string, file: string): Promise { return this.readFileMock(path, file, 'ArrayBuffer'); @@ -476,9 +474,9 @@ export class FileMock extends File { /** * Read file and return data as a binary data. - * @param {string} path Base FileSystem. - * @param {string} file Name of file, relative to path. - * @returns {Promise} Returns a Promise that resolves with the contents of the file as string rejects with an error. + * @param path Base FileSystem. + * @param file Name of file, relative to path. + * @return Returns a Promise that resolves with the contents of the file as string rejects with an error. */ readAsBinaryString(path: string, file: string): Promise { return this.readFileMock(path, file, 'BinaryString'); @@ -488,10 +486,10 @@ export class FileMock extends File { * Read file and return data as a base64 encoded data url. * A data url is of the form: * data: [][;base64], - * @param {string} path Base FileSystem. - * @param {string} file Name of file, relative to path. - * @returns {Promise} Returns a Promise that resolves with the contents of the file as data URL or rejects - * with an error. + * @param path Base FileSystem. + * @param file Name of file, relative to path. + * @return Returns a Promise that resolves with the contents of the file as data URL or rejects + * with an error. */ readAsDataURL(path: string, file: string): Promise { return this.readFileMock(path, file, 'DataURL'); @@ -500,9 +498,9 @@ export class FileMock extends File { /** * Read the contents of a file as text. * - * @param {string} path Base FileSystem. - * @param {string} file Name of file, relative to path. - * @returns {Promise} Returns a Promise that resolves with the contents of the file as string or rejects with an error. + * @param path Base FileSystem. + * @param file Name of file, relative to path. + * @return Returns a Promise that resolves with the contents of the file as string or rejects with an error. */ readAsText(path: string, file: string): Promise { return this.readFileMock(path, file, 'Text'); @@ -511,8 +509,8 @@ export class FileMock extends File { /** * Read all the files and directories inside a directory. * - * @param {DirectoryReader} dr The directory reader. - * @return {Promise} Promise resolved with the list of files/dirs. + * @param dr The directory reader. + * @return Promise resolved with the list of files/dirs. */ private readEntriesMock(dr: DirectoryReader): Promise { return new Promise((resolve, reject): void => { @@ -528,10 +526,10 @@ export class FileMock extends File { /** * Read the contents of a file. * - * @param {string} path Base FileSystem. - * @param {string} file Name of file, relative to path. - * @param {string} readAs Format to read as. - * @returns {Promise} Returns a Promise that resolves with the contents of the file or rejects with an error. + * @param path Base FileSystem. + * @param file Name of file, relative to path. + * @param readAs Format to read as. + * @return Returns a Promise that resolves with the contents of the file or rejects with an error. */ private readFileMock(path: string, file: string, readAs: 'ArrayBuffer' | 'BinaryString' | 'DataURL' | 'Text'): Promise { return this.resolveDirectoryUrl(path).then((directoryEntry: DirectoryEntry) => { @@ -562,8 +560,8 @@ export class FileMock extends File { /** * Delete a file. * - * @param {Entry} fe The file to remove. - * @return {Promise} Promise resolved when done. + * @param fe The file to remove. + * @return Promise resolved when done. */ private removeMock(fe: Entry): Promise { return new Promise((resolve, reject): void => { @@ -579,9 +577,9 @@ export class FileMock extends File { /** * Remove a directory at a given path. * - * @param {string} path The path to the directory. - * @param {string} dirName The directory name. - * @returns {Promise} Returns a Promise that resolves to a RemoveResult or rejects with an error. + * @param path The path to the directory. + * @param dirName The directory name. + * @return Returns a Promise that resolves to a RemoveResult or rejects with an error. */ removeDir(path: string, dirName: string): Promise { return this.resolveDirectoryUrl(path).then((fse) => { @@ -594,9 +592,9 @@ export class FileMock extends File { /** * Removes a file from a desired location. * - * @param {string} path Base FileSystem. - * @param {string} fileName Name of file to remove. - * @returns {Promise} Returns a Promise that resolves to a RemoveResult or rejects with an error. + * @param path Base FileSystem. + * @param fileName Name of file to remove. + * @return Returns a Promise that resolves to a RemoveResult or rejects with an error. */ removeFile(path: string, fileName: string): Promise { return this.resolveDirectoryUrl(path).then((fse) => { @@ -609,9 +607,9 @@ export class FileMock extends File { /** * Removes all files and the directory from a desired location. * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above - * @param {string} dirName Name of directory - * @returns {Promise} Returns a Promise that resolves with a RemoveResult or rejects with an error. + * @param path Base FileSystem. Please refer to the iOS and Android filesystems above + * @param dirName Name of directory + * @return Returns a Promise that resolves with a RemoveResult or rejects with an error. */ removeRecursively(path: string, dirName: string): Promise { return this.resolveDirectoryUrl(path).then((fse) => { @@ -623,8 +621,7 @@ export class FileMock extends File { /** * Resolves a local directory url - * @param directoryUrl {string} directory system url - * @returns {Promise} + * @param directoryUrl directory system url */ resolveDirectoryUrl(directoryUrl: string): Promise { return this.resolveLocalFilesystemUrl(directoryUrl).then((de) => { @@ -641,8 +638,7 @@ export class FileMock extends File { /** * Resolves a local file system URL - * @param fileUrl {string} file system url - * @returns {Promise} + * @param fileUrl file system url */ resolveLocalFilesystemUrl(fileUrl: string): Promise { return new Promise((resolve, reject): void => { @@ -663,8 +659,8 @@ export class FileMock extends File { /** * Remove a directory and all its contents. * - * @param {DirectoryEntry} de Directory to remove. - * @return {Promise} Promise resolved when done. + * @param de Directory to remove. + * @return Promise resolved when done. */ private rimrafMock(de: DirectoryEntry): Promise { return new Promise((resolve, reject): void => { @@ -680,9 +676,9 @@ export class FileMock extends File { /** * Write some data in a file. * - * @param {FileWriter} writer File writer. - * @param {any} data The data to write. - * @return {Promise} Promise resolved when done. + * @param writer File writer. + * @param data The data to write. + * @return Promise resolved when done. */ private writeMock(writer: FileWriter, data: any): Promise { if (data instanceof Blob) { @@ -704,10 +700,10 @@ export class FileMock extends File { /** * Write to an existing file. * - * @param {string} path Base FileSystem. - * @param {string} fileName path relative to base path. - * @param {string | Blob} text content or blob to write. - * @returns {Promise} Returns a Promise that resolves or rejects with an error. + * @param path Base FileSystem. + * @param fileName path relative to base path. + * @param text content or blob to write. + * @return Returns a Promise that resolves or rejects with an error. */ writeExistingFile(path: string, fileName: string, text: string | Blob): Promise { return this.writeFile(path, fileName, text, { replace: true }); @@ -716,11 +712,11 @@ export class FileMock extends File { /** * Write a new file to the desired location. * - * @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above - * @param {string} fileName path relative to base path - * @param {string | Blob} text content or blob to write - * @param {any} options replace file if set to true. See WriteOptions for more information. - * @returns {Promise} Returns a Promise that resolves to updated file entry or rejects with an error. + * @param path Base FileSystem. Please refer to the iOS and Android filesystems above + * @param fileName path relative to base path + * @param text content or blob to write + * @param options replace file if set to true. See WriteOptions for more information. + * @return Returns a Promise that resolves to updated file entry or rejects with an error. */ writeFile(path: string, fileName: string, text: string | Blob | ArrayBuffer, options: IWriteOptions = {}): Promise { const getFileOpts: any = { @@ -738,10 +734,10 @@ export class FileMock extends File { /** * Write content to FileEntry. * - * @param {FileEntry} fe File entry object. - * @param {string | Blob} text Content or blob to write. - * @param {IWriteOptions} options replace file if set to true. See WriteOptions for more information. - * @returns {Promise} Returns a Promise that resolves to updated file entry or rejects with an error. + * @param fe File entry object. + * @param text Content or blob to write. + * @param options replace file if set to true. See WriteOptions for more information. + * @return Returns a Promise that resolves to updated file entry or rejects with an error. */ private writeFileEntryMock(fe: FileEntry, text: string | Blob | ArrayBuffer, options: IWriteOptions): Promise { return this.createWriterMock(fe).then((writer) => { @@ -760,9 +756,9 @@ export class FileMock extends File { /** * Write a file in chunks. * - * @param {FileWriter} writer File writer. - * @param {Blob} data Data to write. - * @return {Promise} Promise resolved when done. + * @param writer File writer. + * @param data Data to write. + * @return Promise resolved when done. */ private writeFileInChunksMock(writer: FileWriter, data: Blob): Promise { let writtenSize = 0; diff --git a/src/core/emulator/providers/globalization.ts b/src/core/emulator/providers/globalization.ts index 9cd70aa17..c5b902c54 100644 --- a/src/core/emulator/providers/globalization.ts +++ b/src/core/emulator/providers/globalization.ts @@ -41,9 +41,9 @@ export class GlobalizationMock extends Globalization { /** * Converts date to string. * - * @param {Date} date Date you wish to convert + * @param date Date you wish to convert * @param options Options for the converted date. Length, selector. - * @returns {Promise<{value: string}>} Returns a promise when the date has been converted. + * @return Returns a promise when the date has been converted. */ dateToString(date: Date, options: GlobalizationOptions): Promise<{ value: string; }> { return Promise.reject(new GlobalizationErrorMock(GlobalizationErrorMock.UNKNOWN_ERROR, 'Not supported.')); @@ -53,8 +53,7 @@ export class GlobalizationMock extends Globalization { * Returns a pattern string to format and parse currency values according to the client's user preferences and ISO 4217 * currency code. * - * @param {string} currencyCode Currency Code. - * @returns {Promise} + * @param currencyCode Currency Code. */ getCurrencyPattern(currencyCode: string): Promise { return Promise.reject(new GlobalizationErrorMock(GlobalizationErrorMock.UNKNOWN_ERROR, 'Not supported.')); @@ -63,7 +62,7 @@ export class GlobalizationMock extends Globalization { /** * Get the current locale. * - * @return {string} Locale name. + * @return Locale name. */ private getCurrentlocale(): string { // Get browser language. @@ -85,7 +84,7 @@ export class GlobalizationMock extends Globalization { * Returns an array of the names of the months or days of the week, depending on the client's user preferences and calendar. * * @param options Object with type (narrow or wide) and item (month or days). - * @returns {Promise<{value: Array}>} Returns a promise. + * @return Returns a promise. */ getDateNames(options: { type: string; item: string; }): Promise<{ value: Array; }> { return Promise.reject(new GlobalizationErrorMock(GlobalizationErrorMock.UNKNOWN_ERROR, 'Not supported.')); @@ -95,7 +94,7 @@ export class GlobalizationMock extends Globalization { * Returns a pattern string to format and parse dates according to the client's user preferences. * * @param options Object with the format length and selector - * @returns {Promise} Returns a promise. + * @return Returns a promise. */ getDatePattern(options: GlobalizationOptions): Promise { return Promise.reject(new GlobalizationErrorMock(GlobalizationErrorMock.UNKNOWN_ERROR, 'Not supported.')); @@ -104,7 +103,7 @@ export class GlobalizationMock extends Globalization { /** * Returns the first day of the week according to the client's user preferences and calendar. * - * @returns {Promise<{value: string}>} returns a promise with the value + * @return returns a promise with the value */ getFirstDayOfWeek(): Promise<{ value: string; }> { return Promise.reject(new GlobalizationErrorMock(GlobalizationErrorMock.UNKNOWN_ERROR, 'Not supported.')); @@ -113,7 +112,7 @@ export class GlobalizationMock extends Globalization { /** * Get the current locale name. * - * @return {Promise<{value: string}>} Promise resolved with an object with the language string. + * @return Promise resolved with an object with the language string. */ getLocaleName(): Promise<{ value: string }> { const locale = this.getCurrentlocale(); @@ -129,7 +128,6 @@ export class GlobalizationMock extends Globalization { /** * Returns a pattern string to format and parse numbers according to the client's user preferences. * @param options Can be decimal, percent, or currency. - * @returns {Promise} */ getNumberPattern(options: { type: string; }): Promise { return Promise.reject(new GlobalizationErrorMock(GlobalizationErrorMock.UNKNOWN_ERROR, 'Not supported.')); @@ -138,7 +136,7 @@ export class GlobalizationMock extends Globalization { /* * Get the current preferred language. * - * @return {Promise<{value: string}>} Promise resolved with an object with the language string. + * @return Promise resolved with an object with the language string. */ getPreferredLanguage(): Promise<{ value: string }> { return this.getLocaleName(); @@ -147,8 +145,8 @@ export class GlobalizationMock extends Globalization { /** * Indicates whether daylight savings time is in effect for a given date using the client's time zone and calendar. * - * @param {data} date Date to process. - * @returns {Promise<{dst: string}>} reutrns a promise with the value + * @param date Date to process. + * @return reutrns a promise with the value */ isDayLightSavingsTime(date: Date): Promise<{ dst: string; }> { return Promise.reject(new GlobalizationErrorMock(GlobalizationErrorMock.UNKNOWN_ERROR, 'Not supported.')); @@ -156,8 +154,8 @@ export class GlobalizationMock extends Globalization { /** * Returns a number formatted as a string according to the client's user preferences. - * @param numberToConvert {Number} The number to convert - * @param options {Object} Object with property `type` that can be set to: decimal, percent, or currency. + * @param numberToConvert The number to convert + * @param options Object with property `type` that can be set to: decimal, percent, or currency. */ numberToString(numberToConvert: number, options: { type: string; }): Promise<{ value: string; }> { return Promise.reject(new GlobalizationErrorMock(GlobalizationErrorMock.UNKNOWN_ERROR, 'Not supported.')); @@ -167,9 +165,9 @@ export class GlobalizationMock extends Globalization { * Parses a date formatted as a string, according to the client's user preferences and calendar using the time zone of the * client, and returns the corresponding date object. * - * @param {string} dateString Date as a string to be converted + * @param dateString Date as a string to be converted * @param options Options for the converted date. Length, selector. - * @returns {Promise} Returns a promise when the date has been converted. + * @return Returns a promise when the date has been converted. */ stringToDate(dateString: string, options: GlobalizationOptions): Promise { return Promise.reject(new GlobalizationErrorMock(GlobalizationErrorMock.UNKNOWN_ERROR, 'Not supported.')); @@ -177,10 +175,10 @@ export class GlobalizationMock extends Globalization { /** * - * @param {string} stringToConvert String you want to conver to a number. + * @param stringToConvert String you want to conver to a number. * * @param options The type of number you want to return. Can be decimal, percent, or currency. - * @returns {Promise<{ value: number | string }>} Returns a promise with the value. + * @return Returns a promise with the value. */ stringToNumber(stringToConvert: string, options: { type: string; }): Promise<{ value: number | string; }> { return Promise.reject(new GlobalizationErrorMock(GlobalizationErrorMock.UNKNOWN_ERROR, 'Not supported.')); diff --git a/src/core/emulator/providers/helper.ts b/src/core/emulator/providers/helper.ts index fc64ed0eb..f389d3458 100644 --- a/src/core/emulator/providers/helper.ts +++ b/src/core/emulator/providers/helper.ts @@ -76,7 +76,7 @@ export class CoreEmulatorHelperProvider implements CoreInitHandler { /** * Load the Mocks that need it. * - * @return {Promise} Promise resolved when loaded. + * @return Promise resolved when loaded. */ load(): Promise { const promises = []; @@ -96,11 +96,11 @@ export class CoreEmulatorHelperProvider implements CoreInitHandler { * Check if there are new notifications, triggering a local notification if found. * Only for desktop apps since they don't support push notifications. * - * @param {string} component Component to check. - * @param {Function} fetchFn Function that receives a site ID and returns a Promise resolved with an array of notifications. - * @param {Function} getDataFn Function that receives a notification and returns a promise resolved with the title and text. - * @param {string} [siteId] Site ID to check. If not defined, check all sites. - * @return {Promise} Promise resolved when done. + * @param component Component to check. + * @param fetchFn Function that receives a site ID and returns a Promise resolved with an array of notifications. + * @param getDataFn Function that receives a notification and returns a promise resolved with the title and text. + * @param siteId Site ID to check. If not defined, check all sites. + * @return Promise resolved when done. */ checkNewNotifications(component: string, fetchFn: Function, getDataFn: Function, siteId?: string): Promise { if (!this.appProvider.isDesktop() || !this.localNotifProvider.isAvailable()) { @@ -134,11 +134,11 @@ export class CoreEmulatorHelperProvider implements CoreInitHandler { /** * Check if there are new notifications for a certain site, triggering a local notification if found. * - * @param {string} component Component to check. - * @param {Function} fetchFn Function that receives a site ID and returns a Promise resolved with an array of notifications. - * @param {Function} getDataFn Function that receives a notification and returns a promise resolved with the title and text. - * @param {string} siteId Site ID to check. - * @return {Promise} Promise resolved when done. + * @param component Component to check. + * @param fetchFn Function that receives a site ID and returns a Promise resolved with an array of notifications. + * @param getDataFn Function that receives a notification and returns a promise resolved with the title and text. + * @param siteId Site ID to check. + * @return Promise resolved when done. */ protected checkNewNotificationsForSite(component: string, fetchFn: Function, getDataFn: Function, siteId: string) : Promise { @@ -181,9 +181,9 @@ export class CoreEmulatorHelperProvider implements CoreInitHandler { /** * Get the last notification received in a certain site for a certain component. * - * @param {string} component Component of the notification to get. - * @param {string} siteId Site ID of the notification. - * @return {Promise} Promise resolved with the notification or false if not found. + * @param component Component of the notification to get. + * @param siteId Site ID of the notification. + * @return Promise resolved with the notification or false if not found. */ getLastReceivedNotification(component: string, siteId: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -196,10 +196,10 @@ export class CoreEmulatorHelperProvider implements CoreInitHandler { /** * Store the last notification received in a certain site. * - * @param {string} component Component of the notification to store. - * @param {any} notification Notification to store. - * @param {string} siteId Site ID of the notification. - * @return {Promise} Promise resolved when done. + * @param component Component of the notification to store. + * @param notification Notification to store. + * @param siteId Site ID of the notification. + * @return Promise resolved when done. */ storeLastReceivedNotification(component: string, notification: any, siteId: string): Promise { if (!notification) { diff --git a/src/core/emulator/providers/inappbrowser.ts b/src/core/emulator/providers/inappbrowser.ts index e991e6a90..3c151cebb 100644 --- a/src/core/emulator/providers/inappbrowser.ts +++ b/src/core/emulator/providers/inappbrowser.ts @@ -33,10 +33,10 @@ export class InAppBrowserMock extends InAppBrowser { /** * Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser. * - * @param {string} url The URL to load. - * @param {string} [target] The target in which to load the URL, an optional parameter that defaults to _self. - * @param {string} [options] Options for the InAppBrowser. - * @return {any} The new instance. + * @param url The URL to load. + * @param target The target in which to load the URL, an optional parameter that defaults to _self. + * @param options Options for the InAppBrowser. + * @return The new instance. */ create(url: string, target?: string, options: string = 'location=yes'): any { if (options && typeof options !== 'string') { diff --git a/src/core/emulator/providers/local-notifications.ts b/src/core/emulator/providers/local-notifications.ts index 73d6ebfc4..e8f506255 100644 --- a/src/core/emulator/providers/local-notifications.ts +++ b/src/core/emulator/providers/local-notifications.ts @@ -135,9 +135,8 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Adds a group of actions. * - * @param {any} groupId The id of the action group - * @param {ILocalNotificationAction[]} actions The actions of this group - * @returns {Promise} + * @param groupId The id of the action group + * @param actions The actions of this group */ addActions(groupId: any, actions: ILocalNotificationAction[]): Promise { return Promise.reject('Not supported in desktop apps.'); @@ -146,8 +145,8 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Cancels single or multiple notifications. * - * @param {any} notificationId A single notification id, or an array of notification ids. - * @returns {Promise} Returns a promise when the notification is canceled + * @param notificationId A single notification id, or an array of notification ids. + * @return Returns a promise when the notification is canceled */ cancel(notificationId: any): Promise { const promises = []; @@ -168,7 +167,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Cancels all notifications. * - * @returns {Promise} Returns a promise when all notifications are canceled. + * @return Returns a promise when all notifications are canceled. */ cancelAll(): Promise { return this.cancel(Object.keys(this.scheduled)).then(() => { @@ -183,10 +182,9 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Cancel a local notification. * - * @param {number} id Notification ID. - * @param {boolean} omitEvent If true, the clear/cancel event won't be triggered. - * @param {string} eventName Name of the event to trigger. - * @return {Void} + * @param id Notification ID. + * @param omitEvent If true, the clear/cancel event won't be triggered. + * @param eventName Name of the event to trigger. */ protected cancelNotification(id: number, omitEvent: boolean, eventName: string): void { if (!this.scheduled[id]) { @@ -210,8 +208,8 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Clears single or multiple notifications. * - * @param {any} notificationId A single notification id, or an array of notification ids. - * @returns {Promise} Returns a promise when the notification had been cleared. + * @param notificationId A single notification id, or an array of notification ids. + * @return Returns a promise when the notification had been cleared. */ clear(notificationId: any): Promise { const promises = []; @@ -233,7 +231,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Clears all notifications. * - * @returns {Promise} Returns a promise when all notifications have cleared + * @return Returns a promise when all notifications have cleared */ clearAll(): Promise { return this.clear(Object.keys(this.scheduled)).then(() => { @@ -249,8 +247,8 @@ export class LocalNotificationsMock extends LocalNotifications { * Convert a list of IDs to numbers. * Code extracted from the Cordova plugin. * - * @param {any[]} ids List of IDs. - * @return {number[]} List of IDs as numbers. + * @param ids List of IDs. + * @return List of IDs as numbers. */ protected convertIds(ids: any[]): number[] { const convertedIds = []; @@ -266,8 +264,8 @@ export class LocalNotificationsMock extends LocalNotifications { * Convert the notification options to their required type. * Code extracted from the Cordova plugin. * - * @param {ILocalNotification} notification Notification. - * @return {ILocalNotification} Converted notification. + * @param notification Notification. + * @return Converted notification. */ protected convertProperties(notification: ILocalNotification): ILocalNotification { if (notification.id) { @@ -306,9 +304,9 @@ export class LocalNotificationsMock extends LocalNotifications { * Parse a property to number, returning the default value if not valid. * Code extracted from the Cordova plugin. * - * @param {string} prop Name of property to convert. - * @param {any} notification Notification where to search the property. - * @return {number} Converted number or default value. + * @param prop Name of property to convert. + * @param notification Notification where to search the property. + * @return Converted number or default value. */ protected parseToInt(prop: string, notification: any): number { if (isNaN(notification[prop])) { @@ -322,8 +320,8 @@ export class LocalNotificationsMock extends LocalNotifications { * Convert the priority of a notification. * Code extracted from the Cordova plugin. * - * @param {any} notification Notification. - * @return {any} Notification. + * @param notification Notification. + * @return Notification. */ protected convertPriority(notification: any): any { let prio = notification.priority || notification.prio || 0; @@ -349,8 +347,8 @@ export class LocalNotificationsMock extends LocalNotifications { * Convert the actions of a notification. * Code extracted from the Cordova plugin. * - * @param {any} notification Notification. - * @return {any} Notification. + * @param notification Notification. + * @return Notification. */ protected convertActions(notification: any): any { const actions = []; @@ -381,8 +379,8 @@ export class LocalNotificationsMock extends LocalNotifications { * Convert the trigger of a notification. * Code extracted from the Cordova plugin. * - * @param {any} notification Notification. - * @return {any} Notification. + * @param notification Notification. + * @return Notification. */ protected convertTrigger(notification: any): any { const trigger = notification.trigger || {}; @@ -461,8 +459,8 @@ export class LocalNotificationsMock extends LocalNotifications { * Convert the progress bar of a notification. * Code extracted from the Cordova plugin. * - * @param {any} notification Notification. - * @return {any} Notification. + * @param notification Notification. + * @return Notification. */ protected convertProgressBar(notification: any): any { let cfg = notification.progressBar; @@ -493,9 +491,9 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Not an official interface, however its possible to manually fire events. * - * @param {string} eventName The name of the event. Available events: schedule, trigger, click, update, clear, clearall, cancel, + * @param eventName The name of the event. Available events: schedule, trigger, click, update, clear, clearall, cancel, * cancelall. Custom event names are possible for actions - * @param {any} args Optional arguments + * @param args Optional arguments */ fireEvent(eventName: string, args: any): void { if (this.observers[eventName]) { @@ -505,8 +503,6 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Fire queued events once the device is ready and all listeners are registered. - * - * @returns {Promise} */ fireQueuedEvents(): Promise { return Promise.resolve(); @@ -515,8 +511,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Get a notification object. * - * @param {any} notificationId The id of the notification to get. - * @returns {Promise} + * @param notificationId The id of the notification to get. */ get(notificationId: any): Promise { return Promise.resolve(this.getNotifications([Number(notificationId)], true, true)[0]); @@ -524,8 +519,6 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Get all notification objects. - * - * @returns {Promise>} */ getAll(): Promise> { return Promise.resolve(this.getNotifications(undefined, true, true)); @@ -534,7 +527,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Gets the (platform specific) default settings. * - * @returns {Promise} An object with all default settings + * @return An object with all default settings */ getDefaults(): Promise { return Promise.resolve(this.defaults); @@ -542,8 +535,6 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Get all the notification ids. - * - * @returns {Promise>} */ getIds(): Promise> { let ids = this.utils.mergeArraysWithoutDuplicates(Object.keys(this.scheduled), Object.keys(this.triggered)); @@ -557,7 +548,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Get all the notification stored in local DB. * - * @return {Promise} Promise resolved with the notifications. + * @return Promise resolved with the notifications. */ protected getAllNotifications(): Promise { return this.appDB.getAllRecords(this.DESKTOP_NOTIFS_TABLE).then((notifications) => { @@ -577,8 +568,6 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Get all scheduled notification objects. - * - * @returns {Promise>} */ getScheduled(): Promise> { return Promise.resolve(this.getNotifications(undefined, true, false)); @@ -586,8 +575,6 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Get all triggered notification objects. - * - * @returns {Promise>} */ getTriggered(): Promise> { return Promise.resolve(this.getNotifications(undefined, false, true)); @@ -596,10 +583,10 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Get a set of notifications. If ids isn't specified, return all the notifications. * - * @param {number[]} [ids] Ids of notifications to get. If not specified, get all notifications. - * @param {boolean} [getScheduled] Get scheduled notifications. - * @param {boolean} [getTriggered] Get triggered notifications. - * @return {ILocalNotification[]} List of notifications. + * @param ids Ids of notifications to get. If not specified, get all notifications. + * @param getScheduled Get scheduled notifications. + * @param getTriggered Get triggered notifications. + * @return List of notifications. */ protected getNotifications(ids?: number[], getScheduled?: boolean, getTriggered?: boolean): ILocalNotification[] { const notifications = []; @@ -626,8 +613,8 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Get the trigger "at" in milliseconds. * - * @param {ILocalNotification} notification Notification to get the trigger from. - * @return {number} Trigger time. + * @param notification Notification to get the trigger from. + * @return Trigger time. */ protected getNotificationTriggerAt(notification: ILocalNotification): number { const triggerAt = (notification.trigger && notification.trigger.at) || new Date(); @@ -642,7 +629,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Get the ids of scheduled notifications. * - * @returns {Promise>} Returns a promise + * @return Returns a promise */ getScheduledIds(): Promise> { const ids = Object.keys(this.scheduled).map((id) => { @@ -654,8 +641,6 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Get the ids of triggered notifications. - * - * @returns {Promise>} */ getTriggeredIds(): Promise> { const ids = Object.keys(this.triggered).map((id) => { @@ -668,8 +653,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Get the type (triggered, scheduled) for the notification. * - * @param {number} id The ID of the notification. - * @return {Promise} + * @param id The ID of the notification. */ getType(id: number): Promise { if (this.scheduled[id]) { @@ -685,9 +669,9 @@ export class LocalNotificationsMock extends LocalNotifications { * Given an object of options and a list of properties, return the first property that exists. * Code extracted from the Cordova plugin. * - * @param {ILocalNotification} notification Notification. - * @param {any[]} ...args List of keys to check. - * @return {any} First value found. + * @param notification Notification. + * @param ...args List of keys to check. + * @return First value found. */ protected getValueFor(notification: ILocalNotification, ...args: any[]): any { for (const i in args) { @@ -701,8 +685,8 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Checks if a group of actions is defined. * - * @param {any} groupId The id of the action group - * @returns {Promise} Whether the group is defined. + * @param groupId The id of the action group + * @return Whether the group is defined. */ hasActions(groupId: any): Promise { return Promise.resolve(false); @@ -710,8 +694,6 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Informs if the app has the permission to show notifications. - * - * @returns {Promise} */ hasPermission(): Promise { return Promise.resolve(true); @@ -720,9 +702,9 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Check if a notification has a given type. * - * @param {number} id The ID of the notification. - * @param {string} type The type of the notification. - * @returns {Promise} Promise resolved with boolean: whether it has the type. + * @param id The ID of the notification. + * @param type The type of the notification. + * @return Promise resolved with boolean: whether it has the type. */ hasType(id: number, type: string): Promise { return this.getType(id).then((notifType) => { @@ -733,8 +715,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Checks presence of a notification. * - * @param {number} notificationId Notification ID. - * @returns {Promise} + * @param notificationId Notification ID. */ isPresent(notificationId: number): Promise { return Promise.resolve(!!this.scheduled[notificationId] || !!this.triggered[notificationId]); @@ -743,8 +724,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Checks is a notification is scheduled. * - * @param {number} notificationId Notification ID. - * @returns {Promise} + * @param notificationId Notification ID. */ isScheduled(notificationId: number): Promise { return Promise.resolve(!!this.scheduled[notificationId]); @@ -752,8 +732,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Checks if a notification is triggered. * - * @param {number} notificationId Notification ID. - * @returns {Promise} + * @param notificationId Notification ID. */ isTriggered(notificationId: number): Promise { return Promise.resolve(!!this.triggered[notificationId]); @@ -762,7 +741,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Loads an initialize the API for desktop. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ load(): Promise { if (!this.appProvider.isDesktop()) { @@ -805,8 +784,8 @@ export class LocalNotificationsMock extends LocalNotifications { * Merge notification options with default values. * Code extracted from the Cordova plugin. * - * @param {ILocalNotification} notification Notification. - * @return {ILocalNotification} Treated notification. + * @param notification Notification. + * @return Treated notification. */ protected mergeWithDefaults(notification: ILocalNotification): ILocalNotification { const values = this.getDefaults(); @@ -835,7 +814,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Function called when a notification is clicked. * - * @param {ILocalNotification} notification Clicked notification. + * @param notification Clicked notification. */ protected notificationClicked(notification: ILocalNotification): void { this.fireEvent('click', notification); @@ -846,9 +825,9 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Sets a callback for a specific event. * - * @param {string} eventName The name of the event. Events: schedule, trigger, click, update, clear, clearall, cancel, - * cancelall. Custom event names are possible for actions. - * @return {Observable} Observable + * @param eventName The name of the event. Events: schedule, trigger, click, update, clear, clearall, cancel, + * cancelall. Custom event names are possible for actions. + * @return Observable */ on(eventName: string): Observable { return this.observers[eventName]; @@ -857,8 +836,8 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Parse a interval and convert it to a number of milliseconds (0 if not valid). * - * @param {string} every Interval to convert. - * @return {number} Number of milliseconds of the interval- + * @param every Interval to convert. + * @return Number of milliseconds of the interval- */ protected parseInterval(every: string): number { let interval; @@ -898,8 +877,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Removes a group of actions. * - * @param {any} groupId The id of the action group - * @returns {Promise} + * @param groupId The id of the action group */ removeActions(groupId: any): Promise { return Promise.reject('Not supported in desktop apps.'); @@ -908,8 +886,8 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Remove a notification from local DB. * - * @param {number} id ID of the notification. - * @return {Promise} Promise resolved when done. + * @param id ID of the notification. + * @return Promise resolved when done. */ protected removeNotification(id: number): Promise { return this.appDB.deleteRecords(this.DESKTOP_NOTIFS_TABLE, { id: id }); @@ -917,8 +895,6 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Request permission to show notifications if not already granted. - * - * @returns {Promise} */ requestPermission(): Promise { return Promise.resolve(true); @@ -927,7 +903,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Schedules a single or multiple notifications. * - * @param {ILocalNotification | Array} [options] Notification or notifications. + * @param options Notification or notifications. */ schedule(options?: ILocalNotification | Array): void { this.scheduleOrUpdate(options); @@ -938,8 +914,8 @@ export class LocalNotificationsMock extends LocalNotifications { * We only support using the "at" property to trigger the notification. Other properties like "in" or "every" * aren't supported yet. * - * @param {ILocalNotification | Array} [options] Notification or notifications. - * @param {string} [eventName] Name of the event: schedule or update. + * @param options Notification or notifications. + * @param eventName Name of the event: schedule or update. */ protected scheduleOrUpdate(options?: ILocalNotification | Array, eventName: string = 'schedule'): void { options = Array.isArray(options) ? options : [options]; @@ -988,8 +964,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Overwrites the (platform specific) default settings. * - * @param {any} defaults The defaults to set. - * @returns {Promise} + * @param defaults The defaults to set. */ setDefaults(defaults: any): Promise { this.defaults = defaults; @@ -1000,9 +975,9 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Store a notification in local DB. * - * @param {ILocalNotification} notification Notification to store. - * @param {boolean} triggered Whether the notification has been triggered. - * @return {Promise} Promise resolved when stored. + * @param notification Notification to store. + * @param triggered Whether the notification has been triggered. + * @return Promise resolved when stored. */ protected storeNotification(notification: ILocalNotification, triggered: boolean): Promise { // Only store some of the properties. @@ -1021,7 +996,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Trigger a notification, using the best method depending on the OS. * - * @param {ILocalNotification} notification Notification to trigger. + * @param notification Notification to trigger. */ protected triggerNotification(notification: ILocalNotification): void { if (this.winNotif) { @@ -1070,7 +1045,7 @@ export class LocalNotificationsMock extends LocalNotifications { /** * Updates a previously scheduled notification. Must include the id in the options parameter. * - * @param {ILocalNotification} [options] Notification. + * @param options Notification. */ update(options?: ILocalNotification): void { return this.scheduleOrUpdate(options, 'update'); diff --git a/src/core/emulator/providers/media-capture.ts b/src/core/emulator/providers/media-capture.ts index 568cd4beb..9abd354d2 100644 --- a/src/core/emulator/providers/media-capture.ts +++ b/src/core/emulator/providers/media-capture.ts @@ -29,8 +29,8 @@ export class MediaCaptureMock extends MediaCapture { /** * Start the audio recorder application and return information about captured audio clip files. * - * @param {CaptureAudioOptions} options Options. - * @return {Promise} Promise resolved when captured. + * @param options Options. + * @return Promise resolved when captured. */ captureAudio(options: CaptureAudioOptions): Promise { return this.captureHelper.captureMedia('audio', options); @@ -39,8 +39,8 @@ export class MediaCaptureMock extends MediaCapture { /** * Start the camera application and return information about captured image files. * - * @param {CaptureImageOptions} options Options. - * @return {Promise} Promise resolved when captured. + * @param options Options. + * @return Promise resolved when captured. */ captureImage(options: CaptureImageOptions): Promise { return this.captureHelper.captureMedia('captureimage', options); @@ -49,8 +49,8 @@ export class MediaCaptureMock extends MediaCapture { /** * Start the video recorder application and return information about captured video clip files. * - * @param {CaptureVideoOptions} options Options. - * @return {Promise} Promise resolved when captured. + * @param options Options. + * @return Promise resolved when captured. */ captureVideo(options: CaptureVideoOptions): Promise { return this.captureHelper.captureMedia('video', options); diff --git a/src/core/emulator/providers/network.ts b/src/core/emulator/providers/network.ts index 39f8b91c0..df4c523f4 100644 --- a/src/core/emulator/providers/network.ts +++ b/src/core/emulator/providers/network.ts @@ -41,7 +41,7 @@ export class NetworkMock extends Network { /** * Returns an observable to watch connection changes. * - * @return {Observable} Observable. + * @return Observable. */ onchange(): Observable { return Observable.merge(this.onConnect(), this.onDisconnect()); @@ -50,7 +50,7 @@ export class NetworkMock extends Network { /** * Returns an observable to notify when the app is connected. * - * @return {Observable} Observable. + * @return Observable. */ onConnect(): Observable { const observable = new Subject(); @@ -65,7 +65,7 @@ export class NetworkMock extends Network { /** * Returns an observable to notify when the app is disconnected. * - * @return {Observable} Observable. + * @return Observable. */ onDisconnect(): Observable { const observable = new Subject(); diff --git a/src/core/emulator/providers/push.ts b/src/core/emulator/providers/push.ts index e801b01bf..6ae083d5f 100644 --- a/src/core/emulator/providers/push.ts +++ b/src/core/emulator/providers/push.ts @@ -29,8 +29,7 @@ export class PushMock implements Push { /** * Init push notifications * - * @param {PushOptions} options - * @return {PushObject} + * @param options */ init(options: PushOptions): PushObject { return new PushObjectMock(this.appProvider); @@ -39,8 +38,8 @@ export class PushMock implements Push { /** * Check whether the push notification permission has been granted. * - * @return {Promise<{isEnabled: boolean}>} Returns a Promise that resolves with an object with one property: isEnabled, a - * boolean that indicates if permission has been granted. + * @return Returns a Promise that resolves with an object with one property: isEnabled, a + * boolean that indicates if permission has been granted. */ hasPermission(): Promise<{isEnabled: boolean}> { return Promise.reject('hasPermission is only supported in mobile devices'); @@ -49,7 +48,7 @@ export class PushMock implements Push { /** * Create a new notification channel for Android O and above. * - * @param {Channel} channel + * @param channel */ createChannel(channel?: Channel): Promise { return Promise.reject('createChannel is only supported in mobile devices'); @@ -58,7 +57,7 @@ export class PushMock implements Push { /** * Delete a notification channel for Android O and above. * - * @param {string} id + * @param id */ deleteChannel(id?: string): Promise { return Promise.reject('deleteChannel is only supported in mobile devices'); @@ -66,8 +65,6 @@ export class PushMock implements Push { /** * Returns a list of currently configured channels. - * - * @return {Promise} */ listChannels(): Promise { return Promise.reject('listChannels is only supported in mobile devices'); @@ -85,8 +82,7 @@ export class PushObjectMock extends PushObject { /** * Adds an event listener - * @param event {string} - * @return {Observable} + * @param event */ on(event: PushEvent): Observable { return Observable.empty(); @@ -164,8 +160,7 @@ export class PushObjectMock extends PushObject { /** * The subscribe method is used when the application wants to subscribe a new topic to receive push notifications. - * @param topic {string} Topic to subscribe to. - * @return {Promise} + * @param topic Topic to subscribe to. */ subscribe(topic: string): Promise { return Promise.reject('subscribe is only supported in mobile devices'); @@ -175,8 +170,7 @@ export class PushObjectMock extends PushObject { * The unsubscribe method is used when the application no longer wants to receive push notifications from a specific topic but * continue to receive other push messages. * - * @param topic {string} Topic to unsubscribe from. - * @return {Promise} + * @param topic Topic to unsubscribe from. */ unsubscribe(topic: string): Promise { return Promise.reject('unsubscribe is only supported in mobile devices'); diff --git a/src/core/emulator/providers/zip.ts b/src/core/emulator/providers/zip.ts index f7d93f4c1..ae5fdc204 100644 --- a/src/core/emulator/providers/zip.ts +++ b/src/core/emulator/providers/zip.ts @@ -31,9 +31,9 @@ export class ZipMock extends Zip { /** * Create a directory. It creates all the foldes in dirPath 1 by 1 to prevent errors. * - * @param {string} destination Destination parent folder. - * @param {string} dirPath Relative path to the folder. - * @return {Promise} Promise resolved when done. + * @param destination Destination parent folder. + * @param dirPath Relative path to the folder. + * @return Promise resolved when done. */ protected createDir(destination: string, dirPath: string): Promise { // Create all the folders 1 by 1 in order, otherwise it fails. @@ -57,10 +57,10 @@ export class ZipMock extends Zip { /** * Extracts files from a ZIP archive. * - * @param {string} source Path to the source ZIP file. - * @param {string} destination Destination folder. - * @param {Function} [onProgress] Optional callback to be called on progress update - * @return {Promise} Promise that resolves with a number. 0 is success, -1 is error. + * @param source Path to the source ZIP file. + * @param destination Destination folder. + * @param onProgress Optional callback to be called on progress update + * @return Promise that resolves with a number. 0 is success, -1 is error. */ unzip(source: string, destination: string, onProgress?: Function): Promise { diff --git a/src/core/fileuploader/providers/album-handler.ts b/src/core/fileuploader/providers/album-handler.ts index 729539db1..c1e7ca08f 100644 --- a/src/core/fileuploader/providers/album-handler.ts +++ b/src/core/fileuploader/providers/album-handler.ts @@ -31,7 +31,7 @@ export class CoreFileUploaderAlbumHandler implements CoreFileUploaderHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return this.appProvider.isMobile(); @@ -40,8 +40,8 @@ export class CoreFileUploaderAlbumHandler implements CoreFileUploaderHandler { /** * Given a list of mimetypes, return the ones that are supported by the handler. * - * @param {string[]} [mimetypes] List of mimetypes. - * @return {string[]} Supported mimetypes. + * @param mimetypes List of mimetypes. + * @return Supported mimetypes. */ getSupportedMimetypes(mimetypes: string[]): string[] { // Album allows picking images and videos. @@ -51,7 +51,7 @@ export class CoreFileUploaderAlbumHandler implements CoreFileUploaderHandler { /** * Get the data to display the handler. * - * @return {CoreFileUploaderHandlerData} Data. + * @return Data. */ getData(): CoreFileUploaderHandlerData { return { diff --git a/src/core/fileuploader/providers/audio-handler.ts b/src/core/fileuploader/providers/audio-handler.ts index c6c73b9c2..c7cb5ac2c 100644 --- a/src/core/fileuploader/providers/audio-handler.ts +++ b/src/core/fileuploader/providers/audio-handler.ts @@ -32,7 +32,7 @@ export class CoreFileUploaderAudioHandler implements CoreFileUploaderHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return this.appProvider.isMobile() || (this.appProvider.canGetUserMedia() && this.appProvider.canRecordMedia()); @@ -41,8 +41,8 @@ export class CoreFileUploaderAudioHandler implements CoreFileUploaderHandler { /** * Given a list of mimetypes, return the ones that are supported by the handler. * - * @param {string[]} [mimetypes] List of mimetypes. - * @return {string[]} Supported mimetypes. + * @param mimetypes List of mimetypes. + * @return Supported mimetypes. */ getSupportedMimetypes(mimetypes: string[]): string[] { if (this.platform.is('ios')) { @@ -69,7 +69,7 @@ export class CoreFileUploaderAudioHandler implements CoreFileUploaderHandler { /** * Get the data to display the handler. * - * @return {CoreFileUploaderHandlerData} Data. + * @return Data. */ getData(): CoreFileUploaderHandlerData { return { diff --git a/src/core/fileuploader/providers/camera-handler.ts b/src/core/fileuploader/providers/camera-handler.ts index c4a9db2d3..fb290aab5 100644 --- a/src/core/fileuploader/providers/camera-handler.ts +++ b/src/core/fileuploader/providers/camera-handler.ts @@ -31,7 +31,7 @@ export class CoreFileUploaderCameraHandler implements CoreFileUploaderHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return this.appProvider.isMobile() || this.appProvider.canGetUserMedia(); @@ -40,8 +40,8 @@ export class CoreFileUploaderCameraHandler implements CoreFileUploaderHandler { /** * Given a list of mimetypes, return the ones that are supported by the handler. * - * @param {string[]} [mimetypes] List of mimetypes. - * @return {string[]} Supported mimetypes. + * @param mimetypes List of mimetypes. + * @return Supported mimetypes. */ getSupportedMimetypes(mimetypes: string[]): string[] { // Camera only supports JPEG and PNG. @@ -51,7 +51,7 @@ export class CoreFileUploaderCameraHandler implements CoreFileUploaderHandler { /** * Get the data to display the handler. * - * @return {CoreFileUploaderHandlerData} Data. + * @return Data. */ getData(): CoreFileUploaderHandlerData { return { diff --git a/src/core/fileuploader/providers/delegate.ts b/src/core/fileuploader/providers/delegate.ts index b8e7371a7..3bfea08b7 100644 --- a/src/core/fileuploader/providers/delegate.ts +++ b/src/core/fileuploader/providers/delegate.ts @@ -24,22 +24,21 @@ import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate'; export interface CoreFileUploaderHandler extends CoreDelegateHandler { /** * Handler's priority. The highest priority, the highest position. - * @type {string} */ priority?: number; /** * Given a list of mimetypes, return the ones that are supported by the handler. * - * @param {string[]} [mimetypes] List of mimetypes. - * @return {string[]} Supported mimetypes. + * @param mimetypes List of mimetypes. + * @return Supported mimetypes. */ getSupportedMimetypes(mimetypes: string[]): string[]; /** * Get the data to display the handler. * - * @return {CoreFileUploaderHandlerData} Data. + * @return Data. */ getData(): CoreFileUploaderHandlerData; } @@ -50,30 +49,27 @@ export interface CoreFileUploaderHandler extends CoreDelegateHandler { export interface CoreFileUploaderHandlerData { /** * The title to display in the handler. - * @type {string} */ title: string; /** * The icon to display in the handler. - * @type {string} */ icon?: string; /** * The class to assign to the handler item. - * @type {string} */ class?: string; /** * Action to perform when the handler is clicked. * - * @param {number} [maxSize] Max size of the file. If not defined or -1, no max size. - * @param {boolean} [upload] Whether the file should be uploaded. - * @param {boolean} [allowOffline] True to allow selecting in offline, false to require connection. - * @param {string[]} [mimetypes] List of supported mimetypes. If undefined, all mimetypes supported. - * @return {Promise} Promise resolved with the result of picking/uploading the file. + * @param maxSize Max size of the file. If not defined or -1, no max size. + * @param upload Whether the file should be uploaded. + * @param allowOffline True to allow selecting in offline, false to require connection. + * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. + * @return Promise resolved with the result of picking/uploading the file. */ action?(maxSize?: number, upload?: boolean, allowOffline?: boolean, mimetypes?: string[]) : Promise; @@ -81,10 +77,10 @@ export interface CoreFileUploaderHandlerData { /** * Function called after the handler is rendered. * - * @param {number} [maxSize] Max size of the file. If not defined or -1, no max size. - * @param {boolean} [upload] Whether the file should be uploaded. - * @param {boolean} [allowOffline] True to allow selecting in offline, false to require connection. - * @param {string[]} [mimetypes] List of supported mimetypes. If undefined, all mimetypes supported. + * @param maxSize Max size of the file. If not defined or -1, no max size. + * @param upload Whether the file should be uploaded. + * @param allowOffline True to allow selecting in offline, false to require connection. + * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. */ afterRender?(maxSize: number, upload: boolean, allowOffline: boolean, mimetypes: string[]): void; } @@ -95,31 +91,26 @@ export interface CoreFileUploaderHandlerData { export interface CoreFileUploaderHandlerResult { /** * Whether the file was treated (uploaded or copied to tmp folder). - * @type {boolean} */ treated: boolean; /** * The path of the file picked. Required if treated=false and fileEntry is not set. - * @type {string} */ path?: string; /** * The fileEntry of the file picked. Required if treated=false and path is not set. - * @type {any} */ fileEntry?: any; /** * Whether the file should be deleted after the upload. Ignored if treated=true. - * @type {boolean} */ delete?: boolean; /** * The result of picking/uploading the file. Ignored if treated=false. - * @type {any} */ result?: any; } @@ -130,13 +121,11 @@ export interface CoreFileUploaderHandlerResult { export interface CoreFileUploaderHandlerDataToReturn extends CoreFileUploaderHandlerData { /** * Handler's priority. - * @type {number} */ priority?: number; /** * Supported mimetypes. - * @type {string[]} */ mimetypes?: string[]; } @@ -163,8 +152,8 @@ export class CoreFileUploaderDelegate extends CoreDelegate { /** * Get the handlers for the current site. * - * @param {string[]} [mimetypes] List of supported mimetypes. If undefined, all mimetypes supported. - * @return {CoreFileUploaderHandlerDataToReturn[]} List of handlers data. + * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. + * @return List of handlers data. */ getHandlers(mimetypes: string[]): CoreFileUploaderHandlerDataToReturn[] { const handlers = []; diff --git a/src/core/fileuploader/providers/file-handler.ts b/src/core/fileuploader/providers/file-handler.ts index 36bda2bf4..45449cc00 100644 --- a/src/core/fileuploader/providers/file-handler.ts +++ b/src/core/fileuploader/providers/file-handler.ts @@ -35,7 +35,7 @@ export class CoreFileUploaderFileHandler implements CoreFileUploaderHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return this.platform.is('android') || !this.appProvider.isMobile() || @@ -45,8 +45,8 @@ export class CoreFileUploaderFileHandler implements CoreFileUploaderHandler { /** * Given a list of mimetypes, return the ones that are supported by the handler. * - * @param {string[]} [mimetypes] List of mimetypes. - * @return {string[]} Supported mimetypes. + * @param mimetypes List of mimetypes. + * @return Supported mimetypes. */ getSupportedMimetypes(mimetypes: string[]): string[] { return mimetypes; @@ -55,7 +55,7 @@ export class CoreFileUploaderFileHandler implements CoreFileUploaderHandler { /** * Get the data to display the handler. * - * @return {CoreFileUploaderHandlerData} Data. + * @return Data. */ getData(): CoreFileUploaderHandlerData { const isIOS = this.platform.is('ios'); diff --git a/src/core/fileuploader/providers/fileuploader.ts b/src/core/fileuploader/providers/fileuploader.ts index a43b4d3b4..90c172b1e 100644 --- a/src/core/fileuploader/providers/fileuploader.ts +++ b/src/core/fileuploader/providers/fileuploader.ts @@ -34,7 +34,6 @@ import { Subject } from 'rxjs'; export interface CoreFileUploaderOptions extends CoreWSFileUploadOptions { /** * Whether the file should be deleted after the upload (if success). - * @type {boolean} */ deleteAfterUpload?: boolean; } @@ -65,8 +64,8 @@ export class CoreFileUploaderProvider { /** * Add a dot to the beginning of an extension. * - * @param {string} extension Extension. - * @return {string} Treated extension. + * @param extension Extension. + * @return Treated extension. */ protected addDot(extension: string): string { return '.' + extension; @@ -75,9 +74,9 @@ export class CoreFileUploaderProvider { /** * Compares two file lists and returns if they are different. * - * @param {any[]} a First file list. - * @param {any[]} b Second file list. - * @return {boolean} Whether both lists are different. + * @param a First file list. + * @param b Second file list. + * @return Whether both lists are different. */ areFileListDifferent(a: any[], b: any[]): boolean { a = a || []; @@ -100,8 +99,8 @@ export class CoreFileUploaderProvider { /** * Start the audio recorder application and return information about captured audio clip files. * - * @param {CaptureAudioOptions} options Options. - * @return {Promise} Promise resolved with the result. + * @param options Options. + * @return Promise resolved with the result. */ captureAudio(options: CaptureAudioOptions): Promise { this.onAudioCapture.next(true); @@ -114,8 +113,8 @@ export class CoreFileUploaderProvider { /** * Start the video recorder application and return information about captured video clip files. * - * @param {CaptureVideoOptions} options Options. - * @return {Promise} Promise resolved with the result. + * @param options Options. + * @return Promise resolved with the result. */ captureVideo(options: CaptureVideoOptions): Promise { this.onVideoCapture.next(true); @@ -129,7 +128,7 @@ export class CoreFileUploaderProvider { * Clear temporary attachments to be uploaded. * Attachments already saved in an offline store will NOT be deleted. * - * @param {any[]} files List of files. + * @param files List of files. */ clearTmpFiles(files: any[]): void { // Delete the local files. @@ -146,9 +145,9 @@ export class CoreFileUploaderProvider { /** * Get the upload options for a file taken with the Camera Cordova plugin. * - * @param {string} uri File URI. - * @param {boolean} [isFromAlbum] True if the image was taken from album, false if it's a new image taken with camera. - * @return {CoreFileUploaderOptions} Options. + * @param uri File URI. + * @param isFromAlbum True if the image was taken from album, false if it's a new image taken with camera. + * @return Options. */ getCameraUploadOptions(uri: string, isFromAlbum?: boolean): CoreFileUploaderOptions { const extension = this.mimeUtils.getExtension(uri), @@ -183,13 +182,13 @@ export class CoreFileUploaderProvider { /** * Get the upload options for a file of any type. * - * @param {string} uri File URI. - * @param {string} name File name. - * @param {string} type File type. - * @param {boolean} [deleteAfterUpload] Whether the file should be deleted after upload. - * @param {string} [fileArea] File area to upload the file to. It defaults to 'draft'. - * @param {number} [itemId] Draft ID to upload the file to, 0 to create new. - * @return {CoreFileUploaderOptions} Options. + * @param uri File URI. + * @param name File name. + * @param type File type. + * @param deleteAfterUpload Whether the file should be deleted after upload. + * @param fileArea File area to upload the file to. It defaults to 'draft'. + * @param itemId Draft ID to upload the file to, 0 to create new. + * @return Options. */ getFileUploadOptions(uri: string, name: string, type: string, deleteAfterUpload?: boolean, fileArea?: string, itemId?: number) : CoreFileUploaderOptions { @@ -206,8 +205,8 @@ export class CoreFileUploaderProvider { /** * Get the upload options for a file taken with the media capture Cordova plugin. * - * @param {MediaFile} mediaFile File object to upload. - * @return {CoreFileUploaderOptions} Options. + * @param mediaFile File object to upload. + * @return Options. */ getMediaUploadOptions(mediaFile: MediaFile): CoreFileUploaderOptions { const options: CoreFileUploaderOptions = {}; @@ -233,8 +232,8 @@ export class CoreFileUploaderProvider { /** * Take a picture or video, or load one from the library. * - * @param {CameraOptions} options Options. - * @return {Promise} Promise resolved with the result. + * @param options Options. + * @return Promise resolved with the result. */ getPicture(options: CameraOptions): Promise { this.onGetPicture.next(true); @@ -247,8 +246,8 @@ export class CoreFileUploaderProvider { /** * Get the files stored in a folder, marking them as offline. * - * @param {string} folderPath Folder where to get the files. - * @return {Promise} Promise resolved with the list of files. + * @param folderPath Folder where to get the files. + * @return Promise resolved with the list of files. */ getStoredFiles(folderPath: string): Promise { return this.fileProvider.getDirectoryContents(folderPath).then((files) => { @@ -259,9 +258,9 @@ export class CoreFileUploaderProvider { /** * Get stored files from combined online and offline file object. * - * @param {{online: any[], offline: number}} filesObject The combined offline and online files object. - * @param {string} folderPath Folder path to get files from. - * @return {Promise} Promise resolved with files. + * @param filesObject The combined offline and online files object. + * @param folderPath Folder path to get files from. + * @return Promise resolved with files. */ getStoredFilesFromOfflineFilesObject(filesObject: { online: any[], offline: number }, folderPath: string): Promise { let files = []; @@ -288,10 +287,10 @@ export class CoreFileUploaderProvider { * Check if a file's mimetype is invalid based on the list of accepted mimetypes. This function needs either the file's * mimetype or the file's path/name. * - * @param {string[]} [mimetypes] List of supported mimetypes. If undefined, all mimetypes supported. - * @param {string} [path] File's path or name. - * @param {string} [mimetype] File's mimetype. - * @return {string} Undefined if file is valid, error message if file is invalid. + * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. + * @param path File's path or name. + * @param mimetype File's mimetype. + * @return Undefined if file is valid, error message if file is invalid. */ isInvalidMimetype(mimetypes?: string[], path?: string, mimetype?: string): string { let extension; @@ -316,8 +315,8 @@ export class CoreFileUploaderProvider { /** * Mark files as offline. * - * @param {any[]} files Files to mark as offline. - * @return {any[]} Files marked as offline. + * @param files Files to mark as offline. + * @return Files marked as offline. */ markOfflineFiles(files: any[]): any[] { // Mark the files as pending offline. @@ -332,8 +331,8 @@ export class CoreFileUploaderProvider { /** * Parse filetypeList to get the list of allowed mimetypes and the data to render information. * - * @param {string} filetypeList Formatted string list where the mimetypes can be checked. - * @return {{info: any[], mimetypes: string[]}} Mimetypes and the filetypes informations. Undefined if all types supported. + * @param filetypeList Formatted string list where the mimetypes can be checked. + * @return Mimetypes and the filetypes informations. Undefined if all types supported. */ prepareFiletypeList(filetypeList: string): { info: any[], mimetypes: string[] } { filetypeList = filetypeList && filetypeList.trim(); @@ -414,9 +413,9 @@ export class CoreFileUploaderProvider { * Given a list of files (either online files or local files), store the local files in a local folder * to be uploaded later. * - * @param {string} folderPath Path of the folder where to store the files. - * @param {any[]} files List of files. - * @return {Promise<{online: any[], offline: number}>} Promise resolved if success. + * @param folderPath Path of the folder where to store the files. + * @param files List of files. + * @return Promise resolved if success. */ storeFilesToUpload(folderPath: string, files: any[]): Promise<{ online: any[], offline: number }> { const result = { @@ -463,11 +462,11 @@ export class CoreFileUploaderProvider { /** * Upload a file. * - * @param {string} uri File URI. - * @param {CoreFileUploaderOptions} [options] Options for the upload. - * @param {Function} [onProgress] Function to call on progress. - * @param {string} [siteId] Id of the site to upload the file to. If not defined, use current site. - * @return {Promise} Promise resolved when done. + * @param uri File URI. + * @param options Options for the upload. + * @param onProgress Function to call on progress. + * @param siteId Id of the site to upload the file to. If not defined, use current site. + * @return Promise resolved when done. */ uploadFile(uri: string, options?: CoreFileUploaderOptions, onProgress?: (event: ProgressEvent) => any, siteId?: string): Promise { @@ -498,12 +497,12 @@ export class CoreFileUploaderProvider { * If the file is an online file it will be downloaded and then re-uploaded. * If the file is a local file it will not be deleted from the device after upload. * - * @param {any} file Online file or local FileEntry. - * @param {number} [itemId] Draft ID to use. Undefined or 0 to create a new draft ID. - * @param {string} [component] The component to set to the downloaded files. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the itemId. + * @param file Online file or local FileEntry. + * @param itemId Draft ID to use. Undefined or 0 to create a new draft ID. + * @param component The component to set to the downloaded files. + * @param componentId An ID to use in conjunction with the component. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the itemId. */ uploadOrReuploadFile(file: any, itemId?: number, component?: string, componentId?: string | number, siteId?: string): Promise { @@ -544,11 +543,11 @@ export class CoreFileUploaderProvider { * Local files are not deleted from the device after upload. * If there are no files to upload it will return a fake draft ID (1). * - * @param {any[]} files List of files. - * @param {string} [component] The component to set to the downloaded files. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the itemId. + * @param files List of files. + * @param component The component to set to the downloaded files. + * @param componentId An ID to use in conjunction with the component. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the itemId. */ uploadOrReuploadFiles(files: any[], component?: string, componentId?: string | number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); diff --git a/src/core/fileuploader/providers/helper.ts b/src/core/fileuploader/providers/helper.ts index d530bd4be..8ae78e070 100644 --- a/src/core/fileuploader/providers/helper.ts +++ b/src/core/fileuploader/providers/helper.ts @@ -47,12 +47,12 @@ export class CoreFileUploaderHelperProvider { /** * Show a confirmation modal to the user if the size of the file is bigger than the allowed threshold. * - * @param {number} size File size. - * @param {boolean} [alwaysConfirm] True to show a confirm even if the size isn't high. - * @param {boolean} [allowOffline] True to allow uploading in offline. - * @param {number} [wifiThreshold] Threshold for WiFi connection. Default: CoreFileUploaderProvider.WIFI_SIZE_WARNING. - * @param {number} [limitedThreshold] Threshold for limited connection. Default: CoreFileUploaderProvider.LIMITED_SIZE_WARNING. - * @return {Promise} Promise resolved when the user confirms or if there's no need to show a modal. + * @param size File size. + * @param alwaysConfirm True to show a confirm even if the size isn't high. + * @param allowOffline True to allow uploading in offline. + * @param wifiThreshold Threshold for WiFi connection. Default: CoreFileUploaderProvider.WIFI_SIZE_WARNING. + * @param limitedThreshold Threshold for limited connection. Default: CoreFileUploaderProvider.LIMITED_SIZE_WARNING. + * @return Promise resolved when the user confirms or if there's no need to show a modal. */ confirmUploadFile(size: number, alwaysConfirm?: boolean, allowOffline?: boolean, wifiThreshold?: number, limitedThreshold?: number): Promise { @@ -84,10 +84,10 @@ export class CoreFileUploaderHelperProvider { /** * Create a temporary copy of a file and upload it. * - * @param {any} file File to copy and upload. - * @param {boolean} [upload] True if the file should be uploaded, false to return the copy of the file. - * @param {string} [name] Name to use when uploading the file. If not defined, use the file's name. - * @return {Promise} Promise resolved when the file is uploaded. + * @param file File to copy and upload. + * @param upload True if the file should be uploaded, false to return the copy of the file. + * @param name Name to use when uploading the file. If not defined, use the file's name. + * @return Promise resolved when the file is uploaded. */ copyAndUploadFile(file: any, upload?: boolean, name?: string): Promise { name = name || file.name; @@ -122,11 +122,11 @@ export class CoreFileUploaderHelperProvider { /** * Copy or move a file to the app temporary folder. * - * @param {string} path Path of the file. - * @param {boolean} shouldDelete True if original file should be deleted (move), false otherwise (copy). - * @param {number} [maxSize] Max size of the file. If not defined or -1, no max size. - * @param {string} [defaultExt] Defaut extension to use if the file doesn't have any. - * @return {Promise} Promise resolved with the copied file. + * @param path Path of the file. + * @param shouldDelete True if original file should be deleted (move), false otherwise (copy). + * @param maxSize Max size of the file. If not defined or -1, no max size. + * @param defaultExt Defaut extension to use if the file doesn't have any. + * @return Promise resolved with the copied file. */ protected copyToTmpFolder(path: string, shouldDelete: boolean, maxSize?: number, defaultExt?: string): Promise { let fileName = this.fileProvider.getFileAndDirectoryFromPath(path).name, @@ -173,9 +173,9 @@ export class CoreFileUploaderHelperProvider { /** * Function called when trying to upload a file bigger than max size. Shows an error. * - * @param {number} maxSize Max size (bytes). - * @param {string} fileName Name of the file. - * @return {Promise} Rejected promise. + * @param maxSize Max size (bytes). + * @param fileName Name of the file. + * @return Rejected promise. */ protected errorMaxBytes(maxSize: number, fileName: string): Promise { const errorMessage = this.translate.instant('core.fileuploader.maxbytesfile', { @@ -203,7 +203,7 @@ export class CoreFileUploaderHelperProvider { /** * Function to call once a file is uploaded using the file picker. * - * @param {any} result Result of the upload process. + * @param result Result of the upload process. */ fileUploaded(result: any): void { if (this.filePickerDeferred) { @@ -219,11 +219,11 @@ export class CoreFileUploaderHelperProvider { /** * Open the "file picker" to select and upload a file. * - * @param {number} [maxSize] Max size of the file to upload. If not defined or -1, no max size. - * @param {string} [title] File picker title. - * @param {string[]} [mimetypes] List of supported mimetypes. If undefined, all mimetypes supported. - * @return {Promise} Promise resolved when a file is uploaded, rejected if file picker is closed without a file uploaded. - * The resolve value is the response of the upload request. + * @param maxSize Max size of the file to upload. If not defined or -1, no max size. + * @param title File picker title. + * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. + * @return Promise resolved when a file is uploaded, rejected if file picker is closed without a file uploaded. + * The resolve value is the response of the upload request. */ selectAndUploadFile(maxSize?: number, title?: string, mimetypes?: string[]): Promise { return this.selectFileWithPicker(maxSize, false, title, mimetypes, true); @@ -232,12 +232,12 @@ export class CoreFileUploaderHelperProvider { /** * Open the "file picker" to select a file without uploading it. * - * @param {number} [maxSize] Max size of the file. If not defined or -1, no max size. - * @param {boolean} [allowOffline] True to allow selecting in offline, false to require connection. - * @param {string} [title] File picker title. - * @param {string[]} [mimetypes] List of supported mimetypes. If undefined, all mimetypes supported. - * @return {Promise} Promise resolved when a file is selected, rejected if file picker is closed without selecting a file. - * The resolve value is the FileEntry of a copy of the picked file, so it can be deleted afterwards. + * @param maxSize Max size of the file. If not defined or -1, no max size. + * @param allowOffline True to allow selecting in offline, false to require connection. + * @param title File picker title. + * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. + * @return Promise resolved when a file is selected, rejected if file picker is closed without selecting a file. + * The resolve value is the FileEntry of a copy of the picked file, so it can be deleted afterwards. */ selectFile(maxSize?: number, allowOffline?: boolean, title?: string, mimetypes?: string[]) : Promise { @@ -247,12 +247,12 @@ export class CoreFileUploaderHelperProvider { /** * Open the "file picker" to select a file and maybe uploading it. * - * @param {number} [maxSize] Max size of the file. If not defined or -1, no max size. - * @param {boolean} [allowOffline] True to allow selecting in offline, false to require connection. - * @param {string} [title] File picker title. - * @param {string[]} [mimetypes] List of supported mimetypes. If undefined, all mimetypes supported. - * @param {boolean} [upload] Whether the file should be uploaded. - * @return {Promise} Promise resolved when a file is selected/uploaded, rejected if file picker is closed. + * @param maxSize Max size of the file. If not defined or -1, no max size. + * @param allowOffline True to allow selecting in offline, false to require connection. + * @param title File picker title. + * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. + * @param upload Whether the file should be uploaded. + * @return Promise resolved when a file is selected/uploaded, rejected if file picker is closed. */ protected selectFileWithPicker(maxSize?: number, allowOffline?: boolean, title?: string, mimetypes?: string[], upload?: boolean): Promise { @@ -352,10 +352,10 @@ export class CoreFileUploaderHelperProvider { /** * Convenience function to upload a file on a certain site, showing a confirm if needed. * - * @param {any} fileEntry FileEntry of the file to upload. - * @param {boolean} [deleteAfterUpload] Whether the file should be deleted after upload. - * @param {string} [siteId] Id of the site to upload the file to. If not defined, use current site. - * @return {Promise} Promise resolved when the file is uploaded. + * @param fileEntry FileEntry of the file to upload. + * @param deleteAfterUpload Whether the file should be deleted after upload. + * @param siteId Id of the site to upload the file to. If not defined, use current site. + * @return Promise resolved when the file is uploaded. */ showConfirmAndUploadInSite(fileEntry: any, deleteAfterUpload?: boolean, siteId?: string): Promise { return this.fileProvider.getFileObjectFromFileEntry(fileEntry).then((file) => { @@ -380,9 +380,9 @@ export class CoreFileUploaderHelperProvider { /** * Treat a capture audio/video error. * - * @param {any} error Error returned by the Cordova plugin. Can be a string or an object. - * @param {string} defaultMessage Key of the default message to show. - * @return {Promise} Rejected promise. If it doesn't have an error message it means it was cancelled. + * @param error Error returned by the Cordova plugin. Can be a string or an object. + * @param defaultMessage Key of the default message to show. + * @return Rejected promise. If it doesn't have an error message it means it was cancelled. */ protected treatCaptureError(error: any, defaultMessage: string): Promise { // Cancelled or error. If cancelled, error is an object with code = 3. @@ -413,9 +413,9 @@ export class CoreFileUploaderHelperProvider { /** * Treat a capture image or browse album error. * - * @param {string} error Error returned by the Cordova plugin. - * @param {string} defaultMessage Key of the default message to show. - * @return {Promise} Rejected promise. If it doesn't have an error message it means it was cancelled. + * @param error Error returned by the Cordova plugin. + * @param defaultMessage Key of the default message to show. + * @return Rejected promise. If it doesn't have an error message it means it was cancelled. */ protected treatImageError(error: string, defaultMessage: string): Promise { // Cancelled or error. @@ -440,11 +440,11 @@ export class CoreFileUploaderHelperProvider { /** * Convenient helper for the user to record and upload a video. * - * @param {boolean} isAudio True if uploading an audio, false if it's a video. - * @param {number} maxSize Max size of the upload. -1 for no max size. - * @param {boolean} [upload] True if the file should be uploaded, false to return the picked file. - * @param {string[]} [mimetypes] List of supported mimetypes. If undefined, all mimetypes supported. - * @return {Promise} Promise resolved when done. + * @param isAudio True if uploading an audio, false if it's a video. + * @param maxSize Max size of the upload. -1 for no max size. + * @param upload True if the file should be uploaded, false to return the picked file. + * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. + * @return Promise resolved when done. */ uploadAudioOrVideo(isAudio: boolean, maxSize: number, upload?: boolean, mimetypes?: string[]): Promise { this.logger.debug('Trying to record a ' + (isAudio ? 'audio' : 'video') + ' file'); @@ -485,12 +485,12 @@ export class CoreFileUploaderHelperProvider { * Uploads a file of any type. * This function will not check the size of the file, please check it before calling this function. * - * @param {string} uri File URI. - * @param {string} name File name. - * @param {string} type File type. - * @param {boolean} [deleteAfterUpload] Whether the file should be deleted after upload. - * @param {string} [siteId] Id of the site to upload the file to. If not defined, use current site. - * @return {Promise} Promise resolved when the file is uploaded. + * @param uri File URI. + * @param name File name. + * @param type File type. + * @param deleteAfterUpload Whether the file should be deleted after upload. + * @param siteId Id of the site to upload the file to. If not defined, use current site. + * @return Promise resolved when the file is uploaded. */ uploadGenericFile(uri: string, name: string, type: string, deleteAfterUpload?: boolean, siteId?: string): Promise { const options = this.fileUploaderProvider.getFileUploadOptions(uri, name, type, deleteAfterUpload); @@ -501,11 +501,11 @@ export class CoreFileUploaderHelperProvider { /** * Convenient helper for the user to upload an image, either from the album or taking it with the camera. * - * @param {boolean} fromAlbum True if the image should be selected from album, false if it should be taken with camera. - * @param {number} maxSize Max size of the upload. -1 for no max size. - * @param {boolean} [upload] True if the file should be uploaded, false to return the picked file. - * @param {string[]} [mimetypes] List of supported mimetypes. If undefined, all mimetypes supported. - * @return {Promise} Promise resolved when done. + * @param fromAlbum True if the image should be selected from album, false if it should be taken with camera. + * @param maxSize Max size of the upload. -1 for no max size. + * @param upload True if the file should be uploaded, false to return the picked file. + * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. + * @return Promise resolved when done. */ uploadImage(fromAlbum: boolean, maxSize: number, upload?: boolean, mimetypes?: string[]): Promise { this.logger.debug('Trying to capture an image with camera'); @@ -568,13 +568,13 @@ export class CoreFileUploaderHelperProvider { /** * Upload a file given the file entry. * - * @param {any} fileEntry The file entry. - * @param {boolean} deleteAfter True if the file should be deleted once treated. - * @param {number} [maxSize] Max size of the file. If not defined or -1, no max size. - * @param {boolean} [upload] True if the file should be uploaded, false to return the picked file. - * @param {boolean} [allowOffline] True to allow selecting in offline, false to require connection. - * @param {string} [name] Name to use when uploading the file. If not defined, use the file's name. - * @return {Promise} Promise resolved when done. + * @param fileEntry The file entry. + * @param deleteAfter True if the file should be deleted once treated. + * @param maxSize Max size of the file. If not defined or -1, no max size. + * @param upload True if the file should be uploaded, false to return the picked file. + * @param allowOffline True to allow selecting in offline, false to require connection. + * @param name Name to use when uploading the file. If not defined, use the file's name. + * @return Promise resolved when done. */ uploadFileEntry(fileEntry: any, deleteAfter: boolean, maxSize?: number, upload?: boolean, allowOffline?: boolean, name?: string): Promise { @@ -593,12 +593,12 @@ export class CoreFileUploaderHelperProvider { /** * Upload a file given the file object. * - * @param {any} file The file object. - * @param {number} [maxSize] Max size of the file. If not defined or -1, no max size. - * @param {boolean} [upload] True if the file should be uploaded, false to return the picked file. - * @param {boolean} [allowOffline] True to allow selecting in offline, false to require connection. - * @param {string} [name] Name to use when uploading the file. If not defined, use the file's name. - * @return {Promise} Promise resolved when done. + * @param file The file object. + * @param maxSize Max size of the file. If not defined or -1, no max size. + * @param upload True if the file should be uploaded, false to return the picked file. + * @param allowOffline True to allow selecting in offline, false to require connection. + * @param name Name to use when uploading the file. If not defined, use the file's name. + * @return Promise resolved when done. */ uploadFileObject(file: any, maxSize?: number, upload?: boolean, allowOffline?: boolean, name?: string): Promise { if (maxSize != -1 && file.size > maxSize) { @@ -614,12 +614,12 @@ export class CoreFileUploaderHelperProvider { /** * Convenience function to upload a file, allowing to retry if it fails. * - * @param {string} path Absolute path of the file to upload. - * @param {number} maxSize Max size of the upload. -1 for no max size. - * @param {boolean} checkSize True to check size. - * @param {CoreFileUploaderOptions} Options. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if the file is uploaded, rejected otherwise. + * @param path Absolute path of the file to upload. + * @param maxSize Max size of the upload. -1 for no max size. + * @param checkSize True to check size. + * @param Options. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if the file is uploaded, rejected otherwise. */ protected uploadFile(path: string, maxSize: number, checkSize: boolean, options: CoreFileUploaderOptions, siteId?: string) : Promise { @@ -697,9 +697,9 @@ export class CoreFileUploaderHelperProvider { /** * Show a progress modal. * - * @param {Loading} modal The modal where to show the progress. - * @param {string} stringKey The key of the string to display. - * @param {ProgressEvent|CoreFileProgressEvent} progress The progress event. + * @param modal The modal where to show the progress. + * @param stringKey The key of the string to display. + * @param progress The progress event. */ protected showProgressModal(modal: Loading, stringKey: string, progress: ProgressEvent | CoreFileProgressEvent): void { if (progress && progress.lengthComputable) { diff --git a/src/core/fileuploader/providers/video-handler.ts b/src/core/fileuploader/providers/video-handler.ts index 22c70ecac..6d9fb58f8 100644 --- a/src/core/fileuploader/providers/video-handler.ts +++ b/src/core/fileuploader/providers/video-handler.ts @@ -32,7 +32,7 @@ export class CoreFileUploaderVideoHandler implements CoreFileUploaderHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return this.appProvider.isMobile() || (this.appProvider.canGetUserMedia() && this.appProvider.canRecordMedia()); @@ -41,8 +41,8 @@ export class CoreFileUploaderVideoHandler implements CoreFileUploaderHandler { /** * Given a list of mimetypes, return the ones that are supported by the handler. * - * @param {string[]} [mimetypes] List of mimetypes. - * @return {string[]} Supported mimetypes. + * @param mimetypes List of mimetypes. + * @return Supported mimetypes. */ getSupportedMimetypes(mimetypes: string[]): string[] { if (this.platform.is('ios')) { @@ -69,7 +69,7 @@ export class CoreFileUploaderVideoHandler implements CoreFileUploaderHandler { /** * Get the data to display the handler. * - * @return {CoreFileUploaderHandlerData} Data. + * @return Data. */ getData(): CoreFileUploaderHandlerData { return { diff --git a/src/core/grades/components/course/course.ts b/src/core/grades/components/course/course.ts index 8d66dd320..51703f87b 100644 --- a/src/core/grades/components/course/course.ts +++ b/src/core/grades/components/course/course.ts @@ -64,8 +64,8 @@ export class CoreGradesCourseComponent { /** * Fetch all the data required for the view. * - * @param {boolean} [refresh] Empty events array first. - * @return {Promise} Resolved when done. + * @param refresh Empty events array first. + * @return Resolved when done. */ fetchData(refresh: boolean = false): Promise { return this.gradesProvider.getCourseGradesTable(this.courseId, this.userId).then((table) => { @@ -78,7 +78,7 @@ export class CoreGradesCourseComponent { /** * Refresh data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshGrades(refresher: any): void { this.gradesProvider.invalidateCourseGradesData(this.courseId, this.userId).finally(() => { @@ -90,7 +90,7 @@ export class CoreGradesCourseComponent { /** * Navigate to the grade of the selected item. - * @param {number} gradeId Grade item ID where to navigate. + * @param gradeId Grade item ID where to navigate. */ gotoGrade(gradeId: number): void { if (gradeId) { diff --git a/src/core/grades/pages/courses/courses.ts b/src/core/grades/pages/courses/courses.ts index 62a67829a..fe186edd8 100644 --- a/src/core/grades/pages/courses/courses.ts +++ b/src/core/grades/pages/courses/courses.ts @@ -66,7 +66,7 @@ export class CoreGradesCoursesPage { /** * Fetch all the data required for the view. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ fetchData(): Promise { return this.gradesProvider.getCoursesGrades().then((grades) => { @@ -81,7 +81,7 @@ export class CoreGradesCoursesPage { /** * Refresh data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshGrades(refresher: any): void { this.gradesProvider.invalidateCoursesGradesData().finally(() => { @@ -93,7 +93,7 @@ export class CoreGradesCoursesPage { /** * Navigate to the grades of the selected course. - * @param {number} courseId Course Id where to navigate. + * @param courseId Course Id where to navigate. */ gotoCourseGrades(courseId: number): void { this.courseId = courseId; diff --git a/src/core/grades/pages/grade/grade.ts b/src/core/grades/pages/grade/grade.ts index fc94c0497..dcdad5290 100644 --- a/src/core/grades/pages/grade/grade.ts +++ b/src/core/grades/pages/grade/grade.ts @@ -56,7 +56,7 @@ export class CoreGradesGradePage { /** * Fetch all the data required for the view. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ fetchData(): Promise { return this.gradesHelper.getGradeItem(this.courseId, this.gradeId, this.userId).then((grade) => { @@ -69,7 +69,7 @@ export class CoreGradesGradePage { /** * Refresh data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshGrade(refresher: any): void { this.gradesProvider.invalidateCourseGradesData(this.courseId, this.userId).finally(() => { diff --git a/src/core/grades/providers/course-option-handler.ts b/src/core/grades/providers/course-option-handler.ts index d544e4e85..a927a0d09 100644 --- a/src/core/grades/providers/course-option-handler.ts +++ b/src/core/grades/providers/course-option-handler.ts @@ -32,10 +32,10 @@ export class CoreGradesCourseOptionHandler implements CoreCourseOptionsHandler { /** * Should invalidate the data to determine if the handler is enabled for a certain course. * - * @param {number} courseId The course ID. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {Promise} Promise resolved when done. + * @param courseId The course ID. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved when done. */ invalidateEnabledForCourse(courseId: number, navOptions?: any, admOptions?: any): Promise { if (navOptions && typeof navOptions.grades != 'undefined') { @@ -49,7 +49,7 @@ export class CoreGradesCourseOptionHandler implements CoreCourseOptionsHandler { /** * 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 { return true; @@ -58,11 +58,11 @@ export class CoreGradesCourseOptionHandler implements CoreCourseOptionsHandler { /** * Whether or not the handler is enabled for a certain course. * - * @param {number} courseId The course ID. - * @param {any} accessData Access type and data. Default, guest, ... - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @param courseId The course ID. + * @param accessData Access type and data. Default, guest, ... + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return True or promise resolved with true if enabled. */ isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise { if (accessData && accessData.type == CoreCourseProvider.ACCESS_GUEST) { @@ -79,9 +79,9 @@ export class CoreGradesCourseOptionHandler implements CoreCourseOptionsHandler { /** * Returns the data needed to render the handler. * - * @param {Injector} injector Injector. - * @param {number} course The course. - * @return {CoreCourseOptionsHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param course The course. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, course: any): CoreCourseOptionsHandlerData | Promise { return { @@ -94,8 +94,8 @@ export class CoreGradesCourseOptionHandler implements CoreCourseOptionsHandler { /** * 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. - * @return {Promise} Promise resolved when done. + * @param course The course. + * @return Promise resolved when done. */ prefetch(course: any): Promise { return this.gradesProvider.getCourseGradesTable(course.id, undefined, undefined, true); diff --git a/src/core/grades/providers/grades.ts b/src/core/grades/providers/grades.ts index 59b25b1d2..b2f35b266 100644 --- a/src/core/grades/providers/grades.ts +++ b/src/core/grades/providers/grades.ts @@ -41,9 +41,9 @@ export class CoreGradesProvider { /** * Get cache key for grade table data WS calls. * - * @param {number} courseId ID of the course to get the grades from. - * @param {number} userId ID of the user to get the grades from. - * @return {string} Cache key. + * @param courseId ID of the course to get the grades from. + * @param userId ID of the user to get the grades from. + * @return Cache key. */ protected getCourseGradesCacheKey(courseId: number, userId: number): string { return this.getCourseGradesPrefixCacheKey(courseId) + userId; @@ -52,10 +52,10 @@ export class CoreGradesProvider { /** * Get cache key for grade items data WS calls. * - * @param {number} courseId ID of the course to get the grades from. - * @param {number} userId ID of the user to get the grades from. - * @param {number} [groupId] ID of the group to get the grades from. Default: 0. - * @return {string} Cache key. + * @param courseId ID of the course to get the grades from. + * @param userId ID of the user to get the grades from. + * @param groupId ID of the group to get the grades from. Default: 0. + * @return Cache key. */ protected getCourseGradesItemsCacheKey(courseId: number, userId: number, groupId: number): string { groupId = groupId || 0; @@ -66,8 +66,8 @@ export class CoreGradesProvider { /** * Get prefix cache key for grade table data WS calls. * - * @param {number} courseId ID of the course to get the grades from. - * @return {string} Cache key. + * @param courseId ID of the course to get the grades from. + * @return Cache key. */ protected getCourseGradesPrefixCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'items:' + courseId + ':'; @@ -76,7 +76,7 @@ export class CoreGradesProvider { /** * Get cache key for courses grade WS calls. * - * @return {string} Cache key. + * @return Cache key. */ protected getCoursesGradesCacheKey(): string { return this.ROOT_CACHE_KEY + 'coursesgrades'; @@ -86,12 +86,12 @@ export class CoreGradesProvider { * Get the grade items for a certain module. Keep in mind that may have more than one item to include outcomes and scales. * Fallback function only used if 'gradereport_user_get_grade_items' WS is not avalaible Moodle < 3.2. * - * @param {number} courseId ID of the course to get the grades from. - * @param {number} [userId] ID of the user to get the grades from. If not defined use site's current user. - * @param {number} [groupId] ID of the group to get the grades from. Not used for old gradebook table. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [ignoreCache=false] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise to be resolved when the grades are retrieved. + * @param courseId ID of the course to get the grades from. + * @param userId ID of the user to get the grades from. If not defined use site's current user. + * @param groupId ID of the group to get the grades from. Not used for old gradebook table. + * @param siteId Site ID. If not defined, current site. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise to be resolved when the grades are retrieved. */ getGradeItems(courseId: number, userId?: number, groupId?: number, siteId?: string, ignoreCache: boolean = false): Promise { @@ -116,12 +116,12 @@ export class CoreGradesProvider { /** * Get the grade items for a certain course. * - * @param {number} courseId ID of the course to get the grades from. - * @param {number} [userId] ID of the user to get the grades from. - * @param {number} [groupId] ID of the group to get the grades from. Default 0. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [ignoreCache=false] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise to be resolved when the grades table is retrieved. + * @param courseId ID of the course to get the grades from. + * @param userId ID of the user to get the grades from. + * @param groupId ID of the group to get the grades from. Default 0. + * @param siteId Site ID. If not defined, current site. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise to be resolved when the grades table is retrieved. */ getCourseGradesItems(courseId: number, userId?: number, groupId?: number, siteId?: string, ignoreCache: boolean = false): Promise { @@ -158,11 +158,11 @@ export class CoreGradesProvider { /** * Get the grades for a certain course. * - * @param {number} courseId ID of the course to get the grades from. - * @param {number} [userId] ID of the user to get the grades from. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [ignoreCache=false] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise to be resolved when the grades table is retrieved. + * @param courseId ID of the course to get the grades from. + * @param userId ID of the user to get the grades from. + * @param siteId Site ID. If not defined, current site. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise to be resolved when the grades table is retrieved. */ getCourseGradesTable(courseId: number, userId?: number, siteId?: string, ignoreCache: boolean = false): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -196,8 +196,8 @@ export class CoreGradesProvider { /** * Get the grades for a certain course. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise to be resolved when the grades are retrieved. + * @param siteId Site ID. If not defined, current site. + * @return Promise to be resolved when the grades are retrieved. */ getCoursesGrades(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -220,9 +220,9 @@ export class CoreGradesProvider { /** * Invalidates courses grade table and items WS calls for all users. * - * @param {number} courseId ID of the course to get the grades from. - * @param {string} [siteId] Site ID (empty for current site). - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId ID of the course to get the grades from. + * @param siteId Site ID (empty for current site). + * @return Promise resolved when the data is invalidated. */ invalidateAllCourseGradesData(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -233,10 +233,10 @@ export class CoreGradesProvider { /** * Invalidates grade table data WS calls. * - * @param {number} courseId Course ID. - * @param {number} [userId] User ID. - * @param {string} [siteId] Site id (empty for current site). - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId Course ID. + * @param userId User ID. + * @param siteId Site id (empty for current site). + * @return Promise resolved when the data is invalidated. */ invalidateCourseGradesData(courseId: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -249,8 +249,8 @@ export class CoreGradesProvider { /** * Invalidates courses grade data WS calls. * - * @param {string} [siteId] Site id (empty for current site). - * @return {Promise} Promise resolved when the data is invalidated. + * @param siteId Site id (empty for current site). + * @return Promise resolved when the data is invalidated. */ invalidateCoursesGradesData(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -261,11 +261,11 @@ export class CoreGradesProvider { /** * Invalidates courses grade items data WS calls. * - * @param {number} courseId ID of the course to get the grades from. - * @param {number} userId ID of the user to get the grades from. - * @param {number} [groupId] ID of the group to get the grades from. Default: 0. - * @param {string} [siteId] Site id (empty for current site). - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId ID of the course to get the grades from. + * @param userId ID of the user to get the grades from. + * @param groupId ID of the group to get the grades from. Default: 0. + * @param siteId Site id (empty for current site). + * @return Promise resolved when the data is invalidated. */ invalidateCourseGradesItemsData(courseId: number, userId: number, groupId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -276,8 +276,8 @@ export class CoreGradesProvider { /** * Returns whether or not the plugin is enabled for a certain site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Resolve with true if plugin is enabled, false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return Resolve with true if plugin is enabled, false otherwise. * @since Moodle 3.2 */ isCourseGradesEnabled(siteId?: string): Promise { @@ -295,9 +295,9 @@ export class CoreGradesProvider { /** * Returns whether or not the grade addon is enabled for a certain course. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promisee} Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @param courseId Course ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ isPluginEnabledForCourse(courseId: number, siteId?: string): Promise { if (!courseId) { @@ -312,8 +312,8 @@ export class CoreGradesProvider { /** * Returns whether or not WS Grade Items is avalaible. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} True if ws is avalaible, false otherwise. + * @param siteId Site ID. If not defined, current site. + * @return True if ws is avalaible, false otherwise. * @since Moodle 3.2 */ isGradeItemsAvalaible(siteId?: string): Promise { @@ -325,10 +325,10 @@ export class CoreGradesProvider { /** * Log Course grades view in Moodle. * - * @param {number} courseId Course ID. - * @param {number} userId User ID. - * @param {string} [name] Course name. If not set, it will be calculated. - * @return {Promise} Promise resolved when done. + * @param courseId Course ID. + * @param userId User ID. + * @param name Course name. If not set, it will be calculated. + * @return Promise resolved when done. */ logCourseGradesView(courseId: number, userId: number, name?: string): Promise { userId = userId || this.sitesProvider.getCurrentSiteUserId(); @@ -354,8 +354,8 @@ export class CoreGradesProvider { /** * Log Courses grades view in Moodle. * - * @param {number} [courseId] Course ID. If not defined, site Home ID. - * @return {Promise} Promise resolved when done. + * @param courseId Course ID. If not defined, site Home ID. + * @return Promise resolved when done. */ logCoursesGradesView(courseId?: number): Promise { if (!courseId) { diff --git a/src/core/grades/providers/helper.ts b/src/core/grades/providers/helper.ts index 22d925f6a..86cf0fa19 100644 --- a/src/core/grades/providers/helper.ts +++ b/src/core/grades/providers/helper.ts @@ -44,8 +44,8 @@ export class CoreGradesHelperProvider { /** * Formats a row from the grades table te be rendered in a page. * - * @param {any} tableRow JSON object representing row of grades table data. - * @return {any} Formatted row object. + * @param tableRow JSON object representing row of grades table data. + * @return Formatted row object. */ protected formatGradeRow(tableRow: any): any { const row = {}; @@ -79,8 +79,8 @@ export class CoreGradesHelperProvider { /** * Formats a row from the grades table to be rendered in one table. * - * @param {any} tableRow JSON object representing row of grades table data. - * @return {any} Formatted row object. + * @param tableRow JSON object representing row of grades table data. + * @return Formatted row object. */ protected formatGradeRowForTable(tableRow: any): any { const row = {}; @@ -119,8 +119,8 @@ export class CoreGradesHelperProvider { /** * Removes suffix formatted to compatibilize data from table and items. * - * @param {any} item Grade item to format. - * @return {any} Grade item formatted. + * @param item Grade item to format. + * @return Grade item formatted. */ protected formatGradeItem(item: any): any { for (const name in item) { @@ -136,8 +136,8 @@ export class CoreGradesHelperProvider { /** * Formats the response of gradereport_user_get_grades_table to be rendered. * - * @param {any} table JSON object representing a table with data. - * @return {any} Formatted HTML table. + * @param table JSON object representing a table with data. + * @return Formatted HTML table. */ formatGradesTable(table: any): any { const maxDepth = table.maxdepth, @@ -195,8 +195,8 @@ export class CoreGradesHelperProvider { /** * Get course data for grades since they only have courseid. * - * @param {any} grades Grades to get the data for. - * @return {Promise} Promise always resolved. Resolve param is the formatted grades. + * @param grades Grades to get the data for. + * @return Promise always resolved. Resolve param is the formatted grades. */ getGradesCourseData(grades: any): Promise { // Using cache for performance reasons. @@ -219,12 +219,12 @@ export class CoreGradesHelperProvider { /** * Get an specific grade item. * - * @param {number} courseId ID of the course to get the grades from. - * @param {number} gradeId Grade ID. - * @param {number} [userId] ID of the user to get the grades from. If not defined use site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [ignoreCache=false] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise to be resolved when the grades are retrieved. + * @param courseId ID of the course to get the grades from. + * @param gradeId Grade ID. + * @param userId ID of the user to get the grades from. If not defined use site's current user. + * @param siteId Site ID. If not defined, current site. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise to be resolved when the grades are retrieved. */ getGradeItem(courseId: number, gradeId: number, userId?: number, siteId?: string, ignoreCache: boolean = false): Promise { @@ -240,9 +240,9 @@ export class CoreGradesHelperProvider { /** * Returns the label of the selected grade. * - * @param {any[]} grades Array with objects with value and label. - * @param {number} selectedGrade Selected grade value. - * @return {string} Selected grade label. + * @param grades Array with objects with value and label. + * @param selectedGrade Selected grade value. + * @return Selected grade label. */ getGradeLabelFromValue(grades: any[], selectedGrade: number): string { selectedGrade = Number(selectedGrade); @@ -263,13 +263,13 @@ export class CoreGradesHelperProvider { /** * Get the grade items for a certain module. Keep in mind that may have more than one item to include outcomes and scales. * - * @param {number} courseId ID of the course to get the grades from. - * @param {number} moduleId Module ID. - * @param {number} [userId] ID of the user to get the grades from. If not defined use site's current user. - * @param {number} [groupId] ID of the group to get the grades from. Not used for old gradebook table. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [ignoreCache=false] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise to be resolved when the grades are retrieved. + * @param courseId ID of the course to get the grades from. + * @param moduleId Module ID. + * @param userId ID of the user to get the grades from. If not defined use site's current user. + * @param groupId ID of the group to get the grades from. Not used for old gradebook table. + * @param siteId Site ID. If not defined, current site. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise to be resolved when the grades are retrieved. */ getGradeModuleItems(courseId: number, moduleId: number, userId?: number, groupId?: number, siteId?: string, ignoreCache: boolean = false): Promise { @@ -295,9 +295,9 @@ export class CoreGradesHelperProvider { /** * Returns the value of the selected grade. * - * @param {any[]} grades Array with objects with value and label. - * @param {string} selectedGrade Selected grade label. - * @return {number} Selected grade value. + * @param grades Array with objects with value and label. + * @param selectedGrade Selected grade label. + * @return Selected grade value. */ getGradeValueFromLabel(grades: any[], selectedGrade: string): number { if (!grades || !selectedGrade) { @@ -316,8 +316,8 @@ export class CoreGradesHelperProvider { /** * Gets the link to the module for the selected grade. * - * @param {string} text HTML where the link is present. - * @return {string | false} URL linking to the module. + * @param text HTML where the link is present. + * @return URL linking to the module. */ protected getModuleLink(text: string): string | false { const el = this.domUtils.toDom(text)[0], @@ -333,9 +333,9 @@ export class CoreGradesHelperProvider { /** * Get a row from the grades table. * - * @param {any} table JSON object representing a table with data. - * @param {number} gradeId Grade Object identifier. - * @return {any} Formatted HTML table. + * @param table JSON object representing a table with data. + * @param gradeId Grade Object identifier. + * @return Formatted HTML table. */ getGradesTableRow(table: any, gradeId: number): any { if (table.tabledata) { @@ -355,9 +355,9 @@ export class CoreGradesHelperProvider { /** * Get the rows related to a module from the grades table. * - * @param {any} table JSON object representing a table with data. - * @param {number} moduleId Grade Object identifier. - * @return {any} Formatted HTML table. + * @param table JSON object representing a table with data. + * @param moduleId Grade Object identifier. + * @return Formatted HTML table. */ getModuleGradesTableRows(table: any, moduleId: number): any { @@ -388,12 +388,12 @@ export class CoreGradesHelperProvider { /** * Go to view grades. * - * @param {number} courseId Course ID t oview. - * @param {number} [userId] User to view. If not defined, current user. - * @param {number} [moduleId] Module to view. If not defined, view all course grades. - * @param {NavController} [navCtrl] NavController to use. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param courseId Course ID t oview. + * @param userId User to view. If not defined, current user. + * @param moduleId Module to view. If not defined, view all course grades. + * @param navCtrl NavController to use. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ goToGrades(courseId: number, userId?: number, moduleId?: number, navCtrl?: NavController, siteId?: string): Promise { @@ -485,11 +485,11 @@ export class CoreGradesHelperProvider { /** * Invalidate the grade items for a certain module. * - * @param {number} courseId ID of the course to invalidate the grades. - * @param {number} [userId] ID of the user to invalidate. If not defined use site's current user. - * @param {number} [groupId] ID of the group to invalidate. Not used for old gradebook table. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise to be resolved when the grades are invalidated. + * @param courseId ID of the course to invalidate the grades. + * @param userId ID of the user to invalidate. If not defined use site's current user. + * @param groupId ID of the group to invalidate. Not used for old gradebook table. + * @param siteId Site ID. If not defined, current site. + * @return Promise to be resolved when the grades are invalidated. */ invalidateGradeModuleItems(courseId: number, userId?: number, groupId?: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -510,9 +510,9 @@ export class CoreGradesHelperProvider { /** * Parses the image and sets it to the row. * - * @param {any} row Formatted grade row object. - * @param {string} text HTML where the image will be rendered. - * @return {any} Row object with the image. + * @param row Formatted grade row object. + * @param text HTML where the image will be rendered. + * @return Row object with the image. */ protected setRowIcon(row: any, text: string): any { text = text.replace('%2F', '/').replace('%2f', '/'); @@ -564,13 +564,13 @@ export class CoreGradesHelperProvider { * * Taken from make_grades_menu on moodlelib.php * - * @param {number} gradingType If positive, max grade you can provide. If negative, scale Id. - * @param {number} [moduleId] Module ID. Used to retrieve the scale items when they are not passed as parameter. - * If the user does not have permision to manage the activity an empty list is returned. - * @param {string} [defaultLabel] Element that will become default option, if not defined, it won't be added. - * @param {any} [defaultValue] Element that will become default option value. Default ''. - * @param {string} [scale] Scale csv list String. If not provided, it will take it from the module grade info. - * @return {Promise} Array with objects with value and label to create a propper HTML select. + * @param gradingType If positive, max grade you can provide. If negative, scale Id. + * @param moduleId Module ID. Used to retrieve the scale items when they are not passed as parameter. + * If the user does not have permision to manage the activity an empty list is returned. + * @param defaultLabel Element that will become default option, if not defined, it won't be added. + * @param defaultValue Element that will become default option value. Default ''. + * @param scale Scale csv list String. If not provided, it will take it from the module grade info. + * @return Array with objects with value and label to create a propper HTML select. */ makeGradesMenu(gradingType: number, moduleId?: number, defaultLabel: string = '', defaultValue: any = '', scale?: string): Promise { diff --git a/src/core/grades/providers/mainmenu-handler.ts b/src/core/grades/providers/mainmenu-handler.ts index fe3b96a77..389c4f3b3 100644 --- a/src/core/grades/providers/mainmenu-handler.ts +++ b/src/core/grades/providers/mainmenu-handler.ts @@ -29,7 +29,7 @@ export class CoreGradesMainMenuHandler implements CoreMainMenuHandler { /** * Check if the handler is enabled on a site level. * - * @return {boolean | Promise} 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 { return this.gradesProvider.isCourseGradesEnabled(); @@ -38,7 +38,7 @@ export class CoreGradesMainMenuHandler implements CoreMainMenuHandler { /** * 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 { return { diff --git a/src/core/grades/providers/overview-link-handler.ts b/src/core/grades/providers/overview-link-handler.ts index 1f34a82b0..7794d17d5 100644 --- a/src/core/grades/providers/overview-link-handler.ts +++ b/src/core/grades/providers/overview-link-handler.ts @@ -33,11 +33,11 @@ export class CoreGradesOverviewLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -52,11 +52,11 @@ export class CoreGradesOverviewLinkHandler extends CoreContentLinksHandlerBase { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return this.gradesProvider.isCourseGradesEnabled(siteId); diff --git a/src/core/grades/providers/user-handler.ts b/src/core/grades/providers/user-handler.ts index 20d1d3a49..41d79addf 100644 --- a/src/core/grades/providers/user-handler.ts +++ b/src/core/grades/providers/user-handler.ts @@ -35,8 +35,8 @@ export class CoreGradesUserHandler implements CoreUserProfileHandler { * Clear view grades cache. * If a courseId and userId are specified, it will only delete the entry for that user and course. * - * @param {number} [courseId] Course ID. - * @param {number} [userId] User ID. + * @param courseId Course ID. + * @param userId User ID. */ clearViewGradesCache(courseId?: number, userId?: number): void { if (courseId && userId) { @@ -49,9 +49,9 @@ export class CoreGradesUserHandler implements CoreUserProfileHandler { /** * Get a cache key to identify a course and a user. * - * @param {number} courseId Course ID. - * @param {number} userId User ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @param userId User ID. + * @return Cache key. */ protected getCacheKey(courseId: number, userId: number): string { return courseId + '#' + userId; @@ -60,7 +60,7 @@ export class CoreGradesUserHandler implements CoreUserProfileHandler { /** * Check if handler is enabled. * - * @return {boolean} Always enabled. + * @return Always enabled. */ isEnabled(): boolean { return true; @@ -69,11 +69,11 @@ export class CoreGradesUserHandler implements CoreUserProfileHandler { /** * Check if handler is enabled for this user in this context. * - * @param {any} user User to check. - * @param {number} courseId Course ID. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} Promise resolved with true if enabled, resolved with false otherwise. + * @param user User to check. + * @param courseId Course ID. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved with true if enabled, resolved with false otherwise. */ isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise { const cacheKey = this.getCacheKey(courseId, user.id), @@ -98,7 +98,7 @@ export class CoreGradesUserHandler implements CoreUserProfileHandler { /** * 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 { return { diff --git a/src/core/grades/providers/user-link-handler.ts b/src/core/grades/providers/user-link-handler.ts index a6952f917..9235c6d04 100644 --- a/src/core/grades/providers/user-link-handler.ts +++ b/src/core/grades/providers/user-link-handler.ts @@ -33,12 +33,12 @@ export class CoreGradesUserLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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 {any} [data] Extra data to handle the URL. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @param data Extra data to handle the URL. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number, data?: any): CoreContentLinksAction[] | Promise { @@ -59,11 +59,11 @@ export class CoreGradesUserLinkHandler extends CoreContentLinksHandlerBase { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { if (!courseId && !params.id) { diff --git a/src/core/login/pages/credentials/credentials.ts b/src/core/login/pages/credentials/credentials.ts index fbf6eb574..41c0b541f 100644 --- a/src/core/login/pages/credentials/credentials.ts +++ b/src/core/login/pages/credentials/credentials.ts @@ -100,8 +100,8 @@ export class CoreLoginCredentialsPage { * Check if a site uses local_mobile, requires SSO login, etc. * This should be used only if a fixed URL is set, otherwise this check is already performed in CoreLoginSitePage. * - * @param {string} siteUrl Site URL to check. - * @return {Promise} Promise resolved when done. + * @param siteUrl Site URL to check. + * @return Promise resolved when done. */ protected checkSite(siteUrl: string): Promise { this.pageLoaded = false; @@ -168,7 +168,7 @@ export class CoreLoginCredentialsPage { /** * Tries to authenticate the user. * - * @param {Event} [e] Event. + * @param e Event. */ login(e?: Event): void { if (e) { @@ -245,7 +245,7 @@ export class CoreLoginCredentialsPage { /** * An OAuth button was clicked. * - * @param {any} provider The provider that was clicked. + * @param provider The provider that was clicked. */ oauthClicked(provider: any): void { if (!this.loginHelper.openBrowserForOAuthLogin(this.siteUrl, provider, this.siteConfig.launchurl)) { diff --git a/src/core/login/pages/email-signup/email-signup.ts b/src/core/login/pages/email-signup/email-signup.ts index 128a37f67..25ecd0e2e 100644 --- a/src/core/login/pages/email-signup/email-signup.ts +++ b/src/core/login/pages/email-signup/email-signup.ts @@ -187,8 +187,8 @@ export class CoreLoginEmailSignupPage { /** * Treat the site config, checking if it's valid and extracting the data we're interested in. * - * @param {any} siteConfig Site config to treat. - * @return {boolean} True if success. + * @param siteConfig Site config to treat. + * @return True if success. */ protected treatSiteConfig(siteConfig: any): boolean { if (siteConfig && siteConfig.registerauth == 'email' && !this.loginHelper.isEmailSignupDisabled(siteConfig)) { @@ -212,7 +212,7 @@ export class CoreLoginEmailSignupPage { /** * Pull to refresh. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshSettings(refresher: any): void { this.fetchData().finally(() => { @@ -223,7 +223,7 @@ export class CoreLoginEmailSignupPage { /** * Create account. * - * @param {Event} e Event. + * @param e Event. */ create(e: Event): void { e.preventDefault(); @@ -292,8 +292,8 @@ export class CoreLoginEmailSignupPage { /** * Escape mail to avoid special characters to be treated as a RegExp. * - * @param {string} text Initial mail. - * @return {string} Escaped mail. + * @param text Initial mail. + * @return Escaped mail. */ escapeMail(text: string): string { return this.textUtils.escapeForRegex(text); @@ -316,7 +316,7 @@ export class CoreLoginEmailSignupPage { /** * Verify Age. * - * @param {Event} e Event. + * @param e Event. */ verifyAge(e: Event): void { e.preventDefault(); diff --git a/src/core/login/pages/forgotten-password/forgotten-password.ts b/src/core/login/pages/forgotten-password/forgotten-password.ts index e4b3be972..e2e2805a4 100644 --- a/src/core/login/pages/forgotten-password/forgotten-password.ts +++ b/src/core/login/pages/forgotten-password/forgotten-password.ts @@ -44,7 +44,7 @@ export class CoreLoginForgottenPasswordPage { /** * Request to reset the password. * - * @param {Event} e Event. + * @param e Event. */ resetPassword(e: Event): void { e.preventDefault(); diff --git a/src/core/login/pages/init/init.ts b/src/core/login/pages/init/init.ts index 3cadcccfb..d7691fd04 100644 --- a/src/core/login/pages/init/init.ts +++ b/src/core/login/pages/init/init.ts @@ -81,7 +81,7 @@ export class CoreLoginInitPage { /** * Load the right page. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected loadPage(): Promise { if (this.sitesProvider.isLoggedIn()) { diff --git a/src/core/login/pages/reconnect/reconnect.ts b/src/core/login/pages/reconnect/reconnect.ts index c653e51a6..5dc8ca1fa 100644 --- a/src/core/login/pages/reconnect/reconnect.ts +++ b/src/core/login/pages/reconnect/reconnect.ts @@ -102,7 +102,7 @@ export class CoreLoginReconnectPage { /** * Cancel reconnect. * - * @param {Event} [e] Event. + * @param e Event. */ cancel(e?: Event): void { if (e) { @@ -116,7 +116,7 @@ export class CoreLoginReconnectPage { /** * Tries to authenticate the user. * - * @param {Event} e Event. + * @param e Event. */ login(e: Event): void { e.preventDefault(); @@ -185,7 +185,7 @@ export class CoreLoginReconnectPage { /** * An OAuth button was clicked. * - * @param {any} provider The provider that was clicked. + * @param provider The provider that was clicked. */ oauthClicked(provider: any): void { if (!this.loginHelper.openBrowserForOAuthLogin(this.siteUrl, provider, this.siteConfig.launchurl)) { diff --git a/src/core/login/pages/site-policy/site-policy.ts b/src/core/login/pages/site-policy/site-policy.ts index e97d54be4..265505ad6 100644 --- a/src/core/login/pages/site-policy/site-policy.ts +++ b/src/core/login/pages/site-policy/site-policy.ts @@ -71,7 +71,7 @@ export class CoreLoginSitePolicyPage { /** * Fetch the site policy URL. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected fetchSitePolicy(): Promise { return this.loginHelper.getSitePolicy(this.siteId).then((sitePolicy) => { diff --git a/src/core/login/pages/site/site.ts b/src/core/login/pages/site/site.ts index 856797acd..55aafa984 100644 --- a/src/core/login/pages/site/site.ts +++ b/src/core/login/pages/site/site.ts @@ -65,8 +65,8 @@ export class CoreLoginSitePage { /** * Try to connect to a site. * - * @param {Event} e Event. - * @param {string} url The URL to connect to. + * @param e Event. + * @param url The URL to connect to. */ connect(e: Event, url: string): void { e.preventDefault(); @@ -135,7 +135,7 @@ export class CoreLoginSitePage { /** * The filter has changed. * - * @param {any} Received Event. + * @param Received Event. */ filterChanged(event: any): void { const newValue = event.target.value && event.target.value.trim().toLowerCase(); @@ -159,8 +159,8 @@ export class CoreLoginSitePage { /** * Show an error that aims people to solve the issue. * - * @param {string} url The URL the user was trying to connect to. - * @param {any} error Error to display. + * @param url The URL the user was trying to connect to. + * @param error Error to display. */ protected showLoginIssue(url: string, error: any): void { const modal = this.modalCtrl.create('CoreLoginSiteErrorPage', { diff --git a/src/core/login/pages/sites/sites.ts b/src/core/login/pages/sites/sites.ts index 2fcbc96ab..48719413a 100644 --- a/src/core/login/pages/sites/sites.ts +++ b/src/core/login/pages/sites/sites.ts @@ -77,8 +77,8 @@ export class CoreLoginSitesPage { /** * Delete a site. * - * @param {Event} e Click event. - * @param {number} index Position of the site. + * @param e Click event. + * @param index Position of the site. */ deleteSite(e: Event, index: number): void { e.stopPropagation(); @@ -112,7 +112,7 @@ export class CoreLoginSitesPage { /** * Login in a site. * - * @param {string} siteId The site ID. + * @param siteId The site ID. */ login(siteId: string): void { const modal = this.domUtils.showModalLoading(); diff --git a/src/core/login/providers/helper.ts b/src/core/login/providers/helper.ts index 9d46e536a..d46ad4a3e 100644 --- a/src/core/login/providers/helper.ts +++ b/src/core/login/providers/helper.ts @@ -39,31 +39,26 @@ import { Md5 } from 'ts-md5/dist/md5'; export interface CoreLoginSSOData { /** * The site's URL. - * @type {string} */ siteUrl: string; /** * User's token. - * @type {string} */ token?: string; /** * User's private token. - * @type {string} */ privateToken?: string; /** * Name of the page to go after authenticated. - * @type {string} */ pageName?: string; /** * Params to page to the page. - * @type {string} */ pageParams?: any; } @@ -102,8 +97,8 @@ export class CoreLoginHelperProvider { /** * Accept site policy. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success, rejected if failure. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success, rejected if failure. */ acceptSitePolicy(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -133,8 +128,8 @@ export class CoreLoginHelperProvider { /** * Function to handle URL received by Custom URL Scheme. If it's a SSO login, perform authentication. * - * @param {string} url URL received. - * @return {boolean} True if it's a SSO URL, false otherwise. + * @param url URL received. + * @return True if it's a SSO URL, false otherwise. * @deprecated Please use CoreCustomURLSchemesProvider.handleCustomURL instead. */ appLaunchedByURL(url: string): boolean { @@ -209,8 +204,8 @@ export class CoreLoginHelperProvider { /** * Check if a site allows requesting a password reset through the app. * - * @param {string} siteUrl URL of the site. - * @return {Promise} Promise resolved with boolean: whether can be done through the app. + * @param siteUrl URL of the site. + * @return Promise resolved with boolean: whether can be done through the app. */ canRequestPasswordReset(siteUrl: string): Promise { return this.requestPasswordReset(siteUrl).then(() => { @@ -236,11 +231,10 @@ export class CoreLoginHelperProvider { /** * Show a confirm modal if needed and open a browser to perform SSO login. * - * @param {string} siteurl URL of the site where the SSO login will be performed. - * @param {number} typeOfLogin CoreConstants.LOGIN_SSO_CODE or CoreConstants.LOGIN_SSO_INAPP_CODE. - * @param {string} [service] The service to use. If not defined, external service will be used. - * @param {string} [launchUrl] The URL to open for SSO. If not defined, local_mobile launch URL will be used. - * @return {Void} + * @param siteurl URL of the site where the SSO login will be performed. + * @param typeOfLogin CoreConstants.LOGIN_SSO_CODE or CoreConstants.LOGIN_SSO_INAPP_CODE. + * @param service The service to use. If not defined, external service will be used. + * @param launchUrl The URL to open for SSO. If not defined, local_mobile launch URL will be used. */ confirmAndOpenBrowserForSSOLogin(siteUrl: string, typeOfLogin: number, service?: string, launchUrl?: string): void { // Show confirm only if it's needed. Treat "false" (string) as false to prevent typing errors. @@ -263,10 +257,10 @@ export class CoreLoginHelperProvider { /** * Helper function to act when the forgotten password is clicked. * - * @param {NavController} navCtrl NavController to use to navigate. - * @param {string} siteUrl Site URL. - * @param {string} username Username. - * @param {any} [siteConfig] Site config. + * @param navCtrl NavController to use to navigate. + * @param siteUrl Site URL. + * @param username Username. + * @param siteConfig Site config. */ forgottenPasswordClicked(navCtrl: NavController, siteUrl: string, username: string, siteConfig?: any): void { if (siteConfig && siteConfig.forgottenpasswordurl) { @@ -295,8 +289,8 @@ export class CoreLoginHelperProvider { /** * Format profile fields, filtering the ones that shouldn't be shown on signup and classifying them in categories. * - * @param {any[]} profileFields Profile fields to format. - * @return {any} Categories with the fields to show in each one. + * @param profileFields Profile fields to format. + * @return Categories with the fields to show in each one. */ formatProfileFieldsForSignup(profileFields: any[]): any { if (!profileFields) { @@ -331,15 +325,15 @@ export class CoreLoginHelperProvider { * Builds an object with error messages for some common errors. * Please notice that this function doesn't support all possible error types. * - * @param {string} [requiredMsg] Code of the string for required error. - * @param {string} [emailMsg] Code of the string for invalid email error. - * @param {string} [patternMsg] Code of the string for pattern not match error. - * @param {string} [urlMsg] Code of the string for invalid url error. - * @param {string} [minlengthMsg] Code of the string for "too short" error. - * @param {string} [maxlengthMsg] Code of the string for "too long" error. - * @param {string} [minMsg] Code of the string for min value error. - * @param {string} [maxMsg] Code of the string for max value error. - * @return {any} Object with the errors. + * @param requiredMsg Code of the string for required error. + * @param emailMsg Code of the string for invalid email error. + * @param patternMsg Code of the string for pattern not match error. + * @param urlMsg Code of the string for invalid url error. + * @param minlengthMsg Code of the string for "too short" error. + * @param maxlengthMsg Code of the string for "too long" error. + * @param minMsg Code of the string for min value error. + * @param maxMsg Code of the string for max value error. + * @return Object with the errors. */ getErrorMessages(requiredMsg?: string, emailMsg?: string, patternMsg?: string, urlMsg?: string, minlengthMsg?: string, maxlengthMsg?: string, minMsg?: string, maxMsg?: string): any { @@ -376,8 +370,8 @@ export class CoreLoginHelperProvider { /** * Get the site policy. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the site policy. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the site policy. */ getSitePolicy(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -397,7 +391,7 @@ export class CoreLoginHelperProvider { /** * Get fixed site or sites. * - * @return {string|any[]} Fixed site or list of fixed sites. + * @return Fixed site or list of fixed sites. */ getFixedSites(): string | any[] { return CoreConfigConstants.siteurl; @@ -406,8 +400,8 @@ export class CoreLoginHelperProvider { /** * Get the valid identity providers from a site config. * - * @param {any} siteConfig Site's public config. - * @return {any[]} Valid identity providers. + * @param siteConfig Site's public config. + * @return Valid identity providers. */ getValidIdentityProviders(siteConfig: any): any[] { const validProviders = [], @@ -429,9 +423,9 @@ export class CoreLoginHelperProvider { * Go to the page to add a new site. * If a fixed URL is configured, go to credentials instead. * - * @param {boolean} [setRoot] True to set the new page as root, false to add it to the stack. - * @param {boolean} [showKeyboard] Whether to show keyboard in the new page. Only if no fixed URL set. - * @return {Promise} Promise resolved when done. + * @param setRoot True to set the new page as root, false to add it to the stack. + * @param showKeyboard Whether to show keyboard in the new page. Only if no fixed URL set. + * @return Promise resolved when done. */ goToAddSite(setRoot?: boolean, showKeyboard?: boolean): Promise { let pageName, @@ -461,10 +455,10 @@ export class CoreLoginHelperProvider { /** * Open a page that doesn't belong to any site. * - * @param {NavController} [navCtrl] Nav Controller. - * @param {string} [page] Page to open. - * @param {any} [params] Params of the page. - * @return {Promise} Promise resolved when done. + * @param navCtrl Nav Controller. + * @param page Page to open. + * @param params Params of the page. + * @return Promise resolved when done. */ goToNoSitePage(navCtrl: NavController, page: string, params?: any): Promise { navCtrl = navCtrl || this.appProvider.getRootNavController(); @@ -498,12 +492,12 @@ export class CoreLoginHelperProvider { /** * Go to the initial page of a site depending on 'userhomepage' setting. * - * @param {NavController} [navCtrl] NavController to use. Defaults to app root NavController. - * @param {string} [page] Name of the page to load after loading the main page. - * @param {any} [params] Params to pass to the page. - * @param {NavOptions} [options] Navigation options. - * @param {string} [url] URL to open once the main menu is loaded. - * @return {Promise} Promise resolved when done. + * @param navCtrl NavController to use. Defaults to app root NavController. + * @param page Name of the page to load after loading the main page. + * @param params Params to pass to the page. + * @param options Navigation options. + * @param url URL to open once the main menu is loaded. + * @return Promise resolved when done. */ goToSiteInitialPage(navCtrl?: NavController, page?: string, params?: any, options?: NavOptions, url?: string): Promise { return this.openMainMenu(navCtrl, page, params, options, url); @@ -513,10 +507,10 @@ export class CoreLoginHelperProvider { * Convenient helper to handle authentication in the app using a token received by SSO login. If it's a new account, * the site is stored and the user is authenticated. If the account already exists, update its token. * - * @param {string} siteUrl Site's URL. - * @param {string} token User's token. - * @param {string} [privateToken] User's private token. - * @return {Promise} Promise resolved when the user is authenticated with the token. + * @param siteUrl Site's URL. + * @param token User's token. + * @param privateToken User's private token. + * @return Promise resolved when the user is authenticated with the token. */ handleSSOLoginAuthentication(siteUrl: string, token: string, privateToken?: string): Promise { // Always create a new site to prevent overriding data if another user credentials were introduced. @@ -526,7 +520,7 @@ export class CoreLoginHelperProvider { /** * Check if the app is configured to use several fixed URLs. * - * @return {boolean} Whether there are several fixed URLs. + * @return Whether there are several fixed URLs. */ hasSeveralFixedSites(): boolean { return CoreConfigConstants.siteurl && Array.isArray(CoreConfigConstants.siteurl) && @@ -536,7 +530,7 @@ export class CoreLoginHelperProvider { /** * Function called when a page starts loading in any InAppBrowser window. * - * @param {string} url Loaded url. + * @param url Loaded url. * @deprecated */ inAppBrowserLoadStart(url: string): void { @@ -546,8 +540,8 @@ export class CoreLoginHelperProvider { /** * Given a site public config, check if email signup is disabled. * - * @param {any} config Site public config. - * @return {boolean} Whether email signup is disabled. + * @param config Site public config. + * @return Whether email signup is disabled. */ isEmailSignupDisabled(config: any): boolean { let disabledFeatures = config && config.tool_mobile_disabledfeatures; @@ -565,7 +559,7 @@ export class CoreLoginHelperProvider { /** * Check if the app is configured to use a fixed URL (only 1). * - * @return {boolean} Whether there is 1 fixed URL. + * @return Whether there is 1 fixed URL. */ isFixedUrlSet(): boolean { if (Array.isArray(CoreConfigConstants.siteurl)) { @@ -578,9 +572,9 @@ export class CoreLoginHelperProvider { /** * Check if current site is logged out, triggering mmCoreEventSessionExpired if it is. * - * @param {string} [pageName] Name of the page to go once authenticated if logged out. If not defined, site initial page. - * @param {any} [params] Params of the page to go once authenticated if logged out. - * @return {boolean} True if user is logged out, false otherwise. + * @param pageName Name of the page to go once authenticated if logged out. If not defined, site initial page. + * @param params Params of the page to go once authenticated if logged out. + * @return True if user is logged out, false otherwise. */ isSiteLoggedOut(pageName?: string, params?: any): boolean { const site = this.sitesProvider.getCurrentSite(); @@ -603,8 +597,8 @@ export class CoreLoginHelperProvider { /** * Check if SSO login should use an embedded browser. * - * @param {number} code Code to check. - * @return {boolean} True if embedded browser, false othwerise. + * @param code Code to check. + * @return True if embedded browser, false othwerise. */ isSSOEmbeddedBrowser(code: number): boolean { if (this.appProvider.isLinux()) { @@ -618,8 +612,8 @@ export class CoreLoginHelperProvider { /** * Check if SSO login is needed based on code returned by the WS. * - * @param {number} code Code to check. - * @return {boolean} True if SSO login is needed, false othwerise. + * @param code Code to check. + * @return True if SSO login is needed, false othwerise. */ isSSOLoginNeeded(code: number): boolean { return code == CoreConstants.LOGIN_SSO_CODE || code == CoreConstants.LOGIN_SSO_INAPP_CODE; @@ -628,10 +622,10 @@ export class CoreLoginHelperProvider { /** * Load a site and load a certain page in that site. * - * @param {string} page Name of the page to load. - * @param {any} params Params to pass to the page. - * @param {string} siteId Site to load. - * @return {Promise} Promise resolved when done. + * @param page Name of the page to load. + * @param params Params to pass to the page. + * @param siteId Site to load. + * @return Promise resolved when done. */ protected loadSiteAndPage(page: string, params: any, siteId: string): Promise { const navCtrl = this.appProvider.getRootNavController(); @@ -658,8 +652,8 @@ export class CoreLoginHelperProvider { /** * Load a certain page in the main menu page. * - * @param {string} page Name of the page to load. - * @param {any} params Params to pass to the page. + * @param page Name of the page to load. + * @param params Params to pass to the page. */ loadPageInMainMenu(page: string, params: any): void { if (!this.appProvider.isMainMenuOpen()) { @@ -684,12 +678,12 @@ export class CoreLoginHelperProvider { /** * Open the main menu, loading a certain page. * - * @param {NavController} navCtrl NavController. - * @param {string} page Name of the page to load. - * @param {any} params Params to pass to the page. - * @param {NavOptions} [options] Navigation options. - * @param {string} [url] URL to open once the main menu is loaded. - * @return {Promise} Promise resolved when done. + * @param navCtrl NavController. + * @param page Name of the page to load. + * @param params Params to pass to the page. + * @param options Navigation options. + * @param url URL to open once the main menu is loaded. + * @return Promise resolved when done. */ protected openMainMenu(navCtrl: NavController, page: string, params: any, options?: NavOptions, url?: string): Promise { navCtrl = navCtrl || this.appProvider.getRootNavController(); @@ -712,12 +706,12 @@ export class CoreLoginHelperProvider { /** * Open a browser to perform OAuth login (Google, Facebook, Microsoft). * - * @param {string} siteUrl URL of the site where the login will be performed. - * @param {any} provider The identity provider. - * @param {string} [launchUrl] The URL to open for SSO. If not defined, tool/mobile launch URL will be used. - * @param {string} [pageName] Name of the page to go once authenticated. If not defined, site initial page. - * @param {any} [pageParams] Params of the state to go once authenticated. - * @return {boolean} True if success, false if error. + * @param siteUrl URL of the site where the login will be performed. + * @param provider The identity provider. + * @param launchUrl The URL to open for SSO. If not defined, tool/mobile launch URL will be used. + * @param pageName Name of the page to go once authenticated. If not defined, site initial page. + * @param pageParams Params of the state to go once authenticated. + * @return True if success, false if error. */ openBrowserForOAuthLogin(siteUrl: string, provider: any, launchUrl?: string, pageName?: string, pageParams?: any): boolean { launchUrl = launchUrl || siteUrl + '/admin/tool/mobile/launch.php'; @@ -752,12 +746,12 @@ export class CoreLoginHelperProvider { /** * Open a browser to perform SSO login. * - * @param {string} siteurl URL of the site where the SSO login will be performed. - * @param {number} typeOfLogin CoreConstants.LOGIN_SSO_CODE or CoreConstants.LOGIN_SSO_INAPP_CODE. - * @param {string} [service] The service to use. If not defined, external service will be used. - * @param {string} [launchUrl] The URL to open for SSO. If not defined, local_mobile launch URL will be used. - * @param {string} [pageName] Name of the page to go once authenticated. If not defined, site initial page. - * @param {any} [pageParams] Params of the state to go once authenticated. + * @param siteurl URL of the site where the SSO login will be performed. + * @param typeOfLogin CoreConstants.LOGIN_SSO_CODE or CoreConstants.LOGIN_SSO_INAPP_CODE. + * @param service The service to use. If not defined, external service will be used. + * @param launchUrl The URL to open for SSO. If not defined, local_mobile launch URL will be used. + * @param pageName Name of the page to go once authenticated. If not defined, site initial page. + * @param pageParams Params of the state to go once authenticated. */ openBrowserForSSOLogin(siteUrl: string, typeOfLogin: number, service?: string, launchUrl?: string, pageName?: string, pageParams?: any): void { @@ -780,8 +774,8 @@ export class CoreLoginHelperProvider { /** * Convenient helper to open change password page. * - * @param {string} siteUrl Site URL to construct change password URL. - * @param {string} error Error message. + * @param siteUrl Site URL to construct change password URL. + * @param error Error message. */ openChangePassword(siteUrl: string, error: string): void { this.domUtils.showAlert(this.translate.instant('core.notice'), error, undefined, 3000).then((alert) => { @@ -796,7 +790,7 @@ export class CoreLoginHelperProvider { /** * Open forgotten password in inappbrowser. * - * @param {string} siteUrl URL of the site. + * @param siteUrl URL of the site. */ openForgottenPassword(siteUrl: string): void { this.utils.openInApp(siteUrl + '/login/forgot_password.php'); @@ -805,10 +799,10 @@ export class CoreLoginHelperProvider { /* * Function to open in app browser to change password or complete user profile. * - * @param {string} siteId The site ID. - * @param {string} path The relative path of the URL to open. - * @param {string} alertMessage The key of the message to display before opening the in app browser. - * @param {boolean} [invalidateCache] Whether to invalidate site's cache (e.g. when the user is forced to change password). + * @param siteId The site ID. + * @param path The relative path of the URL to open. + * @param alertMessage The key of the message to display before opening the in app browser. + * @param invalidateCache Whether to invalidate site's cache (e.g. when the user is forced to change password). */ openInAppForEdit(siteId: string, path: string, alertMessage: string, invalidateCache?: boolean): void { if (!siteId || siteId !== this.sitesProvider.getCurrentSiteId()) { @@ -842,11 +836,11 @@ export class CoreLoginHelperProvider { /** * Prepare the app to perform SSO login. * - * @param {string} siteUrl URL of the site where the SSO login will be performed. - * @param {string} [service] The service to use. If not defined, external service will be used. - * @param {string} [launchUrl] The URL to open for SSO. If not defined, local_mobile launch URL will be used. - * @param {string} [pageName] Name of the page to go once authenticated. If not defined, site initial page. - * @param {any} [pageParams] Params of the state to go once authenticated. + * @param siteUrl URL of the site where the SSO login will be performed. + * @param service The service to use. If not defined, external service will be used. + * @param launchUrl The URL to open for SSO. If not defined, local_mobile launch URL will be used. + * @param pageName Name of the page to go once authenticated. If not defined, site initial page. + * @param pageParams Params of the state to go once authenticated. */ prepareForSSOLogin(siteUrl: string, service?: string, launchUrl?: string, pageName?: string, pageParams?: any): string { service = service || CoreConfigConstants.wsextservice; @@ -873,10 +867,10 @@ export class CoreLoginHelperProvider { /** * Redirect to a new page, setting it as the root page and loading the right site if needed. * - * @param {string} page Name of the page to load. Special cases: OPEN_COURSE (to open course page). - * @param {any} params Params to pass to the page. - * @param {string} [siteId] Site to load. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param page Name of the page to load. Special cases: OPEN_COURSE (to open course page). + * @param params Params to pass to the page. + * @param siteId Site to load. If not defined, current site. + * @return Promise resolved when done. */ redirect(page: string, params?: any, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -911,10 +905,10 @@ export class CoreLoginHelperProvider { /** * Request a password reset. * - * @param {string} siteUrl URL of the site. - * @param {string} [username] Username to search. - * @param {string} [email] Email to search. - * @return {Promise} Promise resolved when done. + * @param siteUrl URL of the site. + * @param username Username to search. + * @param email Email to search. + * @return Promise resolved when done. */ requestPasswordReset(siteUrl: string, username?: string, email?: string): Promise { const params: any = {}; @@ -933,7 +927,7 @@ export class CoreLoginHelperProvider { /** * Function that should be called when the session expires. Reserved for core use. * - * @param {any} data Data received by the SESSION_EXPIRED event. + * @param data Data received by the SESSION_EXPIRED event. */ sessionExpired(data: any): void { const siteId = data && data.siteId, @@ -1015,8 +1009,8 @@ export class CoreLoginHelperProvider { /** * Check if a confirm should be shown to open a SSO authentication. * - * @param {number} typeOfLogin CoreConstants.LOGIN_SSO_CODE or CoreConstants.LOGIN_SSO_INAPP_CODE. - * @return {boolean} True if confirm modal should be shown, false otherwise. + * @param typeOfLogin CoreConstants.LOGIN_SSO_CODE or CoreConstants.LOGIN_SSO_INAPP_CODE. + * @return True if confirm modal should be shown, false otherwise. */ shouldShowSSOConfirm(typeOfLogin: number): boolean { return !this.isSSOEmbeddedBrowser(typeOfLogin) && @@ -1026,7 +1020,7 @@ export class CoreLoginHelperProvider { /** * Show a modal warning the user that he should use the Classic app. * - * @param {string} message The warning message. + * @param message The warning message. */ protected showLegacyNoticeModal(message: string): void { let link; @@ -1048,7 +1042,7 @@ export class CoreLoginHelperProvider { /** * Show a modal warning the user that he should use the Workplace app. * - * @param {string} message The warning message. + * @param message The warning message. */ protected showWorkplaceNoticeModal(message: string): void { let link; @@ -1065,7 +1059,7 @@ export class CoreLoginHelperProvider { /** * Show a modal warning the user that he should use the current Moodle app. * - * @param {string} message The warning message. + * @param message The warning message. */ protected showMoodleAppNoticeModal(message: string): void { let link; @@ -1089,8 +1083,8 @@ export class CoreLoginHelperProvider { /** * Show a modal warning the user that he should use a different app. * - * @param {string} message The warning message. - * @param {string} link Link to the app to download if any. + * @param message The warning message. + * @param link Link to the app to download if any. */ protected showDownloadAppNoticeModal(message: string, link?: string): void { const buttons: any[] = [ @@ -1127,10 +1121,10 @@ export class CoreLoginHelperProvider { /** * Show a modal to inform the user that a confirmation email was sent, and a button to resend the email on 3.6+ sites. * - * @param {string} siteUrl Site URL. - * @param {string} [email] Email of the user. If set displayed in the message. - * @param {string} [username] Username. If not set the button to resend email will not be shown. - * @param {string} [password] User password. If not set the button to resend email will not be shown. + * @param siteUrl Site URL. + * @param email Email of the user. If set displayed in the message. + * @param username Username. If not set the button to resend email will not be shown. + * @param password User password. If not set the button to resend email will not be shown. */ protected showNotConfirmedModal(siteUrl: string, email?: string, username?: string, password?: string): void { const title = this.translate.instant('core.login.mustconfirm'); @@ -1187,7 +1181,7 @@ export class CoreLoginHelperProvider { /** * Function called when site policy is not agreed. Reserved for core use. * - * @param {string} [siteId] Site ID. If not defined, current site. + * @param siteId Site ID. If not defined, current site. */ sitePolicyNotAgreed(siteId?: string): void { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -1215,10 +1209,10 @@ export class CoreLoginHelperProvider { /** * Convenient helper to handle get User Token error. It redirects to change password page if forcepassword is set. * - * @param {string} siteUrl Site URL to construct change password URL. - * @param {any} error Error object containing errorcode and error message. - * @param {string} [username] Username. - * @param {string} [password] User password. + * @param siteUrl Site URL to construct change password URL. + * @param error Error object containing errorcode and error message. + * @param username Username. + * @param password User password. */ treatUserTokenError(siteUrl: string, error: any, username?: string, password?: string): void { if (error.errorcode == 'forcepasswordchangenotice') { @@ -1239,8 +1233,8 @@ export class CoreLoginHelperProvider { /** * Convenient helper to validate a browser SSO login. * - * @param {string} url URL received, to be validated. - * @return {Promise} Promise resolved on success. + * @param url URL received, to be validated. + * @return Promise resolved on success. */ validateBrowserSSOLogin(url: string): Promise { // Split signature:::token diff --git a/src/core/mainmenu/pages/menu/menu.ts b/src/core/mainmenu/pages/menu/menu.ts index d06d413c2..afda6473a 100644 --- a/src/core/mainmenu/pages/menu/menu.ts +++ b/src/core/mainmenu/pages/menu/menu.ts @@ -187,7 +187,7 @@ export class CoreMainMenuPage implements OnDestroy { /** * Handle a redirect. * - * @param {any} data Data received. + * @param data Data received. */ protected handleRedirect(data: any): void { // Check if the redirect page is the root page of any of the tabs. diff --git a/src/core/mainmenu/pages/more/more.ts b/src/core/mainmenu/pages/more/more.ts index c91d984bb..09dd27b06 100644 --- a/src/core/mainmenu/pages/more/more.ts +++ b/src/core/mainmenu/pages/more/more.ts @@ -124,7 +124,7 @@ export class CoreMainMenuMorePage implements OnDestroy { /** * Open a handler. * - * @param {CoreMainMenuHandlerData} handler Handler to open. + * @param handler Handler to open. */ openHandler(handler: CoreMainMenuHandlerData): void { this.navCtrl.push(handler.page, handler.pageParams); @@ -133,7 +133,7 @@ export class CoreMainMenuMorePage implements OnDestroy { /** * Open an embedded custom item. * - * @param {CoreMainMenuCustomItem} item Item to open. + * @param item Item to open. */ openItem(item: CoreMainMenuCustomItem): void { this.navCtrl.push('CoreViewerIframePage', {title: item.label, url: item.url}); diff --git a/src/core/mainmenu/providers/delegate.ts b/src/core/mainmenu/providers/delegate.ts index a32d6e040..f42550d8b 100644 --- a/src/core/mainmenu/providers/delegate.ts +++ b/src/core/mainmenu/providers/delegate.ts @@ -25,14 +25,13 @@ import { Subject, BehaviorSubject } from 'rxjs'; export interface CoreMainMenuHandler extends CoreDelegateHandler { /** * The highest priority is displayed first. - * @type {number} */ priority: number; /** * Returns the data needed to render the handler. * - * @return {CoreMainMenuHandlerData} Data. + * @return Data. */ getDisplayData(): CoreMainMenuHandlerData; } @@ -43,55 +42,46 @@ export interface CoreMainMenuHandler extends CoreDelegateHandler { export interface CoreMainMenuHandlerData { /** * Name of the page to load for the handler. - * @type {string} */ page: string; /** * Title to display for the handler. - * @type {string} */ title: string; /** * Name of the icon to display for the handler. - * @type {string} */ icon: string; // Name of the icon to display in the tab. /** * Class to add to the displayed handler. - * @type {string} */ class?: string; /** * If the handler has badge to show or not. - * @type {boolean} */ showBadge?: boolean; /** * Text to display on the badge. Only used if showBadge is true. - * @type {string} */ badge?: string; /** * If true, the badge number is being loaded. Only used if showBadge is true. - * @type {boolean} */ loading?: boolean; /** * Params to pass to the page. - * @type {any} */ pageParams?: any; /** * Whether the handler should only appear in More menu. - * @type {boolean} */ onlyInMore?: boolean; } @@ -102,19 +92,16 @@ export interface CoreMainMenuHandlerData { export interface CoreMainMenuHandlerToDisplay extends CoreMainMenuHandlerData { /** * Name of the handler. - * @type {string} */ name?: string; /** * Priority of the handler. - * @type {number} */ priority?: number; /** * Hide tab. Used then resizing. - * @type {[type]} */ hide?: boolean; } @@ -139,7 +126,7 @@ export class CoreMainMenuDelegate extends CoreDelegate { /** * Check if handlers are loaded. * - * @return {boolean} True if handlers are loaded, false otherwise. + * @return True if handlers are loaded, false otherwise. */ areHandlersLoaded(): boolean { return this.loaded; @@ -156,7 +143,7 @@ export class CoreMainMenuDelegate extends CoreDelegate { /** * Get the handlers for the current site. * - * @return {Subject} An observable that will receive the handlers. + * @return An observable that will receive the handlers. */ getHandlers(): Subject { return this.siteHandlers; diff --git a/src/core/mainmenu/providers/mainmenu.ts b/src/core/mainmenu/providers/mainmenu.ts index d601956c4..8181b1067 100644 --- a/src/core/mainmenu/providers/mainmenu.ts +++ b/src/core/mainmenu/providers/mainmenu.ts @@ -26,25 +26,21 @@ import { CoreMainMenuDelegate, CoreMainMenuHandlerToDisplay } from './delegate'; export interface CoreMainMenuCustomItem { /** * Type of the item: app, inappbrowser, browser or embedded. - * @type {string} */ type: string; /** * Url of the item. - * @type {string} */ url: string; /** * Label to display for the item. - * @type {string} */ label: string; /** * Name of the icon to display for the item. - * @type {string} */ icon: string; } @@ -66,7 +62,7 @@ export class CoreMainMenuProvider { /** * Get the current main menu handlers. * - * @return {Promise} Promise resolved with the current main menu handlers. + * @return Promise resolved with the current main menu handlers. */ getCurrentMainMenuHandlers(): Promise { const deferred = this.utils.promiseDefer(); @@ -89,8 +85,8 @@ export class CoreMainMenuProvider { /** * Get a list of custom menu items for a certain site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} List of custom menu items. + * @param siteId Site ID. If not defined, current site. + * @return List of custom menu items. */ getCustomMenuItems(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -193,7 +189,7 @@ export class CoreMainMenuProvider { /** * Get the number of items to be shown on the main menu bar. * - * @return {number} Number of items depending on the device width. + * @return Number of items depending on the device width. */ getNumItems(): number { if (!this.isResponsiveMainMenuItemsDisabledInCurrentSite() && window && window.innerWidth) { @@ -219,8 +215,8 @@ export class CoreMainMenuProvider { /** * Get tabs placement depending on the device size. * - * @param {NavController} navCtrl NavController to resize the content. - * @return {string} Tabs placement including side value. + * @param navCtrl NavController to resize the content. + * @return Tabs placement including side value. */ getTabPlacement(navCtrl: NavController): string { const tablet = window && window.innerWidth && window.innerWidth >= 576 && window.innerHeight >= 576; @@ -240,9 +236,9 @@ export class CoreMainMenuProvider { /** * Check if a certain page is the root of a main menu handler currently displayed. * - * @param {string} page Name of the page. - * @param {string} [pageParams] Page params. - * @return {Promise} Promise resolved with boolean: whether it's the root of a main menu handler. + * @param page Name of the page. + * @param pageParams Page params. + * @return Promise resolved with boolean: whether it's the root of a main menu handler. */ isCurrentMainMenuHandler(pageName: string, pageParams?: any): Promise { return this.getCurrentMainMenuHandlers().then((handlers) => { @@ -257,7 +253,7 @@ export class CoreMainMenuProvider { /** * Check if responsive main menu items is disabled in the current site. * - * @return {boolean} Whether it's disabled. + * @return Whether it's disabled. */ protected isResponsiveMainMenuItemsDisabledInCurrentSite(): boolean { const site = this.sitesProvider.getCurrentSite(); diff --git a/src/core/pushnotifications/providers/delegate.ts b/src/core/pushnotifications/providers/delegate.ts index 8f64a4ed5..e15e28c60 100644 --- a/src/core/pushnotifications/providers/delegate.ts +++ b/src/core/pushnotifications/providers/delegate.ts @@ -24,36 +24,33 @@ import { Subject } from 'rxjs'; export interface CorePushNotificationsClickHandler { /** * A name to identify the handler. - * @type {string} */ name: string; /** * Handler's priority. The highest priority is treated first. - * @type {number} */ priority?: number; /** * Name of the feature this handler is related to. * It will be used to check if the feature is disabled (@see CoreSite.isFeatureDisabled). - * @type {string} */ featureName?: string; /** * Check if a notification click is handled by this handler. * - * @param {any} notification The notification to check. - * @return {boolean} Whether the notification click is handled by this handler. + * @param notification The notification to check. + * @return Whether the notification click is handled by this handler. */ handles(notification: any): boolean | Promise; /** * Handle the notification click. * - * @param {any} notification The notification to check. - * @return {Promise} Promise resolved when done. + * @param notification The notification to check. + * @return Promise resolved when done. */ handleClick(notification: any): Promise; } @@ -77,8 +74,8 @@ export class CorePushNotificationsDelegate { /** * Function called when a push notification is clicked. Sends notification to handlers. * - * @param {any} notification Notification clicked. - * @return {Promise} Promise resolved when done. + * @param notification Notification clicked. + * @return Promise resolved when done. */ clicked(notification: any): Promise { if (!notification) { @@ -122,9 +119,9 @@ export class CorePushNotificationsDelegate { /** * Check if a handler's feature is disabled for a certain site. * - * @param {CorePushNotificationsClickHandler} handler Handler to check. - * @param {string} siteId The site ID to check. - * @return {Promise} Promise resolved with boolean: whether the handler feature is disabled. + * @param handler Handler to check. + * @param siteId The site ID to check. + * @return Promise resolved with boolean: whether the handler feature is disabled. */ protected isFeatureDisabled(handler: CorePushNotificationsClickHandler, siteId: string): Promise { if (handler.featureName) { @@ -139,7 +136,7 @@ export class CorePushNotificationsDelegate { * Function called when a push notification is received in foreground (cannot tell when it's received in background). * Sends notification to all handlers. * - * @param {any} notification Notification received. + * @param notification Notification received. */ received(notification: any): void { this.observables['receive'].next(notification); @@ -151,8 +148,8 @@ export class CorePushNotificationsDelegate { * ... * observer.unsuscribe(); * - * @param {string} eventName Only receive is permitted. - * @return {Subject} Observer to subscribe. + * @param eventName Only receive is permitted. + * @return Observer to subscribe. */ on(eventName: string): Subject { if (typeof this.observables[eventName] == 'undefined') { @@ -168,8 +165,8 @@ export class CorePushNotificationsDelegate { /** * Register a click handler. * - * @param {CorePushNotificationsClickHandler} handler The handler to register. - * @return {boolean} True if registered successfully, false otherwise. + * @param handler The handler to register. + * @return True if registered successfully, false otherwise. */ registerClickHandler(handler: CorePushNotificationsClickHandler): boolean { if (typeof this.clickHandlers[handler.name] !== 'undefined') { @@ -187,7 +184,7 @@ export class CorePushNotificationsDelegate { /** * Register a push notifications handler for update badge counter. * - * @param {string} name Handler's name. + * @param name Handler's name. */ registerCounterHandler(name: string): void { if (typeof this.counterHandlers[name] == 'undefined') { @@ -201,8 +198,8 @@ export class CorePushNotificationsDelegate { /** * Check if a counter handler is present. * - * @param {string} name Handler's name. - * @return {boolean} If handler name is present. + * @param name Handler's name. + * @return If handler name is present. */ isCounterHandlerRegistered(name: string): boolean { return typeof this.counterHandlers[name] != 'undefined'; @@ -211,7 +208,7 @@ export class CorePushNotificationsDelegate { /** * Get all counter badge handlers. * - * @return {any} with all the handler names. + * @return with all the handler names. */ getCounterHandlers(): any { return this.counterHandlers; diff --git a/src/core/pushnotifications/providers/pushnotifications.ts b/src/core/pushnotifications/providers/pushnotifications.ts index 0985c6b18..8e55142a0 100644 --- a/src/core/pushnotifications/providers/pushnotifications.ts +++ b/src/core/pushnotifications/providers/pushnotifications.ts @@ -40,43 +40,36 @@ import { CoreSite } from '@classes/site'; export interface CorePushNotificationsRegisterData { /** * App ID. - * @type {string} */ appid: string; /** * Device UUID. - * @type {string} */ uuid: string; /** * Device name. - * @type {string} */ name: string; /** * Device model. - * @type {string} */ model: string; /** * Device platform. - * @type {string} */ platform: string; /** * Device version. - * @type {string} */ version: string; /** * Push ID. - * @type {string} */ pushid: string; } @@ -203,7 +196,7 @@ export class CorePushNotificationsProvider { /** * Check whether the device can be registered in Moodle to receive push notifications. * - * @return {boolean} Whether the device can be registered in Moodle. + * @return Whether the device can be registered in Moodle. */ canRegisterOnMoodle(): boolean { return this.pushID && this.appProvider.isMobile(); @@ -212,8 +205,8 @@ export class CorePushNotificationsProvider { /** * Delete all badge records for a given site. * - * @param {string} siteId Site ID. - * @return {Promise} Resolved when done. + * @param siteId Site ID. + * @return Resolved when done. */ cleanSiteCounters(siteId: string): Promise { return this.appDB.deleteRecords(CorePushNotificationsProvider.BADGE_TABLE, {siteid: siteId} ).finally(() => { @@ -224,7 +217,7 @@ export class CorePushNotificationsProvider { /** * Create the default push channel. It is used to change the name. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected createDefaultChannel(): Promise { if (!this.platform.is('android')) { @@ -243,8 +236,8 @@ export class CorePushNotificationsProvider { /** * Enable or disable Firebase analytics. * - * @param {boolean} enable Whether to enable or disable. - * @return {Promise} Promise resolved when done. + * @param enable Whether to enable or disable. + * @return Promise resolved when done. */ enableAnalytics(enable: boolean): Promise { const win = window; // This feature is only present in our fork of the plugin. @@ -264,7 +257,7 @@ export class CorePushNotificationsProvider { /** * Returns options for push notifications based on device. * - * @return {Promise} Promise with the push options resolved when done. + * @return Promise with the push options resolved when done. */ protected getOptions(): Promise { let promise; @@ -297,7 +290,7 @@ export class CorePushNotificationsProvider { /** * Get the pushID for this device. * - * @return {string} Push ID. + * @return Push ID. */ getPushId(): string { return this.pushID; @@ -306,7 +299,7 @@ export class CorePushNotificationsProvider { /** * Get data to register the device in Moodle. * - * @return {CorePushNotificationsRegisterData} Data. + * @return Data. */ protected getRegisterData(): CorePushNotificationsRegisterData { return { @@ -323,8 +316,8 @@ export class CorePushNotificationsProvider { /** * Get Sitebadge counter from the database. * - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved with the stored badge counter for the site. + * @param siteId Site ID. + * @return Promise resolved with the stored badge counter for the site. */ getSiteCounter(siteId: string): Promise { return this.getAddonBadge(siteId); @@ -333,10 +326,10 @@ export class CorePushNotificationsProvider { /** * Log a firebase event. * - * @param {string} name Name of the event. - * @param {any} data Data of the event. - * @param {boolean} [filter] Whether to filter the data. This is useful when logging a full notification. - * @return {Promise} Promise resolved when done. This promise is never rejected. + * @param name Name of the event. + * @param data Data of the event. + * @param filter Whether to filter the data. This is useful when logging a full notification. + * @return Promise resolved when done. This promise is never rejected. */ logEvent(name: string, data: any, filter?: boolean): Promise { const win = window; // This feature is only present in our fork of the plugin. @@ -362,13 +355,13 @@ export class CorePushNotificationsProvider { /** * Log a firebase view_item event. * - * @param {number|string} itemId The item ID. - * @param {string} itemName The item name. - * @param {string} itemCategory The item category. - * @param {string} wsName Name of the WS. - * @param {any} [data] Other data to pass to the event. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. This promise is never rejected. + * @param itemId The item ID. + * @param itemName The item name. + * @param itemCategory The item category. + * @param wsName Name of the WS. + * @param data Other data to pass to the event. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. This promise is never rejected. */ logViewEvent(itemId: number | string, itemName: string, itemCategory: string, wsName: string, data?: any, siteId?: string) : Promise { @@ -395,11 +388,11 @@ export class CorePushNotificationsProvider { /** * Log a firebase view_item_list event. * - * @param {string} itemCategory The item category. - * @param {string} wsName Name of the WS. - * @param {any} [data] Other data to pass to the event. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. This promise is never rejected. + * @param itemCategory The item category. + * @param wsName Name of the WS. + * @param data Other data to pass to the event. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. This promise is never rejected. */ logViewListEvent(itemCategory: string, wsName: string, data?: any, siteId?: string): Promise { data = data || {}; @@ -419,7 +412,7 @@ export class CorePushNotificationsProvider { /** * Function called when a push notification is clicked. Redirect the user to the right state. * - * @param {any} notification Notification. + * @param notification Notification. */ notificationClicked(notification: any): void { this.initDelegate.ready().then(() => { @@ -432,7 +425,7 @@ export class CorePushNotificationsProvider { * The app can be in foreground or background, * if we are in background this code is executed when we open the app clicking in the notification bar. * - * @param {any} notification Notification received. + * @param notification Notification received. */ onMessageReceived(notification: any): void { const data = notification ? notification.additionalData : {}; @@ -510,8 +503,8 @@ export class CorePushNotificationsProvider { /** * Unregisters a device from a certain Moodle site. * - * @param {CoreSite} site Site to unregister from. - * @return {Promise} Promise resolved when device is unregistered. + * @param site Site to unregister from. + * @return Promise resolved when device is unregistered. */ unregisterDeviceOnMoodle(site: CoreSite): Promise { if (!site || !this.appProvider.isMobile()) { @@ -564,10 +557,10 @@ export class CorePushNotificationsProvider { * Update Counter for an addon. It will update the refered siteId counter and the total badge. * It will return the updated addon counter. * - * @param {string} addon Registered addon name to set the badge number. - * @param {number} value The number to be stored. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @return {Promise} Promise resolved with the stored badge counter for the addon on the site. + * @param addon Registered addon name to set the badge number. + * @param value The number to be stored. + * @param siteId Site ID. If not defined, use current site. + * @return Promise resolved with the stored badge counter for the addon on the site. */ updateAddonCounter(addon: string, value: number, siteId?: string): Promise { if (this.pushNotificationsDelegate.isCounterHandlerRegistered(addon)) { @@ -586,7 +579,7 @@ export class CorePushNotificationsProvider { /** * Update total badge counter of the app. * - * @return {Promise} Promise resolved with the stored badge counter for the site. + * @return Promise resolved with the stored badge counter for the site. */ updateAppCounter(): Promise { return this.sitesProvider.getSitesIds().then((sites) => { @@ -618,8 +611,8 @@ export class CorePushNotificationsProvider { * Update counter for a site using the stored addon data. It will update the total badge application number. * It will return the updated site counter. * - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved with the stored badge counter for the site. + * @param siteId Site ID. + * @return Promise resolved with the stored badge counter for the site. */ updateSiteCounter(siteId: string): Promise { const addons = this.pushNotificationsDelegate.getCounterHandlers(), @@ -655,7 +648,7 @@ export class CorePushNotificationsProvider { /** * Register a device in Apple APNS or Google GCM. * - * @return {Promise} Promise resolved when the device is registered. + * @return Promise resolved when the device is registered. */ registerDevice(): Promise { try { @@ -701,9 +694,9 @@ export class CorePushNotificationsProvider { /** * Registers a device on a Moodle site if needed. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [forceUnregister] Whether to force unregister and register. - * @return {Promise} Promise resolved when device is registered. + * @param siteId Site ID. If not defined, current site. + * @param forceUnregister Whether to force unregister and register. + * @return Promise resolved when device is registered. */ registerDeviceOnMoodle(siteId?: string, forceUnregister?: boolean): Promise { this.logger.debug('Register device on Moodle.'); @@ -756,9 +749,9 @@ export class CorePushNotificationsProvider { /** * Get the addon/site badge counter from the database. * - * @param {string} siteId Site ID. - * @param {string} [addon='site'] Registered addon name. If not defined it will store the site total. - * @return {Promise} Promise resolved with the stored badge counter for the addon or site or 0 if none. + * @param siteId Site ID. + * @param addon Registered addon name. If not defined it will store the site total. + * @return Promise resolved with the stored badge counter for the addon or site or 0 if none. */ protected getAddonBadge(siteId?: string, addon: string = 'site'): Promise { return this.appDB.getRecord(CorePushNotificationsProvider.BADGE_TABLE, {siteid: siteId, addon: addon}).then((entry) => { @@ -771,8 +764,8 @@ export class CorePushNotificationsProvider { /** * Retry pending unregisters. * - * @param {string} [siteId] If defined, retry only for that site if needed. Otherwise, retry all pending unregisters. - * @return {Promise} Promise resolved when done. + * @param siteId If defined, retry only for that site if needed. Otherwise, retry all pending unregisters. + * @return Promise resolved when done. */ retryUnregisters(siteId?: string): Promise { let promise; @@ -803,10 +796,10 @@ export class CorePushNotificationsProvider { /** * Save the addon/site badgecounter on the database. * - * @param {number} value The number to be stored. - * @param {string} [siteId] Site ID. If not defined, use current site. - * @param {string} [addon='site'] Registered addon name. If not defined it will store the site total. - * @return {Promise} Promise resolved with the stored badge counter for the addon or site. + * @param value The number to be stored. + * @param siteId Site ID. If not defined, use current site. + * @param addon Registered addon name. If not defined it will store the site total. + * @return Promise resolved with the stored badge counter for the addon or site. */ protected saveAddonBadge(value: number, siteId?: string, addon: string = 'site'): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -825,9 +818,9 @@ export class CorePushNotificationsProvider { /** * Check if device should be registered (and unregistered first). * - * @param {CorePushNotificationsRegisterData} data Data of the device. - * @param {CoreSite} site Site to use. - * @return {Promise<{register: boolean, unregister: boolean}>} Promise resolved with booleans: whether to register/unregister. + * @param data Data of the device. + * @param site Site to use. + * @return Promise resolved with booleans: whether to register/unregister. */ protected shouldRegister(data: CorePushNotificationsRegisterData, site: CoreSite) : Promise<{register: boolean, unregister: boolean}> { diff --git a/src/core/pushnotifications/providers/register-cron-handler.ts b/src/core/pushnotifications/providers/register-cron-handler.ts index e2bc48b2c..ea03c062f 100644 --- a/src/core/pushnotifications/providers/register-cron-handler.ts +++ b/src/core/pushnotifications/providers/register-cron-handler.ts @@ -28,7 +28,7 @@ export class CorePushNotificationsRegisterCronHandler implements CoreCronHandler /** * Check whether the sync can be executed manually. Call isSync if not defined. * - * @return {boolean} Whether the sync can be executed manually. + * @return Whether the sync can be executed manually. */ canManualSync(): boolean { return true; // Execute the handler when the site is manually synchronized. @@ -38,8 +38,8 @@ export class CorePushNotificationsRegisterCronHandler implements CoreCronHandler * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string): Promise { if (!siteId || !this.pushNotificationsProvider.canRegisterOnMoodle()) { @@ -54,7 +54,7 @@ export class CorePushNotificationsRegisterCronHandler implements CoreCronHandler /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return 86400000; // 1 day. We won't do anything with automatic execution, so use a big number. @@ -63,7 +63,7 @@ export class CorePushNotificationsRegisterCronHandler implements CoreCronHandler /** * Check whether it's a synchronization process or not. True if not defined. * - * @return {boolean} Whether it's a synchronization process or not. + * @return Whether it's a synchronization process or not. */ isSync(): boolean { return false; diff --git a/src/core/pushnotifications/providers/unregister-cron-handler.ts b/src/core/pushnotifications/providers/unregister-cron-handler.ts index f533efaa0..a2c87c179 100644 --- a/src/core/pushnotifications/providers/unregister-cron-handler.ts +++ b/src/core/pushnotifications/providers/unregister-cron-handler.ts @@ -29,8 +29,8 @@ export class CorePushNotificationsUnregisterCronHandler implements CoreCronHandl * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string): Promise { return this.pushNotificationsProvider.retryUnregisters(siteId); @@ -39,7 +39,7 @@ export class CorePushNotificationsUnregisterCronHandler implements CoreCronHandl /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return 300000; diff --git a/src/core/question/classes/base-behaviour-handler.ts b/src/core/question/classes/base-behaviour-handler.ts index 8da0309ac..88bf3ed61 100644 --- a/src/core/question/classes/base-behaviour-handler.ts +++ b/src/core/question/classes/base-behaviour-handler.ts @@ -31,11 +31,11 @@ export class CoreQuestionBehaviourBaseHandler implements CoreQuestionBehaviourHa /** * Determine a question new state based on its answer(s). * - * @param {string} component Component the question belongs to. - * @param {number} attemptId Attempt ID the question belongs to. - * @param {any} question The question. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {CoreQuestionState|Promise} New state (or promise resolved with state). + * @param component Component the question belongs to. + * @param attemptId Attempt ID the question belongs to. + * @param question The question. + * @param siteId Site ID. If not defined, current site. + * @return New state (or promise resolved with state). */ determineNewState(component: string, attemptId: number, question: any, siteId?: string) : CoreQuestionState | Promise { @@ -48,10 +48,10 @@ export class CoreQuestionBehaviourBaseHandler implements CoreQuestionBehaviourHa * If the behaviour requires a submit button, it should add it to question.behaviourButtons. * If the behaviour requires to show some extra data, it should return the components to render it. * - * @param {Injector} injector Injector. - * @param {any} question The question. - * @return {any[]|Promise} Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @param injector Injector. + * @param question The question. + * @return Components (or promise resolved with components) to render some extra data in the question + * (e.g. certainty options). Don't return anything if no extra data is required. */ handleQuestion(injector: Injector, question: any): any[] | Promise { // Nothing to do. @@ -61,7 +61,7 @@ export class CoreQuestionBehaviourBaseHandler implements CoreQuestionBehaviourHa /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/core/question/classes/base-question-component.ts b/src/core/question/classes/base-question-component.ts index c36375f8b..4d3275fc9 100644 --- a/src/core/question/classes/base-question-component.ts +++ b/src/core/question/classes/base-question-component.ts @@ -49,7 +49,7 @@ export class CoreQuestionBaseComponent { /** * Initialize a question component of type calculated or calculated simple. * - * @return {void|HTMLElement} Element containing the question HTML, void if the data is not valid. + * @return Element containing the question HTML, void if the data is not valid. */ initCalculatedComponent(): void | HTMLElement { // Treat the input text first. @@ -165,7 +165,7 @@ export class CoreQuestionBaseComponent { /** * Initialize the component and the question text. * - * @return {void|HTMLElement} Element containing the question HTML, void if the data is not valid. + * @return Element containing the question HTML, void if the data is not valid. */ initComponent(): void | HTMLElement { if (!this.question) { @@ -192,7 +192,7 @@ export class CoreQuestionBaseComponent { /** * Initialize a question component of type essay. * - * @return {void|HTMLElement} Element containing the question HTML, void if the data is not valid. + * @return Element containing the question HTML, void if the data is not valid. */ initEssayComponent(): void | HTMLElement { const questionEl = this.initComponent(); @@ -234,8 +234,8 @@ export class CoreQuestionBaseComponent { /** * Initialize a question component that uses the original question text with some basic treatment. * - * @param {string} contentSelector The selector to find the question content (text). - * @return {void|HTMLElement} Element containing the question HTML, void if the data is not valid. + * @param contentSelector The selector to find the question content (text). + * @return Element containing the question HTML, void if the data is not valid. */ initOriginalTextComponent(contentSelector: string): void | HTMLElement { if (!this.question) { @@ -272,7 +272,7 @@ export class CoreQuestionBaseComponent { /** * Initialize a question component that has an input of type "text". * - * @return {void|HTMLElement} Element containing the question HTML, void if the data is not valid. + * @return Element containing the question HTML, void if the data is not valid. */ initInputTextComponent(): void | HTMLElement { const questionEl = this.initComponent(); @@ -329,7 +329,7 @@ export class CoreQuestionBaseComponent { /** * Initialize a question component with a "match" behaviour. * - * @return {void|HTMLElement} Element containing the question HTML, void if the data is not valid. + * @return Element containing the question HTML, void if the data is not valid. */ initMatchComponent(): void | HTMLElement { const questionEl = this.initComponent(); @@ -421,7 +421,7 @@ export class CoreQuestionBaseComponent { /** * Initialize a question component with a multiple choice (checkbox) or single choice (radio). * - * @return {void|HTMLElement} Element containing the question HTML, void if the data is not valid. + * @return Element containing the question HTML, void if the data is not valid. */ initMultichoiceComponent(): void | HTMLElement { const questionEl = this.initComponent(); diff --git a/src/core/question/classes/base-question-handler.ts b/src/core/question/classes/base-question-handler.ts index e7782c2fb..5cc31dde5 100644 --- a/src/core/question/classes/base-question-handler.ts +++ b/src/core/question/classes/base-question-handler.ts @@ -32,7 +32,7 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return true; @@ -42,9 +42,9 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise { // There is no default component for questions. @@ -54,9 +54,9 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { * Return the name of the behaviour to use for the question. * If the question should use the default behaviour you shouldn't implement this function. * - * @param {any} question The question. - * @param {string} behaviour The default behaviour. - * @return {string} The behaviour to use. + * @param question The question. + * @param behaviour The default behaviour. + * @return The behaviour to use. */ getBehaviour(question: any, behaviour: string): string { return behaviour; @@ -66,8 +66,8 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { * Check if a question can be submitted. * If a question cannot be submitted it should return a message explaining why (translated or not). * - * @param {any} question The question. - * @return {string} Prevent submit message. Undefined or empty if can be submitted. + * @param question The question. + * @return Prevent submit message. Undefined or empty if can be submitted. */ getPreventSubmitMessage(question: any): string { // Never prevent by default. @@ -77,9 +77,9 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse(question: any, answers: any): number { return -1; @@ -89,9 +89,9 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse(question: any, answers: any): number { return -1; @@ -100,10 +100,10 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse(question: any, prevAnswers: any, newAnswers: any): boolean { return false; @@ -112,11 +112,11 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { /** * Prepare and add to answers the data to send to server based in the input. Return promise if async. * - * @param {any} question Question. - * @param {any} answers The answers retrieved from the form. Prepared answers must be stored in this object. - * @param {boolean} [offline] Whether the data should be saved in offline. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} Return a promise resolved when done if async, void if sync. + * @param question Question. + * @param answers The answers retrieved from the form. Prepared answers must be stored in this object. + * @param offline Whether the data should be saved in offline. + * @param siteId Site ID. If not defined, current site. + * @return Return a promise resolved when done if async, void if sync. */ prepareAnswers(question: any, answers: any, offline: boolean, siteId?: string): void | Promise { // Nothing to do. @@ -126,9 +126,9 @@ export class CoreQuestionBaseHandler implements CoreQuestionHandler { * Validate if an offline sequencecheck is valid compared with the online one. * This function only needs to be implemented if a specific compare is required. * - * @param {any} question The question. - * @param {string} offlineSequenceCheck Sequence check stored in offline. - * @return {boolean} Whether sequencecheck is valid. + * @param question The question. + * @param offlineSequenceCheck Sequence check stored in offline. + * @return Whether sequencecheck is valid. */ validateSequenceCheck(question: any, offlineSequenceCheck: string): boolean { return question.sequencecheck == offlineSequenceCheck; diff --git a/src/core/question/components/question/question.ts b/src/core/question/components/question/question.ts index 11b276ce4..8d1ee9f1c 100644 --- a/src/core/question/components/question/question.ts +++ b/src/core/question/components/question/question.ts @@ -156,7 +156,7 @@ export class CoreQuestionComponent implements OnInit { /** * Update the sequence check of the question. * - * @param {any} sequenceChecks Object with sequence checks. The keys are the question slot. + * @param sequenceChecks Object with sequence checks. The keys are the question slot. */ updateSequenceCheck(sequenceChecks: any): void { if (sequenceChecks[this.question.slot]) { diff --git a/src/core/question/providers/behaviour-delegate.ts b/src/core/question/providers/behaviour-delegate.ts index 9333e87f9..77ee65506 100644 --- a/src/core/question/providers/behaviour-delegate.ts +++ b/src/core/question/providers/behaviour-delegate.ts @@ -27,18 +27,17 @@ import { CoreQuestionBehaviourDefaultHandler } from './default-behaviour-handler export interface CoreQuestionBehaviourHandler extends CoreDelegateHandler { /** * Type of the behaviour the handler supports. E.g. 'adaptive'. - * @type {string} */ type: string; /** * Determine a question new state based on its answer(s). * - * @param {string} component Component the question belongs to. - * @param {number} attemptId Attempt ID the question belongs to. - * @param {any} question The question. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {CoreQuestionState|Promise} State (or promise resolved with state). + * @param component Component the question belongs to. + * @param attemptId Attempt ID the question belongs to. + * @param question The question. + * @param siteId Site ID. If not defined, current site. + * @return State (or promise resolved with state). */ determineNewState?(component: string, attemptId: number, question: any, siteId?: string) : CoreQuestionState | Promise; @@ -48,10 +47,10 @@ export interface CoreQuestionBehaviourHandler extends CoreDelegateHandler { * If the behaviour requires a submit button, it should add it to question.behaviourButtons. * If the behaviour requires to show some extra data, it should return the components to render it. * - * @param {Injector} injector Injector. - * @param {any} question The question. - * @return {any[]|Promise} Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @param injector Injector. + * @param question The question. + * @return Components (or promise resolved with components) to render some extra data in the question + * (e.g. certainty options). Don't return anything if no extra data is required. */ handleQuestion?(injector: Injector, question: any): any[] | Promise; } @@ -72,11 +71,11 @@ export class CoreQuestionBehaviourDelegate extends CoreDelegate { /** * Determine a question new state based on its answer(s). * - * @param {string} component Component the question belongs to. - * @param {number} attemptId Attempt ID the question belongs to. - * @param {any} question The question. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with state. + * @param component Component the question belongs to. + * @param attemptId Attempt ID the question belongs to. + * @param question The question. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with state. */ determineNewState(behaviour: string, component: string, attemptId: number, question: any, siteId?: string) : Promise { @@ -91,10 +90,10 @@ export class CoreQuestionBehaviourDelegate extends CoreDelegate { * If the behaviour requires a submit button, it should add it to question.behaviourButtons. * If the behaviour requires to show some extra data, it should return a directive to render it. * - * @param {Injector} injector Injector. - * @param {string} behaviour Default behaviour. - * @param {any} question The question. - * @return {Promise} Promise resolved with components to render some extra data in the question. + * @param injector Injector. + * @param behaviour Default behaviour. + * @param question The question. + * @return Promise resolved with components to render some extra data in the question. */ handleQuestion(injector: Injector, behaviour: string, question: any): Promise { behaviour = this.questionDelegate.getBehaviourForQuestion(question, behaviour); @@ -105,8 +104,8 @@ export class CoreQuestionBehaviourDelegate extends CoreDelegate { /** * Check if a question behaviour is supported. * - * @param {string} behaviour Name of the behaviour. - * @return {boolean} Whether it's supported. + * @param behaviour Name of the behaviour. + * @return Whether it's supported. */ isBehaviourSupported(behaviour: string): boolean { return this.hasHandler(behaviour, true); diff --git a/src/core/question/providers/delegate.ts b/src/core/question/providers/delegate.ts index 3dc33326d..5c78d4e95 100644 --- a/src/core/question/providers/delegate.ts +++ b/src/core/question/providers/delegate.ts @@ -25,7 +25,6 @@ import { CoreQuestionDefaultHandler } from './default-question-handler'; export interface CoreQuestionHandler extends CoreDelegateHandler { /** * Type of the question the handler supports. E.g. 'qtype_calculated'. - * @type {string} */ type: string; @@ -33,9 +32,9 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, question: any): any | Promise; @@ -43,9 +42,9 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * Return the name of the behaviour to use for the question. * If the question should use the default behaviour you shouldn't implement this function. * - * @param {any} question The question. - * @param {string} behaviour The default behaviour. - * @return {string} The behaviour to use. + * @param question The question. + * @param behaviour The default behaviour. + * @return The behaviour to use. */ getBehaviour?(question: any, behaviour: string): string; @@ -53,17 +52,17 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * Check if a question can be submitted. * If a question cannot be submitted it should return a message explaining why (translated or not). * - * @param {any} question The question. - * @return {string} Prevent submit message. Undefined or empty if can be submitted. + * @param question The question. + * @return Prevent submit message. Undefined or empty if can be submitted. */ getPreventSubmitMessage?(question: any): string; /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse?(question: any, answers: any): number; @@ -71,30 +70,30 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse?(question: any, answers: any): number; /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse?(question: any, prevAnswers: any, newAnswers: any): boolean; /** * Prepare and add to answers the data to send to server based in the input. Return promise if async. * - * @param {any} question Question. - * @param {any} answers The answers retrieved from the form. Prepared answers must be stored in this object. - * @param {boolean} [offline] Whether the data should be saved in offline. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} Return a promise resolved when done if async, void if sync. + * @param question Question. + * @param answers The answers retrieved from the form. Prepared answers must be stored in this object. + * @param offline Whether the data should be saved in offline. + * @param siteId Site ID. If not defined, current site. + * @return Return a promise resolved when done if async, void if sync. */ prepareAnswers?(question: any, answers: any, offline: boolean, siteId?: string): void | Promise; @@ -102,18 +101,18 @@ export interface CoreQuestionHandler extends CoreDelegateHandler { * Validate if an offline sequencecheck is valid compared with the online one. * This function only needs to be implemented if a specific compare is required. * - * @param {any} question The question. - * @param {string} offlineSequenceCheck Sequence check stored in offline. - * @return {boolean} Whether sequencecheck is valid. + * @param question The question. + * @param offlineSequenceCheck Sequence check stored in offline. + * @return Whether sequencecheck is valid. */ validateSequenceCheck?(question: any, offlineSequenceCheck: string): boolean; /** * Get the list of files that needs to be downloaded in addition to the files embedded in the HTML. * - * @param {any} question Question. - * @param {number} usageId Usage ID. - * @return {string[]} List of URLs. + * @param question Question. + * @param usageId Usage ID. + * @return List of URLs. */ getAdditionalDownloadableFiles?(question: any, usageId: number): string[]; } @@ -135,9 +134,9 @@ export class CoreQuestionDelegate extends CoreDelegate { * Get the behaviour to use for a certain question type. * E.g. 'qtype_essay' uses 'manualgraded'. * - * @param {any} question The question. - * @param {string} behaviour The default behaviour. - * @return {string} The behaviour to use. + * @param question The question. + * @param behaviour The default behaviour. + * @return The behaviour to use. */ getBehaviourForQuestion(question: any, behaviour: string): string { const type = this.getTypeName(question), @@ -149,9 +148,9 @@ export class CoreQuestionDelegate extends CoreDelegate { /** * Get the directive to use for a certain question type. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {Promise} Promise resolved with component to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return Promise resolved with component to use, undefined if not found. */ getComponentForQuestion(injector: Injector, question: any): Promise { const type = this.getTypeName(question); @@ -163,8 +162,8 @@ export class CoreQuestionDelegate extends CoreDelegate { * Check if a question can be submitted. * If a question cannot be submitted it should return a message explaining why (translated or not). * - * @param {any} question Question. - * @return {string} Prevent submit message. Undefined or empty if can be submitted. + * @param question Question. + * @return Prevent submit message. Undefined or empty if can be submitted. */ getPreventSubmitMessage(question: any): string { const type = this.getTypeName(question); @@ -175,8 +174,8 @@ export class CoreQuestionDelegate extends CoreDelegate { /** * Given a type name, return the full name of that type. E.g. 'calculated' -> 'qtype_calculated'. * - * @param {string} type Type to treat. - * @return {string} Type full name. + * @param type Type to treat. + * @return Type full name. */ protected getFullTypeName(type: string): string { return 'qtype_' + type; @@ -185,8 +184,8 @@ export class CoreQuestionDelegate extends CoreDelegate { /** * Given a question, return the full name of its question type. * - * @param {any} question Question. - * @return {string} Type name. + * @param question Question. + * @return Type name. */ protected getTypeName(question: any): string { return this.getFullTypeName(question.type); @@ -195,9 +194,9 @@ export class CoreQuestionDelegate extends CoreDelegate { /** * Check if a response is complete. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if complete, 0 if not complete, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if complete, 0 if not complete, -1 if cannot determine. */ isCompleteResponse(question: any, answers: any): number { const type = this.getTypeName(question); @@ -209,9 +208,9 @@ export class CoreQuestionDelegate extends CoreDelegate { * Check if a student has provided enough of an answer for the question to be graded automatically, * or whether it must be considered aborted. * - * @param {any} question The question. - * @param {any} answers Object with the question answers (without prefix). - * @return {number} 1 if gradable, 0 if not gradable, -1 if cannot determine. + * @param question The question. + * @param answers Object with the question answers (without prefix). + * @return 1 if gradable, 0 if not gradable, -1 if cannot determine. */ isGradableResponse(question: any, answers: any): number { const type = this.getTypeName(question); @@ -222,10 +221,10 @@ export class CoreQuestionDelegate extends CoreDelegate { /** * Check if two responses are the same. * - * @param {any} question Question. - * @param {any} prevAnswers Object with the previous question answers. - * @param {any} newAnswers Object with the new question answers. - * @return {boolean} Whether they're the same. + * @param question Question. + * @param prevAnswers Object with the previous question answers. + * @param newAnswers Object with the new question answers. + * @return Whether they're the same. */ isSameResponse(question: any, prevAnswers: any, newAnswers: any): boolean { const type = this.getTypeName(question); @@ -236,8 +235,8 @@ export class CoreQuestionDelegate extends CoreDelegate { /** * Check if a question type is supported. * - * @param {string} type Question type. - * @return {boolean} Whether it's supported. + * @param type Question type. + * @return Whether it's supported. */ isQuestionSupported(type: string): boolean { return this.hasHandler(this.getFullTypeName(type), true); @@ -246,11 +245,11 @@ export class CoreQuestionDelegate extends CoreDelegate { /** * Prepare the answers for a certain question. * - * @param {any} question Question. - * @param {any} answers The answers retrieved from the form. Prepared answers must be stored in this object. - * @param {boolean} [offline] Whether the data should be saved in offline. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when data has been prepared. + * @param question Question. + * @param answers The answers retrieved from the form. Prepared answers must be stored in this object. + * @param offline Whether the data should be saved in offline. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when data has been prepared. */ prepareAnswersForQuestion(question: any, answers: any, offline: boolean, siteId?: string): Promise { const type = this.getTypeName(question); @@ -261,9 +260,9 @@ export class CoreQuestionDelegate extends CoreDelegate { /** * Validate if an offline sequencecheck is valid compared with the online one. * - * @param {any} question The question. - * @param {string} offlineSequenceCheck Sequence check stored in offline. - * @return {boolean} Whether sequencecheck is valid. + * @param question The question. + * @param offlineSequenceCheck Sequence check stored in offline. + * @return Whether sequencecheck is valid. */ validateSequenceCheck(question: any, offlineSequenceCheck: string): boolean { const type = this.getTypeName(question); @@ -274,9 +273,9 @@ export class CoreQuestionDelegate extends CoreDelegate { /** * Get the list of files that needs to be downloaded in addition to the files embedded in the HTML. * - * @param {any} question Question. - * @param {number} usageId Usage ID. - * @return {string[]} List of URLs. + * @param question Question. + * @param usageId Usage ID. + * @return List of URLs. */ getAdditionalDownloadableFiles(question: any, usageId: number): string[] { const type = this.getTypeName(question); diff --git a/src/core/question/providers/helper.ts b/src/core/question/providers/helper.ts index e564a97d8..b69929f1e 100644 --- a/src/core/question/providers/helper.ts +++ b/src/core/question/providers/helper.ts @@ -38,8 +38,8 @@ export class CoreQuestionHelperProvider { /** * Add a behaviour button to the question's "behaviourButtons" property. * - * @param {any} question Question. - * @param {HTMLInputElement} button Behaviour button (DOM element). + * @param question Question. + * @param button Behaviour button (DOM element). */ protected addBehaviourButton(question: any, button: HTMLInputElement): void { if (!button || !question) { @@ -63,8 +63,8 @@ export class CoreQuestionHelperProvider { * Extract question behaviour submit buttons from the question's HTML and add them to "behaviourButtons" property. * The buttons aren't deleted from the content because all the im-controls block will be removed afterwards. * - * @param {any} question Question to treat. - * @param {string} [selector] Selector to search the buttons. By default, '.im-controls input[type="submit"]'. + * @param question Question to treat. + * @param selector Selector to search the buttons. By default, '.im-controls input[type="submit"]'. */ extractQbehaviourButtons(question: any, selector?: string): void { if (this.questionDelegate.getPreventSubmitMessage(question)) { @@ -89,8 +89,8 @@ export class CoreQuestionHelperProvider { * The value of the selected option is stored in question.behaviourCertaintySelected. * We don't remove them from HTML because the whole im-controls block will be removed afterwards. * - * @param {any} question Question to treat. - * @return {boolean} Wether the certainty is found. + * @param question Question to treat. + * @return Wether the certainty is found. */ extractQbehaviourCBM(question: any): boolean { const element = this.domUtils.convertToElement(question.html); @@ -128,7 +128,7 @@ export class CoreQuestionHelperProvider { * Check if the question has a redo button and, if so, add it to "behaviourButtons" property * and remove it from the HTML. * - * @param {any} question Question to treat. + * @param question Question to treat. */ extractQbehaviourRedoButton(question: any): void { // Create a fake div element so we can search using querySelector. @@ -156,8 +156,8 @@ export class CoreQuestionHelperProvider { * Check if the question contains a "seen" input. * If so, add the name and value to a "behaviourSeenInput" property and remove the input. * - * @param {any} question Question to treat. - * @return {boolean} Whether the seen input is found. + * @param question Question to treat. + * @return Whether the seen input is found. */ extractQbehaviourSeenInput(question: any): boolean { const element = this.domUtils.convertToElement(question.html); @@ -182,7 +182,7 @@ export class CoreQuestionHelperProvider { /** * Removes the comment from the question HTML code and adds it in a new "commentHtml" property. * - * @param {any} question Question. + * @param question Question. */ extractQuestionComment(question: any): void { this.extractQuestionLastElementNotInContent(question, '.comment', 'commentHtml'); @@ -191,7 +191,7 @@ export class CoreQuestionHelperProvider { /** * Removes the feedback from the question HTML code and adds it in a new "feedbackHtml" property. * - * @param {any} question Question. + * @param question Question. */ extractQuestionFeedback(question: any): void { this.extractQuestionLastElementNotInContent(question, '.outcome', 'feedbackHtml'); @@ -200,8 +200,8 @@ export class CoreQuestionHelperProvider { /** * Extracts the info box from a question and add it to an "infoHtml" property. * - * @param {any} question Question. - * @param {string} selector Selector to search the element. + * @param question Question. + * @param selector Selector to search the element. */ extractQuestionInfoBox(question: any, selector: string): void { this.extractQuestionLastElementNotInContent(question, selector, 'infoHtml'); @@ -211,9 +211,9 @@ export class CoreQuestionHelperProvider { * Searches the last occurrence of a certain element and check it's not in the question contents. * If found, removes it from the question HTML and adds it to a new property inside question. * - * @param {any} question Question. - * @param {string} selector Selector to search the element. - * @param {string} attrName Name of the attribute to store the HTML in. + * @param question Question. + * @param selector Selector to search the element. + * @param attrName Name of the attribute to store the HTML in. */ protected extractQuestionLastElementNotInContent(question: any, selector: string, attrName: string): void { const element = this.domUtils.convertToElement(question.html); @@ -241,8 +241,8 @@ export class CoreQuestionHelperProvider { * Removes the scripts from a question's HTML and adds it in a new 'scriptsCode' property. * It will also search for init_question functions of the question type and add the object to an 'initObjects' property. * - * @param {any} question Question. - * @param {number} usageId Usage ID. + * @param question Question. + * @param usageId Usage ID. */ extractQuestionScripts(question: any, usageId: number): void { question.scriptsCode = ''; @@ -292,8 +292,8 @@ export class CoreQuestionHelperProvider { * This function will return an object where the keys are the input names. The values will always be true. * This is in order to make this function compatible with other functions like CoreQuestionProvider.getBasicAnswers. * - * @param {string} html HTML code. - * @return {any} Object where the keys are the names. + * @param html HTML code. + * @return Object where the keys are the names. */ getAllInputNamesFromHtml(html: string): any { const element = this.domUtils.convertToElement('
' + html + '
'), @@ -319,8 +319,8 @@ export class CoreQuestionHelperProvider { * Retrieve the answers entered in a form. * We don't use ngModel because it doesn't detect changes done by JavaScript and some questions might do that. * - * @param {HTMLFormElement} form Form. - * @return {any} Object with the answers. + * @param form Form. + * @return Object with the answers. */ getAnswersFromForm(form: HTMLFormElement): any { if (!form || !form.elements) { @@ -358,8 +358,8 @@ export class CoreQuestionHelperProvider { * Please take into account that this function will treat all the anchors in the HTML, you should provide * an HTML containing only the attachments anchors. * - * @param {String} html HTML code to search in. - * @return {Object[]} Attachments. + * @param html HTML code to search in. + * @return Attachments. */ getQuestionAttachmentsFromHtml(html: string): any[] { const element = this.domUtils.convertToElement(html); @@ -390,8 +390,8 @@ export class CoreQuestionHelperProvider { /** * Get the sequence check from a question HTML. * - * @param {string} html Question's HTML. - * @return {{name: string, value: string}} Object with the sequencecheck name and value. + * @param html Question's HTML. + * @return Object with the sequencecheck name and value. */ getQuestionSequenceCheckFromHtml(html: string): {name: string, value: string} { if (html) { @@ -411,8 +411,8 @@ export class CoreQuestionHelperProvider { /** * Get the CSS class for a question based on its state. * - * @param {string} name Question's state name. - * @return {string} State class. + * @param name Question's state name. + * @return State class. */ getQuestionStateClass(name: string): string { const state = this.questionProvider.getState(name); @@ -423,8 +423,8 @@ export class CoreQuestionHelperProvider { /** * Get the validation error message from a question HTML if it's there. * - * @param {string} html Question's HTML. - * @return {string} Validation error message if present. + * @param html Question's HTML. + * @return Validation error message if present. */ getValidationErrorFromHtml(html: string): string { const element = this.domUtils.convertToElement(html); @@ -435,8 +435,8 @@ export class CoreQuestionHelperProvider { /** * Check if some HTML contains draft file URLs for the current site. * - * @param {string} html Question's HTML. - * @return {boolean} Whether it contains draft files URLs. + * @param html Question's HTML. + * @return Whether it contains draft files URLs. */ hasDraftFileUrls(html: string): boolean { let url = this.sitesProvider.getCurrentSite().getURL(); @@ -452,7 +452,7 @@ export class CoreQuestionHelperProvider { * For each input element found in the HTML, search if there's a local answer stored and * override the HTML's value with the local one. * - * @param {any} question Question. + * @param question Question. */ loadLocalAnswersInHtml(question: any): void { const element = this.domUtils.convertToElement('
' + question.html + '
'), @@ -507,12 +507,12 @@ export class CoreQuestionHelperProvider { /** * Prefetch the files in a question HTML. * - * @param {any} question Question. - * @param {string} [component] The component to link the files to. If not defined, question component. - * @param {string|number} [componentId] An ID to use in conjunction with the component. If not defined, question ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [usageId] Usage ID. Required in Moodle 3.7+. - * @return {Promise} Promise resolved when all the files have been downloaded. + * @param question Question. + * @param component The component to link the files to. If not defined, question component. + * @param componentId An ID to use in conjunction with the component. If not defined, question ID. + * @param siteId Site ID. If not defined, current site. + * @param usageId Usage ID. Required in Moodle 3.7+. + * @return Promise resolved when all the files have been downloaded. */ prefetchQuestionFiles(question: any, component?: string, componentId?: string | number, siteId?: string, usageId?: number) : Promise { @@ -548,11 +548,11 @@ export class CoreQuestionHelperProvider { /** * Prepare and return the answers. * - * @param {any[]} questions The list of questions. - * @param {any} answers The input data. - * @param {boolean} offline True if data should be saved in offline. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with answers to send to server. + * @param questions The list of questions. + * @param answers The input data. + * @param offline True if data should be saved in offline. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with answers to send to server. */ prepareAnswers(questions: any[], answers: any, offline?: boolean, siteId?: string): Promise { const promises = []; @@ -570,7 +570,7 @@ export class CoreQuestionHelperProvider { /** * Replace Moodle's correct/incorrect classes with the Mobile ones. * - * @param {HTMLElement} element DOM element. + * @param element DOM element. */ replaceCorrectnessClasses(element: HTMLElement): void { this.domUtils.replaceClassesInElement(element, { @@ -582,7 +582,7 @@ export class CoreQuestionHelperProvider { /** * Replace Moodle's feedback classes with the Mobile ones. * - * @param {HTMLElement} element DOM element. + * @param element DOM element. */ replaceFeedbackClasses(element: HTMLElement): void { this.domUtils.replaceClassesInElement(element, { @@ -594,10 +594,10 @@ export class CoreQuestionHelperProvider { /** * Search a behaviour button in a certain question property containing HTML. * - * @param {any} question Question. - * @param {string} htmlProperty The name of the property containing the HTML to search. - * @param {string} selector The selector to find the button. - * @return {boolean} Whether the button is found. + * @param question Question. + * @param htmlProperty The name of the property containing the HTML to search. + * @param selector The selector to find the button. + * @return Whether the button is found. */ protected searchBehaviourButton(question: any, htmlProperty: string, selector: string): boolean { const element = this.domUtils.convertToElement(question[htmlProperty]); @@ -622,8 +622,8 @@ export class CoreQuestionHelperProvider { /** * Convenience function to show a parsing error and abort. * - * @param {EventEmitter} [onAbort] If supplied, will emit an event. - * @param {string} [error] Error to show. + * @param onAbort If supplied, will emit an event. + * @param error Error to show. */ showComponentError(onAbort: EventEmitter, error?: string): void { // Prevent consecutive errors. @@ -639,7 +639,7 @@ export class CoreQuestionHelperProvider { /** * Treat correctness icons, replacing them with local icons and setting click events to show the feedback if needed. * - * @param {HTMLElement} element DOM element. + * @param element DOM element. */ treatCorrectnessIcons(element: HTMLElement): void { @@ -688,9 +688,9 @@ export class CoreQuestionHelperProvider { /** * Add click listeners to all tappable correctness icons. * - * @param {HTMLElement} element DOM element. - * @param {string} [component] The component to use when viewing the feedback. - * @param {string|number} [componentId] An ID to use in conjunction with the component. + * @param element DOM element. + * @param component The component to use when viewing the feedback. + * @param componentId An ID to use in conjunction with the component. */ treatCorrectnessIconsClicks(element: HTMLElement, component?: string, componentId?: number): void { const icons = Array.from(element.querySelectorAll('i.icon.questioncorrectnessicon[tappable]')), diff --git a/src/core/question/providers/question.ts b/src/core/question/providers/question.ts index 92d8bc55c..d8372a358 100644 --- a/src/core/question/providers/question.ts +++ b/src/core/question/providers/question.ts @@ -24,31 +24,26 @@ import { CoreUtilsProvider } from '@providers/utils/utils'; export interface CoreQuestionState { /** * Name of the state. - * @type {string} */ name: string; /** * Class of the state. - * @type {string} */ class: string; /** * The string key to translate the status. - * @type {string} */ status: string; /** * Whether the question with this state is active. - * @type {boolean} */ active: boolean; /** * Whether the question with this state is finished. - * @type {boolean} */ finished: boolean; } @@ -254,9 +249,9 @@ export class CoreQuestionProvider { /** * Compare that all the answers in two objects are equal, except some extra data like sequencecheck or certainty. * - * @param {any} prevAnswers Object with previous answers. - * @param {any} newAnswers Object with new answers. - * @return {boolean} Whether all answers are equal. + * @param prevAnswers Object with previous answers. + * @param newAnswers Object with new answers. + * @return Whether all answers are equal. */ compareAllAnswers(prevAnswers: any, newAnswers: any): boolean { // Get all the keys. @@ -280,9 +275,9 @@ export class CoreQuestionProvider { /** * Convert a list of answers retrieved from local DB to an object with name - value. * - * @param {any[]} answers List of answers. - * @param {boolean} [removePrefix] Whether to remove the prefix in the answer's name. - * @return {any} Object with name -> value. + * @param answers List of answers. + * @param removePrefix Whether to remove the prefix in the answer's name. + * @return Object with name -> value. */ convertAnswersArrayToObject(answers: any[], removePrefix?: boolean): any { const result = {}; @@ -302,11 +297,11 @@ export class CoreQuestionProvider { /** * Retrieve an answer from site DB. * - * @param {string} component Component the attempt belongs to. - * @param {number} attemptId Attempt ID. - * @param {string} name Answer's name. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the answer. + * @param component Component the attempt belongs to. + * @param attemptId Attempt ID. + * @param name Answer's name. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the answer. */ getAnswer(component: string, attemptId: number, name: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -317,10 +312,10 @@ export class CoreQuestionProvider { /** * Retrieve an attempt answers from site DB. * - * @param {string} component Component the attempt belongs to. - * @param {number} attemptId Attempt ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the answers. + * @param component Component the attempt belongs to. + * @param attemptId Attempt ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the answers. */ getAttemptAnswers(component: string, attemptId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -331,10 +326,10 @@ export class CoreQuestionProvider { /** * Retrieve an attempt questions from site DB. * - * @param {string} component Component the attempt belongs to. - * @param {number} attemptId Attempt ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the questions. + * @param component Component the attempt belongs to. + * @param attemptId Attempt ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the questions. */ getAttemptQuestions(component: string, attemptId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -345,8 +340,8 @@ export class CoreQuestionProvider { /** * Get all the answers that aren't "extra" (sequencecheck, certainty, ...). * - * @param {any} answers Object with all the answers. - * @return {any} Object with the basic answers. + * @param answers Object with all the answers. + * @return Object with the basic answers. */ getBasicAnswers(answers: any): any { const result = {}; @@ -363,8 +358,8 @@ export class CoreQuestionProvider { /** * Get all the answers that aren't "extra" (sequencecheck, certainty, ...). * - * @param {any[]} answers List of answers. - * @return {any[]} List with the basic answers. + * @param answers List of answers. + * @return List with the basic answers. */ getBasicAnswersFromArray(answers: any[]): any[] { const result = []; @@ -381,11 +376,11 @@ export class CoreQuestionProvider { /** * Retrieve a question from site DB. * - * @param {string} component Component the attempt belongs to. - * @param {number} attemptId Attempt ID. - * @param {string} slot Question slot. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the question. + * @param component Component the attempt belongs to. + * @param attemptId Attempt ID. + * @param slot Question slot. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the question. */ getQuestion(component: string, attemptId: number, slot: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -396,12 +391,12 @@ export class CoreQuestionProvider { /** * Retrieve a question answers from site DB. * - * @param {string} component Component the attempt belongs to. - * @param {number} attemptId Attempt ID. - * @param {string} slot Question slot. - * @param {boolean} [filter] Whether it should ignore "extra" answers like sequencecheck or certainty. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the answers. + * @param component Component the attempt belongs to. + * @param attemptId Attempt ID. + * @param slot Question slot. + * @param filter Whether it should ignore "extra" answers like sequencecheck or certainty. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the answers. */ getQuestionAnswers(component: string, attemptId: number, slot: number, filter?: boolean, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -421,8 +416,8 @@ export class CoreQuestionProvider { /** * Extract the question slot from a question name. * - * @param {string} name Question name. - * @return {number} Question slot. + * @param name Question name. + * @return Question slot. */ getQuestionSlotFromName(name: string): number { if (name) { @@ -438,8 +433,8 @@ export class CoreQuestionProvider { /** * Get question state based on state name. * - * @param {string} name State name. - * @return {CoreQuestionState} State. + * @param name State name. + * @return State. */ getState(name: string): CoreQuestionState { return this.STATES[name || 'cannotdeterminestatus']; @@ -448,8 +443,8 @@ export class CoreQuestionProvider { /** * Check if an answer is extra data like sequencecheck or certainty. * - * @param {string} name Answer name. - * @return {boolean} Whether it's extra data. + * @param name Answer name. + * @return Whether it's extra data. */ isExtraAnswer(name: string): boolean { // Maybe the name still has the prefix. @@ -461,10 +456,10 @@ export class CoreQuestionProvider { /** * Remove an attempt answers from site DB. * - * @param {string} component Component the attempt belongs to. - * @param {number} attemptId Attempt ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param component Component the attempt belongs to. + * @param attemptId Attempt ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ removeAttemptAnswers(component: string, attemptId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -475,10 +470,10 @@ export class CoreQuestionProvider { /** * Remove an attempt questions from site DB. * - * @param {string} component Component the attempt belongs to. - * @param {number} attemptId Attempt ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param component Component the attempt belongs to. + * @param attemptId Attempt ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ removeAttemptQuestions(component: string, attemptId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -489,11 +484,11 @@ export class CoreQuestionProvider { /** * Remove an answer from site DB. * - * @param {string} component Component the attempt belongs to. - * @param {number} attemptId Attempt ID. - * @param {string} name Answer's name. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param component Component the attempt belongs to. + * @param attemptId Attempt ID. + * @param name Answer's name. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ removeAnswer(component: string, attemptId: number, name: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -505,11 +500,11 @@ export class CoreQuestionProvider { /** * Remove a question from site DB. * - * @param {string} component Component the attempt belongs to. - * @param {number} attemptId Attempt ID. - * @param {string} slot Question slot. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param component Component the attempt belongs to. + * @param attemptId Attempt ID. + * @param slot Question slot. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ removeQuestion(component: string, attemptId: number, slot: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -520,11 +515,11 @@ export class CoreQuestionProvider { /** * Remove a question answers from site DB. * - * @param {string} component Component the attempt belongs to. - * @param {number} attemptId Attempt ID. - * @param {string} slot Question slot. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param component Component the attempt belongs to. + * @param attemptId Attempt ID. + * @param slot Question slot. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ removeQuestionAnswers(component: string, attemptId: number, slot: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -536,8 +531,8 @@ export class CoreQuestionProvider { /** * Remove the prefix from a question answer name. * - * @param {string} name Question name. - * @return {string} Name without prefix. + * @param name Question name. + * @return Name without prefix. */ removeQuestionPrefix(name: string): string { if (name) { @@ -550,14 +545,14 @@ export class CoreQuestionProvider { /** * Save answers in local DB. * - * @param {string} component Component the answers belong to. E.g. 'mmaModQuiz'. - * @param {number} componentId ID of the component the answers belong to. - * @param {number} attemptId Attempt ID. - * @param {number} userId User ID. - * @param {any} answers Object with the answers to save. - * @param {number} [timemodified] Time modified to set in the answers. If not defined, current time. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param component Component the answers belong to. E.g. 'mmaModQuiz'. + * @param componentId ID of the component the answers belong to. + * @param attemptId Attempt ID. + * @param userId User ID. + * @param answers Object with the answers to save. + * @param timemodified Time modified to set in the answers. If not defined, current time. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ saveAnswers(component: string, componentId: number, attemptId: number, userId: number, answers: any, timemodified?: number, siteId?: string): Promise { @@ -590,14 +585,14 @@ export class CoreQuestionProvider { /** * Save a question in local DB. * - * @param {string} component Component the question belongs to. E.g. 'mmaModQuiz'. - * @param {number} componentId ID of the component the question belongs to. - * @param {number} attemptId Attempt ID. - * @param {number} userId User ID. - * @param {any} question The question to save. - * @param {string} state Question's state. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param component Component the question belongs to. E.g. 'mmaModQuiz'. + * @param componentId ID of the component the question belongs to. + * @param attemptId Attempt ID. + * @param userId User ID. + * @param question The question to save. + * @param state Question's state. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ saveQuestion(component: string, componentId: number, attemptId: number, userId: number, question: any, state: string, siteId?: string): Promise { diff --git a/src/core/rating/pages/ratings/ratings.ts b/src/core/rating/pages/ratings/ratings.ts index 1114562ca..1b0980ae2 100644 --- a/src/core/rating/pages/ratings/ratings.ts +++ b/src/core/rating/pages/ratings/ratings.ts @@ -61,7 +61,7 @@ export class CoreRatingRatingsPage { /** * Fetch all the data required for the view. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ fetchData(): Promise { return this.ratingProvider.getItemRatings(this.contextLevel, this.instanceId, this.component, this.ratingArea, this.itemId, @@ -75,7 +75,7 @@ export class CoreRatingRatingsPage { /** * Refresh data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshRatings(refresher: any): void { this.ratingProvider.invalidateRatingItems(this.contextLevel, this.instanceId, this.component, this.ratingArea, this.itemId, diff --git a/src/core/rating/providers/offline.ts b/src/core/rating/providers/offline.ts index 920130118..1de0b00b0 100644 --- a/src/core/rating/providers/offline.ts +++ b/src/core/rating/providers/offline.ts @@ -117,13 +117,13 @@ export class CoreRatingOfflineProvider { /** * Get an offline rating. * - * @param {string} contextLevel Context level: course, module, user, etc. - * @param {numnber} instanceId Context instance id. - * @param {string} component Component. Example: "mod_forum". - * @param {string} ratingArea Rating area. Example: "post". - * @param {number} itemId Item id. Example: forum post id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the saved rating, rejected if not found. + * @param contextLevel Context level: course, module, user, etc. + * @param instanceId Context instance id. + * @param component Component. Example: "mod_forum". + * @param ratingArea Rating area. Example: "post". + * @param itemId Item id. Example: forum post id. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the saved rating, rejected if not found. */ getRating(contextLevel: string, instanceId: number, component: string, ratingArea: string, itemId: number, siteId?: string): Promise { @@ -143,19 +143,19 @@ export class CoreRatingOfflineProvider { /** * Add an offline rating. * - * @param {string} component Component. Example: "mod_forum". - * @param {string} ratingArea Rating area. Example: "post". - * @param {string} contextLevel Context level: course, module, user, etc. - * @param {numnber} instanceId Context instance id. - * @param {number} itemId Item id. Example: forum post id. - * @param {number} itemSetId Item set id. Example: forum discussion id. - * @param {number} courseId Course id. - * @param {number} scaleId Scale id. - * @param {number} rating Rating value. Use CoreRatingProvider.UNSET_RATING to delete rating. - * @param {number} ratedUserId Rated user id. - * @param {number} aggregateMethod Aggregate method. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the rating is saved. + * @param component Component. Example: "mod_forum". + * @param ratingArea Rating area. Example: "post". + * @param contextLevel Context level: course, module, user, etc. + * @param instanceId Context instance id. + * @param itemId Item id. Example: forum post id. + * @param itemSetId Item set id. Example: forum discussion id. + * @param courseId Course id. + * @param scaleId Scale id. + * @param rating Rating value. Use CoreRatingProvider.UNSET_RATING to delete rating. + * @param ratedUserId Rated user id. + * @param aggregateMethod Aggregate method. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the rating is saved. */ addRating(component: string, ratingArea: string, contextLevel: string, instanceId: number, itemId: number, itemSetId: number, courseId: number, scaleId: number, rating: number, ratedUserId: number, aggregateMethod: number, siteId?: string): @@ -182,12 +182,12 @@ export class CoreRatingOfflineProvider { /** * Delete offline rating. * - * @param {string} component Component. Example: "mod_forum". - * @param {string} ratingArea Rating area. Example: "post". - * @param {string} contextLevel Context level: course, module, user, etc. - * @param {number} itemId Item id. Example: forum post id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the rating is saved. + * @param component Component. Example: "mod_forum". + * @param ratingArea Rating area. Example: "post". + * @param contextLevel Context level: course, module, user, etc. + * @param itemId Item id. Example: forum post id. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the rating is saved. */ deleteRating(component: string, ratingArea: string, contextLevel: string, instanceId: number, itemId: number, siteId?: string): Promise { @@ -207,13 +207,13 @@ export class CoreRatingOfflineProvider { /** * Get the list of item sets in a component or instance. * - * @param {string} component Component. Example: "mod_forum". - * @param {string} ratingArea Rating Area. Example: "post". - * @param {string} [contextLevel] Context level: course, module, user, etc. - * @param {numnber} [instanceId] Context instance id. - * @param {number} [itemSetId] Item set id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the list of item set ids. + * @param component Component. Example: "mod_forum". + * @param ratingArea Rating Area. Example: "post". + * @param contextLevel Context level: course, module, user, etc. + * @param instanceId Context instance id. + * @param itemSetId Item set id. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of item set ids. */ getItemSets(component: string, ratingArea: string, contextLevel?: string, instanceId?: number, itemSetId?: number, siteId?: string): Promise { @@ -250,13 +250,13 @@ export class CoreRatingOfflineProvider { /** * Get offline ratings of an item set. * - * @param {string} component Component. Example: "mod_forum". - * @param {string} ratingArea Rating Area. Example: "post". - * @param {string} contextLevel Context level: course, module, user, etc. - * @param {number} itemId Item id. Example: forum post id. - * @param {number} itemSetId Item set id. Example: forum discussion id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the list of ratings. + * @param component Component. Example: "mod_forum". + * @param ratingArea Rating Area. Example: "post". + * @param contextLevel Context level: course, module, user, etc. + * @param itemId Item id. Example: forum post id. + * @param itemSetId Item set id. Example: forum discussion id. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the list of ratings. */ getRatings(component: string, ratingArea: string, contextLevel: string, instanceId: number, itemSetId: number, siteId?: string): Promise { @@ -276,13 +276,13 @@ export class CoreRatingOfflineProvider { /** * Return whether a component, instance or item set has offline ratings. * - * @param {string} component Component. Example: "mod_forum". - * @param {string} ratingArea Rating Area. Example: "post". - * @param {string} [contextLevel] Context level: course, module, user, etc. - * @param {number} [instanceId] Context instance id. - * @param {number} [itemSetId] Item set id. Example: forum discussion id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with a boolean. + * @param component Component. Example: "mod_forum". + * @param ratingArea Rating Area. Example: "post". + * @param contextLevel Context level: course, module, user, etc. + * @param instanceId Context instance id. + * @param itemSetId Item set id. Example: forum discussion id. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with a boolean. */ hasRatings(component: string, ratingArea: string, contextLevel?: string, instanceId?: number, itemSetId?: number, siteId?: string): Promise { diff --git a/src/core/rating/providers/rating.ts b/src/core/rating/providers/rating.ts index 1b482dd08..bbdd1d454 100644 --- a/src/core/rating/providers/rating.ts +++ b/src/core/rating/providers/rating.ts @@ -104,7 +104,7 @@ export class CoreRatingProvider { /** * Returns whether the web serivce to add ratings is available. * - * @return {boolean} If WS is abalaible. + * @return If WS is abalaible. * @since 3.2 */ isAddRatingWSAvailable(): boolean { @@ -114,19 +114,19 @@ export class CoreRatingProvider { /** * Add a rating to an item. * - * @param {string} component Component. Example: "mod_forum". - * @param {string} ratingArea Rating area. Example: "post". - * @param {string} contextLevel Context level: course, module, user, etc. - * @param {number} instanceId Context instance id. - * @param {number} itemId Item id. Example: forum post id. - * @param {number} itemSetId Item set id. Example: forum discussion id. - * @param {number} courseId Course id. - * @param {number} scaleId Scale id. - * @param {number} rating Rating value. Use CoreRatingProvider.UNSET_RATING to delete rating. - * @param {number} ratedUserId Rated user id. - * @param {number} aggregateMethod Aggregate method. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the aggregated rating or null if stored offline. + * @param component Component. Example: "mod_forum". + * @param ratingArea Rating area. Example: "post". + * @param contextLevel Context level: course, module, user, etc. + * @param instanceId Context instance id. + * @param itemId Item id. Example: forum post id. + * @param itemSetId Item set id. Example: forum discussion id. + * @param courseId Course id. + * @param scaleId Scale id. + * @param rating Rating value. Use CoreRatingProvider.UNSET_RATING to delete rating. + * @param ratedUserId Rated user id. + * @param aggregateMethod Aggregate method. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the aggregated rating or null if stored offline. * @since 3.2 */ addRating(component: string, ratingArea: string, contextLevel: string, instanceId: number, itemId: number, itemSetId: number, @@ -174,17 +174,17 @@ export class CoreRatingProvider { /** * Add a rating to an item. It will fail if offline or cannot connect. * - * @param {string} component Component. Example: "mod_forum". - * @param {string} ratingArea Rating area. Example: "post". - * @param {string} contextLevel Context level: course, module, user, etc. - * @param {number} instanceId Context instance id. - * @param {number} itemId Item id. Example: forum post id. - * @param {number} scaleId Scale id. - * @param {number} rating Rating value. Use CoreRatingProvider.UNSET_RATING to delete rating. - * @param {number} ratedUserId Rated user id. - * @param {number} aggregateMethod Aggregate method. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the aggregated rating. + * @param component Component. Example: "mod_forum". + * @param ratingArea Rating area. Example: "post". + * @param contextLevel Context level: course, module, user, etc. + * @param instanceId Context instance id. + * @param itemId Item id. Example: forum post id. + * @param scaleId Scale id. + * @param rating Rating value. Use CoreRatingProvider.UNSET_RATING to delete rating. + * @param ratedUserId Rated user id. + * @param aggregateMethod Aggregate method. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the aggregated rating. * @since 3.2 */ addRatingOnline(component: string, ratingArea: string, contextLevel: string, instanceId: number, itemId: number, @@ -225,17 +225,17 @@ export class CoreRatingProvider { /** * Get item ratings. * - * @param {string} contextLevel Context level: course, module, user, etc. - * @param {number} instanceId Context instance id. - * @param {string} component Component. Example: "mod_forum". - * @param {string} ratingArea Rating area. Example: "post". - * @param {number} itemId Item id. Example: forum post id. - * @param {number} scaleId Scale id. - * @param {string} [sort="timemodified"] Sort field. - * @param {number} [courseId] Course id. Used for fetching user profiles. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [ignoreCache=false] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise resolved with the list of ratings. + * @param contextLevel Context level: course, module, user, etc. + * @param instanceId Context instance id. + * @param component Component. Example: "mod_forum". + * @param ratingArea Rating area. Example: "post". + * @param itemId Item id. Example: forum post id. + * @param scaleId Scale id. + * @param sort Sort field. + * @param courseId Course id. Used for fetching user profiles. + * @param siteId Site ID. If not defined, current site. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved with the list of ratings. */ getItemRatings(contextLevel: string, instanceId: number, component: string, ratingArea: string, itemId: number, scaleId: number, sort: string = 'timemodified', courseId?: number, siteId?: string, ignoreCache: boolean = false): @@ -284,15 +284,15 @@ export class CoreRatingProvider { /** * Invalidate item ratings. * - * @param {string} contextLevel Context level: course, module, user, etc. - * @param {number} instanceId Context instance id. - * @param {string} component Component. Example: "mod_forum". - * @param {string} ratingArea Rating area. Example: "post". - * @param {number} itemId Item id. Example: forum post id. - * @param {number} scaleId Scale id. - * @param {string} [sort="timemodified"] Sort field. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param contextLevel Context level: course, module, user, etc. + * @param instanceId Context instance id. + * @param component Component. Example: "mod_forum". + * @param ratingArea Rating area. Example: "post". + * @param itemId Item id. Example: forum post id. + * @param scaleId Scale id. + * @param sort Sort field. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateRatingItems(contextLevel: string, instanceId: number, component: string, ratingArea: string, itemId: number, scaleId: number, sort: string = 'timemodified', siteId?: string): Promise { @@ -306,8 +306,8 @@ export class CoreRatingProvider { /** * Check if rating is disabled in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's disabled. + * @param site Site. If not defined, use current site. + * @return Whether it's disabled. */ isRatingDisabledInSite(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -318,8 +318,8 @@ export class CoreRatingProvider { /** * Check if rating is disabled in a certain site. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. */ isRatingDisabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -330,8 +330,8 @@ export class CoreRatingProvider { /** * Convenience function to merge two or more rating infos of the same instance. * - * @param {CoreRatingInfo[]} ratingInfos Array of rating infos. - * @return {CoreRatingInfo} Merged rating info or null. + * @param ratingInfos Array of rating infos. + * @return Merged rating info or null. */ mergeRatingInfos(ratingInfos: CoreRatingInfo[]): CoreRatingInfo { let result: CoreRatingInfo = null; @@ -370,12 +370,12 @@ export class CoreRatingProvider { * * This function should be called from the prefetch handler of activities with ratings. * - * @param {string} contextLevel Context level: course, module, user, etc. - * @param {number} instanceId Instance id. - * @param {string} [siteId] Site id. If not defined, current site. - * @param {number} [courseId] Course id. Used for prefetching user profiles. - * @param {CoreRatingInfo} [ratingInfo] Rating info returned by web services. - * @return {Promise} Promise resolved when done. + * @param contextLevel Context level: course, module, user, etc. + * @param instanceId Instance id. + * @param siteId Site id. If not defined, current site. + * @param courseId Course id. Used for prefetching user profiles. + * @param ratingInfo Rating info returned by web services. + * @return Promise resolved when done. */ prefetchRatings(contextLevel: string, instanceId: number, scaleId: number, courseId?: number, ratingInfo?: CoreRatingInfo, siteId?: string): Promise { @@ -400,13 +400,13 @@ export class CoreRatingProvider { /** * Get cache key for rating items WS calls. * - * @param {string} contextLevel Context level: course, module, user, etc. - * @param {string} component Component. Example: "mod_forum". - * @param {string} ratingArea Rating area. Example: "post". - * @param {number} itemId Item id. Example: forum post id. - * @param {number} scaleId Scale id. - * @param {string} sort Sort field. - * @return {string} Cache key. + * @param contextLevel Context level: course, module, user, etc. + * @param component Component. Example: "mod_forum". + * @param ratingArea Rating area. Example: "post". + * @param itemId Item id. Example: forum post id. + * @param scaleId Scale id. + * @param sort Sort field. + * @return Cache key. */ protected getItemRatingsCacheKey(contextLevel: string, instanceId: number, component: string, ratingArea: string, itemId: number, scaleId: number, sort: string): string { diff --git a/src/core/rating/providers/sync.ts b/src/core/rating/providers/sync.ts index 341797fe2..e7f292d36 100644 --- a/src/core/rating/providers/sync.ts +++ b/src/core/rating/providers/sync.ts @@ -54,14 +54,14 @@ export class CoreRatingSyncProvider extends CoreSyncBaseProvider { * * This function should be called from the sync provider of activities with ratings. * - * @param {string} component Component. Example: "mod_forum". - * @param {string} ratingArea Rating Area. Example: "post". - * @param {string} [contextLevel] Context level: course, module, user, etc. - * @param {numnber} [instanceId] Context instance id. - * @param {number} [itemSetId] Item set id. - * @param {boolean} [force] Wether to force sync not depending on last execution. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param component Component. Example: "mod_forum". + * @param ratingArea Rating Area. Example: "post". + * @param contextLevel Context level: course, module, user, etc. + * @param instanceId Context instance id. + * @param itemSetId Item set id. + * @param force Wether to force sync not depending on last execution. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncRatings(component: string, ratingArea: string, contextLevel?: string, instanceId?: number, itemSetId?: number, force?: boolean, siteId?: string): Promise<{itemSet: CoreRatingItemSet, updated: number[], warnings: string[]}[]> { @@ -97,13 +97,13 @@ export class CoreRatingSyncProvider extends CoreSyncBaseProvider { /** * Sync ratings of an item set only if a certain time has passed since the last time. * - * @param {string} component Component. Example: "mod_forum". - * @param {string} ratingArea Rating Area. Example: "post". - * @param {string} contextLevel Context level: course, module, user, etc. - * @param {number} instanceId Context instance id. - * @param {number} itemSetId Item set id. Example: forum discussion id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when ratings are synced or if it doesn't need to be synced. + * @param component Component. Example: "mod_forum". + * @param ratingArea Rating Area. Example: "post". + * @param contextLevel Context level: course, module, user, etc. + * @param instanceId Context instance id. + * @param itemSetId Item set id. Example: forum discussion id. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when ratings are synced or if it doesn't need to be synced. */ protected syncItemSetIfNeeded(component: string, ratingArea: string, contextLevel: string, instanceId: number, itemSetId: number, siteId?: string): Promise<{updated: number[], warnings: string[]}> { @@ -121,13 +121,13 @@ export class CoreRatingSyncProvider extends CoreSyncBaseProvider { /** * Synchronize all offline ratings of an item set. * - * @param {string} component Component. Example: "mod_forum". - * @param {string} ratingArea Rating Area. Example: "post". - * @param {string} contextLevel Context level: course, module, user, etc. - * @param {number} instanceId Context instance id. - * @param {number} itemSetId Item set id. Example: forum discussion id. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if sync is successful, rejected otherwise. + * @param component Component. Example: "mod_forum". + * @param ratingArea Rating Area. Example: "post". + * @param contextLevel Context level: course, module, user, etc. + * @param instanceId Context instance id. + * @param itemSetId Item set id. Example: forum discussion id. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if sync is successful, rejected otherwise. */ protected syncItemSet(component: string, ratingArea: string, contextLevel: string, instanceId: number, itemSetId: number, siteId?: string): Promise<{updated: number[], warnings: string[]}> { @@ -186,12 +186,12 @@ export class CoreRatingSyncProvider extends CoreSyncBaseProvider { /** * Get the sync id of an item set. * - * @param {string} component Component. Example: "mod_forum". - * @param {string} ratingArea Rating Area. Example: "post". - * @param {string} contextLevel Context level: course, module, user, etc. - * @param {number} instanceId Context instance id. - * @param {number} itemSetId Item set id. Example: forum discussion id. - * @return {string} Sync id. + * @param component Component. Example: "mod_forum". + * @param ratingArea Rating Area. Example: "post". + * @param contextLevel Context level: course, module, user, etc. + * @param instanceId Context instance id. + * @param itemSetId Item set id. Example: forum discussion id. + * @return Sync id. */ protected getItemSetSyncId(component: string, ratingArea: string, contextLevel: string, instanceId: number, itemSetId: number): string { diff --git a/src/core/settings/pages/list/list.ts b/src/core/settings/pages/list/list.ts index 8e6c4b944..3c50f1350 100644 --- a/src/core/settings/pages/list/list.ts +++ b/src/core/settings/pages/list/list.ts @@ -54,8 +54,8 @@ export class CoreSettingsListPage { /** * Open a handler. * - * @param {string} page Page to open. - * @param {any} params Params of the page to open. + * @param page Page to open. + * @param params Params of the page to open. */ openHandler(page: string, params?: any): void { this.selectedPage = page; diff --git a/src/core/settings/pages/space-usage/space-usage.ts b/src/core/settings/pages/space-usage/space-usage.ts index afd45fcd2..0a782a9c6 100644 --- a/src/core/settings/pages/space-usage/space-usage.ts +++ b/src/core/settings/pages/space-usage/space-usage.ts @@ -57,7 +57,7 @@ export class CoreSettingsSpaceUsagePage { /** * Convenience function to calculate each site's usage, and the total usage. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected calculateSizeUsage(): Promise { return this.sitesProvider.getSortedSites().then((sites) => { @@ -101,7 +101,7 @@ export class CoreSettingsSpaceUsagePage { /** * Convenience function to calculate space usage. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ protected fetchData(): Promise { const promises = [ @@ -114,7 +114,7 @@ export class CoreSettingsSpaceUsagePage { /** * Refresh the data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshData(refresher: any): void { this.fetchData().finally(() => { @@ -125,8 +125,8 @@ export class CoreSettingsSpaceUsagePage { /** * Convenience function to update site size, along with total usage. * - * @param {any} site Site object with space usage. - * @param {number} newUsage New space usage of the site in bytes. + * @param site Site object with space usage. + * @param newUsage New space usage of the site in bytes. */ protected updateSiteUsage(site: any, newUsage: number): void { const oldUsage = site.spaceUsage; @@ -137,8 +137,8 @@ export class CoreSettingsSpaceUsagePage { /** * Calculate the number of rows to be deleted on a site. * - * @param {any} site Site object. - * @return {Promise} If there are rows to delete or not. + * @param site Site object. + * @return If there are rows to delete or not. */ protected calcSiteClearRows(site: any): Promise { const clearTables = this.sitesProvider.getSiteTableSchemasToClear(); @@ -159,7 +159,7 @@ export class CoreSettingsSpaceUsagePage { /** * Deletes files of a site and the tables that can be cleared. * - * @param {any} siteData Site object with space usage. + * @param siteData Site object with space usage. */ deleteSiteStorage(siteData: any): void { this.textUtils.formatText(siteData.siteName).then((siteName) => { diff --git a/src/core/settings/pages/synchronization/synchronization.ts b/src/core/settings/pages/synchronization/synchronization.ts index e6c81b5e7..4238282d1 100644 --- a/src/core/settings/pages/synchronization/synchronization.ts +++ b/src/core/settings/pages/synchronization/synchronization.ts @@ -82,7 +82,7 @@ export class CoreSettingsSynchronizationPage implements OnDestroy { /** * Syncrhonizes a site. * - * @param {string} siteId Site ID. + * @param siteId Site ID. */ synchronize(siteId: string): void { this.settingsHelper.synchronizeSite(this.syncOnlyOnWifi, siteId).catch((error) => { @@ -96,8 +96,8 @@ export class CoreSettingsSynchronizationPage implements OnDestroy { /** * Returns true if site is beeing synchronized. * - * @param {string} siteId Site ID. - * @return {boolean} True if site is beeing synchronized, false otherwise. + * @param siteId Site ID. + * @return True if site is beeing synchronized, false otherwise. */ isSynchronizing(siteId: string): boolean { return !!this.settingsHelper.getSiteSyncPromise(siteId); diff --git a/src/core/settings/providers/delegate.ts b/src/core/settings/providers/delegate.ts index a7fca19cd..e3e5fb2b4 100644 --- a/src/core/settings/providers/delegate.ts +++ b/src/core/settings/providers/delegate.ts @@ -25,14 +25,13 @@ import { CoreUtilsProvider } from '@providers/utils/utils'; export interface CoreSettingsHandler extends CoreDelegateHandler { /** * The highest priority is displayed first. - * @type {number} */ priority: number; /** * Returns the data needed to render the handler. * - * @return {CoreSettingsHandlerData} Data. + * @return Data. */ getDisplayData(): CoreSettingsHandlerData; } @@ -43,31 +42,26 @@ export interface CoreSettingsHandler extends CoreDelegateHandler { export interface CoreSettingsHandlerData { /** * Name of the page to load for the handler. - * @type {string} */ page: string; /** * Params list of the page to load for the handler. - * @type {any} */ params?: any; /** * Title to display for the handler. - * @type {string} */ title: string; /** * Name of the icon to display for the handler. - * @type {string} */ icon?: string; // Name of the icon to display in the menu. /** * Class to add to the displayed handler. - * @type {string} */ class?: string; } @@ -97,8 +91,6 @@ export class CoreSettingsDelegate extends CoreDelegate { /** * Get the handlers for the current site. - * - * @return {CoreSettingsHandlerData[]} */ getHandlers(): CoreSettingsHandlerData[] { return this.siteHandlers; diff --git a/src/core/settings/providers/helper.ts b/src/core/settings/providers/helper.ts index 0a2d5c32f..26ffda777 100644 --- a/src/core/settings/providers/helper.ts +++ b/src/core/settings/providers/helper.ts @@ -39,10 +39,10 @@ export class CoreSettingsHelper { /** * Get a certain processor from a list of processors. * - * @param {any[]} processors List of processors. - * @param {string} name Name of the processor to get. - * @param {boolean} [fallback=true] True to return first processor if not found, false to not return any. Defaults to true. - * @return {any} Processor. + * @param processors List of processors. + * @param name Name of the processor to get. + * @param fallback True to return first processor if not found, false to not return any. Defaults to true. + * @return Processor. */ getProcessor(processors: any[], name: string, fallback: boolean = true): any { if (!processors || !processors.length) { @@ -63,9 +63,9 @@ export class CoreSettingsHelper { /** * Return the components and notifications that have a certain processor. * - * @param {string} processor Name of the processor to filter. - * @param {any[]} components Array of components. - * @return {any[]} Filtered components. + * @param processor Name of the processor to filter. + * @param components Array of components. + * @return Filtered components. */ getProcessorComponents(processor: string, components: any[]): any[] { const result = []; @@ -104,8 +104,8 @@ export class CoreSettingsHelper { /** * Get the synchronization promise of a site. * - * @param {string} siteId ID of the site. - * @return {Promise | null} Sync promise or null if site is not being syncrhonized. + * @param siteId ID of the site. + * @return Sync promise or null if site is not being syncrhonized. */ getSiteSyncPromise(siteId: string): Promise { if (this.syncPromises[siteId]) { @@ -118,9 +118,9 @@ export class CoreSettingsHelper { /** * Synchronize a site. * - * @param {boolean} syncOnlyOnWifi True to sync only on wifi, false otherwise. - * @param {string} siteId ID of the site to synchronize. - * @return {Promise} Promise resolved when synchronized, rejected if failure. + * @param syncOnlyOnWifi True to sync only on wifi, false otherwise. + * @param siteId ID of the site to synchronize. + * @return Promise resolved when synchronized, rejected if failure. */ synchronizeSite(syncOnlyOnWifi: boolean, siteId: string): Promise { if (this.syncPromises[siteId]) { diff --git a/src/core/sharedfiles/pages/choose-site/choose-site.ts b/src/core/sharedfiles/pages/choose-site/choose-site.ts index d680913a9..e1622c50c 100644 --- a/src/core/sharedfiles/pages/choose-site/choose-site.ts +++ b/src/core/sharedfiles/pages/choose-site/choose-site.ts @@ -78,7 +78,7 @@ export class CoreSharedFilesChooseSitePage implements OnInit { /** * Store the file in a certain site. * - * @param {string} siteId Site ID. + * @param siteId Site ID. */ storeInSite(siteId: string): void { this.loaded = false; diff --git a/src/core/sharedfiles/pages/list/list.ts b/src/core/sharedfiles/pages/list/list.ts index db1f706b5..72e1db6e9 100644 --- a/src/core/sharedfiles/pages/list/list.ts +++ b/src/core/sharedfiles/pages/list/list.ts @@ -75,7 +75,7 @@ export class CoreSharedFilesListPage implements OnInit, OnDestroy { /** * Load the files. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected loadFiles(): Promise { if (this.path) { @@ -100,7 +100,7 @@ export class CoreSharedFilesListPage implements OnInit, OnDestroy { /** * Refresh the list of files. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshFiles(refresher: any): void { this.loadFiles().finally(() => { @@ -111,7 +111,7 @@ export class CoreSharedFilesListPage implements OnInit, OnDestroy { /** * Called when a file is deleted. Remove the file from the list. * - * @param {number} index Position of the file. + * @param index Position of the file. */ fileDeleted(index: number): void { this.files.splice(index, 1); @@ -120,8 +120,8 @@ export class CoreSharedFilesListPage implements OnInit, OnDestroy { /** * Called when a file is renamed. Update the list. * - * @param {number} index Position of the file. - * @param {any} data Data containing the new FileEntry. + * @param index Position of the file. + * @param data Data containing the new FileEntry. */ fileRenamed(index: number, data: any): void { this.files[index] = data.file; @@ -130,7 +130,7 @@ export class CoreSharedFilesListPage implements OnInit, OnDestroy { /** * Open a subfolder. * - * @param {any} folder The folder to open. + * @param folder The folder to open. */ openFolder(folder: any): void { const path = this.textUtils.concatenatePaths(this.path, folder.name); @@ -154,7 +154,7 @@ export class CoreSharedFilesListPage implements OnInit, OnDestroy { /** * Change site loaded. * - * @param {string} id Site to load. + * @param id Site to load. */ changeSite(id: string): void { this.siteId = id; @@ -166,7 +166,7 @@ export class CoreSharedFilesListPage implements OnInit, OnDestroy { /** * A file was picked. * - * @param {any} file Picked file. + * @param file Picked file. */ filePicked(file: any): void { this.viewCtrl.dismiss(file); diff --git a/src/core/sharedfiles/providers/helper.ts b/src/core/sharedfiles/providers/helper.ts index a2ef83342..449905abf 100644 --- a/src/core/sharedfiles/providers/helper.ts +++ b/src/core/sharedfiles/providers/helper.ts @@ -43,9 +43,9 @@ export class CoreSharedFilesHelperProvider { /** * Ask a user if he wants to replace a file (using originalName) or rename it (using newName). * - * @param {string} originalName Original name. - * @param {string} newName New name. - * @return {Promise} Promise resolved with the name to use when the user chooses. Rejected if user cancels. + * @param originalName Original name. + * @param newName New name. + * @return Promise resolved with the name to use when the user chooses. Rejected if user cancels. */ askRenameReplace(originalName: string, newName: string): Promise { const deferred = this.utils.promiseDefer(), @@ -76,8 +76,8 @@ export class CoreSharedFilesHelperProvider { /** * Go to the choose site view. * - * @param {string} filePath File path to send to the view. - * @param {boolean} [isInbox] Whether the file is in the Inbox folder. + * @param filePath File path to send to the view. + * @param isInbox Whether the file is in the Inbox folder. */ goToChooseSite(filePath: string, isInbox?: boolean): void { const navCtrl = this.appProvider.getRootNavController(); @@ -87,7 +87,7 @@ export class CoreSharedFilesHelperProvider { /** * Whether the user is already choosing a site to store a shared file. * - * @return {boolean} Whether the user is already choosing a site to store a shared file. + * @return Whether the user is already choosing a site to store a shared file. */ protected isChoosingSite(): boolean { const navCtrl = this.appProvider.getRootNavController(); @@ -98,8 +98,8 @@ export class CoreSharedFilesHelperProvider { /** * Open the view to select a shared file. * - * @param {string[]} [mimetypes] List of supported mimetypes. If undefined, all mimetypes supported. - * @return {Promise} Promise resolved when a file is picked, rejected if file picker is closed without selecting a file. + * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. + * @return Promise resolved when a file is picked, rejected if file picker is closed without selecting a file. */ pickSharedFile(mimetypes?: string[]): Promise { return new Promise((resolve, reject): void => { @@ -130,9 +130,9 @@ export class CoreSharedFilesHelperProvider { /** * Delete a shared file. * - * @param {any} fileEntry The file entry to delete. - * @param {boolean} [isInbox] Whether the file is in the Inbox folder. - * @return {Promise} Promise resolved when done. + * @param fileEntry The file entry to delete. + * @param isInbox Whether the file is in the Inbox folder. + * @return Promise resolved when done. */ protected removeSharedFile(fileEntry: any, isInbox?: boolean): Promise { if (isInbox) { @@ -147,8 +147,8 @@ export class CoreSharedFilesHelperProvider { * If more than one site is found, the user will have to choose the site where to store it in. * If more than one file is found, treat only the first one. * - * @param {string} [path] Path to a file received when launching the app. - * @return {Promise} Promise resolved when done. + * @param path Path to a file received when launching the app. + * @return Promise resolved when done. */ searchIOSNewSharedFiles(path?: string): Promise { return this.initDelegate.ready().then(() => { @@ -190,10 +190,10 @@ export class CoreSharedFilesHelperProvider { /** * Store a shared file in a site's shared files folder. * - * @param {any} fileEntry Shared file entry. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [isInbox] Whether the file is in the Inbox folder. - * @return {Promise} Promise resolved when done. + * @param fileEntry Shared file entry. + * @param siteId Site ID. If not defined, current site. + * @param isInbox Whether the file is in the Inbox folder. + * @return Promise resolved when done. */ storeSharedFileInSite(fileEntry: any, siteId?: string, isInbox?: boolean): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); diff --git a/src/core/sharedfiles/providers/sharedfiles.ts b/src/core/sharedfiles/providers/sharedfiles.ts index 1938c1ec4..0c31bf8a1 100644 --- a/src/core/sharedfiles/providers/sharedfiles.ts +++ b/src/core/sharedfiles/providers/sharedfiles.ts @@ -59,7 +59,7 @@ export class CoreSharedFilesProvider { * Checks if there is a new file received in iOS. If more than one file is found, treat only the first one. * The file returned is marked as "treated" and will be deleted in the next execution. * - * @return {Promise} Promise resolved with a new file to be treated. If no new files found, promise is rejected. + * @return Promise resolved with a new file to be treated. If no new files found, promise is rejected. */ checkIOSNewFiles(): Promise { this.logger.debug('Search for new files on iOS'); @@ -110,8 +110,8 @@ export class CoreSharedFilesProvider { /** * Deletes a file in the Inbox folder (shared with the app). * - * @param {any} entry FileEntry. - * @return {Promise} Promise resolved when done, rejected otherwise. + * @param entry FileEntry. + * @return Promise resolved when done, rejected otherwise. */ deleteInboxFile(entry: any): Promise { this.logger.debug('Delete inbox file: ' + entry.name); @@ -132,8 +132,8 @@ export class CoreSharedFilesProvider { /** * Get the ID of a file for managing "treated" files. * - * @param {any} entry FileEntry. - * @return {string} File ID. + * @param entry FileEntry. + * @return File ID. */ protected getFileId(entry: any): string { return Md5.hashAsciiStr(entry.name); @@ -142,10 +142,10 @@ export class CoreSharedFilesProvider { /** * Get the shared files stored in a site. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {string} [path] Path to search inside the site shared folder. - * @param {string[]} [mimetypes] List of supported mimetypes. If undefined, all mimetypes supported. - * @return {Promise} Promise resolved with the files. + * @param siteId Site ID. If not defined, current site. + * @param path Path to search inside the site shared folder. + * @param mimetypes List of supported mimetypes. If undefined, all mimetypes supported. + * @return Promise resolved with the files. */ getSiteSharedFiles(siteId?: string, path?: string, mimetypes?: string[]): Promise { let pathToGet = this.getSiteSharedFilesDirPath(siteId); @@ -174,8 +174,8 @@ export class CoreSharedFilesProvider { /** * Get the path to a site's shared files folder. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {string} Path. + * @param siteId Site ID. If not defined, current site. + * @return Path. */ getSiteSharedFilesDirPath(siteId?: string): string { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -186,8 +186,8 @@ export class CoreSharedFilesProvider { /** * Check if a file has been treated already. * - * @param {string} fileId File ID. - * @return {Promise} Resolved if treated, rejected otherwise. + * @param fileId File ID. + * @return Resolved if treated, rejected otherwise. */ protected isFileTreated(fileId: string): Promise { return this.appDB.getRecord(this.SHARED_FILES_TABLE, { id: fileId }); @@ -196,8 +196,8 @@ export class CoreSharedFilesProvider { /** * Mark a file as treated. * - * @param {string} fileId File ID. - * @return {Promise} Promise resolved when marked. + * @param fileId File ID. + * @return Promise resolved when marked. */ protected markAsTreated(fileId: string): Promise { // Check if it's already marked. @@ -210,10 +210,10 @@ export class CoreSharedFilesProvider { /** * Store a file in a site's shared folder. * - * @param {any} entry File entry. - * @param {string} [newName] Name of the new file. If not defined, use original file's name. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise}Promise resolved when done. + * @param entry File entry. + * @param newName Name of the new file. If not defined, use original file's name. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. */ storeFileInSite(entry: any, newName?: string, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -240,8 +240,8 @@ export class CoreSharedFilesProvider { /** * Unmark a file as treated. * - * @param {string} fileId File ID. - * @return {Promise} Resolved when unmarked. + * @param fileId File ID. + * @return Resolved when unmarked. */ protected unmarkAsTreated(fileId: string): Promise { return this.appDB.deleteRecords(this.SHARED_FILES_TABLE, { id: fileId }); diff --git a/src/core/sharedfiles/providers/upload-handler.ts b/src/core/sharedfiles/providers/upload-handler.ts index da602b2b3..6eab53615 100644 --- a/src/core/sharedfiles/providers/upload-handler.ts +++ b/src/core/sharedfiles/providers/upload-handler.ts @@ -29,7 +29,7 @@ export class CoreSharedFilesUploadHandler implements CoreFileUploaderHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @return True or promise resolved with true if enabled. */ isEnabled(): boolean | Promise { return this.platform.is('ios'); @@ -38,8 +38,8 @@ export class CoreSharedFilesUploadHandler implements CoreFileUploaderHandler { /** * Given a list of mimetypes, return the ones that are supported by the handler. * - * @param {string[]} [mimetypes] List of mimetypes. - * @return {string[]} Supported mimetypes. + * @param mimetypes List of mimetypes. + * @return Supported mimetypes. */ getSupportedMimetypes(mimetypes: string[]): string[] { return mimetypes; @@ -48,7 +48,7 @@ export class CoreSharedFilesUploadHandler implements CoreFileUploaderHandler { /** * Get the data to display the handler. * - * @return {CoreFileUploaderHandlerData} Data. + * @return Data. */ getData(): CoreFileUploaderHandlerData { return { diff --git a/src/core/sitehome/components/index/index.ts b/src/core/sitehome/components/index/index.ts index 8c8a511c1..efc92458d 100644 --- a/src/core/sitehome/components/index/index.ts +++ b/src/core/sitehome/components/index/index.ts @@ -58,7 +58,7 @@ export class CoreSiteHomeIndexComponent implements OnInit { /** * Refresh the data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ doRefresh(refresher: any): void { const promises = []; @@ -93,7 +93,7 @@ export class CoreSiteHomeIndexComponent implements OnInit { /** * Convenience function to fetch the data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected loadContent(): Promise { this.hasContent = false; diff --git a/src/core/sitehome/providers/index-link-handler.ts b/src/core/sitehome/providers/index-link-handler.ts index f0e15ad31..2f57e218b 100644 --- a/src/core/sitehome/providers/index-link-handler.ts +++ b/src/core/sitehome/providers/index-link-handler.ts @@ -36,11 +36,11 @@ export class CoreSiteHomeIndexLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -55,11 +55,11 @@ export class CoreSiteHomeIndexLinkHandler extends CoreContentLinksHandlerBase { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { courseId = parseInt(params.id, 10); diff --git a/src/core/sitehome/providers/sitehome.ts b/src/core/sitehome/providers/sitehome.ts index 2d5fa3aaf..207916fe9 100644 --- a/src/core/sitehome/providers/sitehome.ts +++ b/src/core/sitehome/providers/sitehome.ts @@ -34,8 +34,8 @@ export class CoreSiteHomeProvider { /** * Get the news forum for the Site Home. * - * @param {number} siteHomeId Site Home ID. - * @return {Promise} Promise resolved with the forum if found, rejected otherwise. + * @param siteHomeId Site Home ID. + * @return Promise resolved with the forum if found, rejected otherwise. */ getNewsForum(siteHomeId: number): Promise { return this.forumProvider.getCourseForums(siteHomeId).then((forums) => { @@ -52,8 +52,8 @@ export class CoreSiteHomeProvider { /** * Invalidate the WS call to get the news forum for the Site Home. * - * @param {number} siteHomeId Site Home ID. - * @return {Promise} Promise resolved when invalidated. + * @param siteHomeId Site Home ID. + * @return Promise resolved when invalidated. */ invalidateNewsForum(siteHomeId: number): Promise { return this.forumProvider.invalidateForumData(siteHomeId); @@ -62,8 +62,8 @@ export class CoreSiteHomeProvider { /** * Returns whether or not the frontpage is available for the current site. * - * @param {string} [siteId] The site ID. If not defined, current site. - * @return {Promise} Promise resolved with boolean: whether it's available. + * @param siteId The site ID. If not defined, current site. + * @return Promise resolved with boolean: whether it's available. */ isAvailable(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -112,8 +112,8 @@ export class CoreSiteHomeProvider { /** * Check if Site Home is disabled in a certain site. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. */ isDisabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -124,8 +124,8 @@ export class CoreSiteHomeProvider { /** * Check if Site Home is disabled in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's disabled. + * @param site Site. If not defined, use current site. + * @return Whether it's disabled. */ isDisabledInSite(site: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); diff --git a/src/core/siteplugins/classes/call-ws-click-directive.ts b/src/core/siteplugins/classes/call-ws-click-directive.ts index c6c598b53..eb88363fe 100644 --- a/src/core/siteplugins/classes/call-ws-click-directive.ts +++ b/src/core/siteplugins/classes/call-ws-click-directive.ts @@ -63,7 +63,7 @@ export class CoreSitePluginsCallWSOnClickBaseDirective extends CoreSitePluginsCa /** * Call a WS. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected callWS(): Promise { const modal = this.domUtils.showModalLoading(); diff --git a/src/core/siteplugins/classes/call-ws-directive.ts b/src/core/siteplugins/classes/call-ws-directive.ts index 08dac6c7f..fb4f7d1f8 100644 --- a/src/core/siteplugins/classes/call-ws-directive.ts +++ b/src/core/siteplugins/classes/call-ws-directive.ts @@ -57,7 +57,7 @@ export class CoreSitePluginsCallWSBaseDirective implements OnInit, OnDestroy { /** * Call a WS. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected callWS(): Promise { const params = this.getParamsForWS(); @@ -78,7 +78,7 @@ export class CoreSitePluginsCallWSBaseDirective implements OnInit, OnDestroy { /** * Get the params for the WS call. * - * @return {any} Params. + * @return Params. */ protected getParamsForWS(): any { let params = this.params || {}; @@ -97,7 +97,7 @@ export class CoreSitePluginsCallWSBaseDirective implements OnInit, OnDestroy { /** * Function called when the WS call is successful. * - * @param {any} result Result of the WS call. + * @param result Result of the WS call. */ protected wsCallSuccess(result: any): void { // Function to be overridden. @@ -106,7 +106,7 @@ export class CoreSitePluginsCallWSBaseDirective implements OnInit, OnDestroy { /** * Invalidate the WS call. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ invalidate(): Promise { const params = this.getParamsForWS(); diff --git a/src/core/siteplugins/classes/compile-init-component.ts b/src/core/siteplugins/classes/compile-init-component.ts index 96bf80965..c71fe3b6f 100644 --- a/src/core/siteplugins/classes/compile-init-component.ts +++ b/src/core/siteplugins/classes/compile-init-component.ts @@ -29,7 +29,7 @@ export class CoreSitePluginsCompileInitComponent { /** * Function called when the component is created. * - * @param {any} instance The component instance. + * @param instance The component instance. */ componentCreated(instance: any): void { // Check if the JS defined an init function. @@ -42,7 +42,7 @@ export class CoreSitePluginsCompileInitComponent { /** * Get the handler data. * - * @param {string} name The name of the handler. + * @param name The name of the handler. */ getHandlerData(name: string): void { // Retrieve the handler data. diff --git a/src/core/siteplugins/classes/handlers/assign-feedback-handler.ts b/src/core/siteplugins/classes/handlers/assign-feedback-handler.ts index 0948c0c8c..527c6bb3e 100644 --- a/src/core/siteplugins/classes/handlers/assign-feedback-handler.ts +++ b/src/core/siteplugins/classes/handlers/assign-feedback-handler.ts @@ -30,10 +30,10 @@ export class CoreSitePluginsAssignFeedbackHandler extends AddonModAssignBaseFeed * Return the Component to use to display the plugin data, either in read or in edit mode. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} plugin The plugin object. - * @param {boolean} [edit] Whether the user is editing. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param plugin The plugin object. + * @param edit Whether the user is editing. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any, edit?: boolean): any | Promise { return CoreSitePluginsAssignFeedbackComponent; @@ -42,8 +42,8 @@ export class CoreSitePluginsAssignFeedbackHandler extends AddonModAssignBaseFeed /** * Get a readable name to use for the plugin. * - * @param {any} plugin The plugin object. - * @return {string} The plugin name. + * @param plugin The plugin object. + * @return The plugin name. */ getPluginName(plugin: any): string { // Check if there's a translated string for the plugin. diff --git a/src/core/siteplugins/classes/handlers/assign-submission-handler.ts b/src/core/siteplugins/classes/handlers/assign-submission-handler.ts index 9658a370e..85de62cb0 100644 --- a/src/core/siteplugins/classes/handlers/assign-submission-handler.ts +++ b/src/core/siteplugins/classes/handlers/assign-submission-handler.ts @@ -30,10 +30,10 @@ export class CoreSitePluginsAssignSubmissionHandler extends AddonModAssignBaseSu * Return the Component to use to display the plugin data, either in read or in edit mode. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} plugin The plugin object. - * @param {boolean} [edit] Whether the user is editing. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param plugin The plugin object. + * @param edit Whether the user is editing. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector, plugin: any, edit?: boolean): any | Promise { return CoreSitePluginsAssignSubmissionComponent; @@ -42,8 +42,8 @@ export class CoreSitePluginsAssignSubmissionHandler extends AddonModAssignBaseSu /** * Get a readable name to use for the plugin. * - * @param {any} plugin The plugin object. - * @return {string} The plugin name. + * @param plugin The plugin object. + * @return The plugin name. */ getPluginName(plugin: any): string { // Check if there's a translated string for the plugin. @@ -64,7 +64,7 @@ export class CoreSitePluginsAssignSubmissionHandler extends AddonModAssignBaseSu /** * Whether or not the handler is enabled for edit on a site level. * - * @return {boolean|Promise} Whether or not the handler is enabled for edit on a site level. + * @return Whether or not the handler is enabled for edit on a site level. */ isEnabledForEdit(): boolean | Promise { return true; diff --git a/src/core/siteplugins/classes/handlers/base-handler.ts b/src/core/siteplugins/classes/handlers/base-handler.ts index 7226a0202..dc68d6b43 100644 --- a/src/core/siteplugins/classes/handlers/base-handler.ts +++ b/src/core/siteplugins/classes/handlers/base-handler.ts @@ -24,7 +24,7 @@ export class CoreSitePluginsBaseHandler implements CoreDelegateHandler { /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ isEnabled(): boolean | Promise { return true; diff --git a/src/core/siteplugins/classes/handlers/block-handler.ts b/src/core/siteplugins/classes/handlers/block-handler.ts index b4734d36e..25602a22e 100644 --- a/src/core/siteplugins/classes/handlers/block-handler.ts +++ b/src/core/siteplugins/classes/handlers/block-handler.ts @@ -33,11 +33,11 @@ export class CoreSitePluginsBlockHandler extends CoreSitePluginsBaseHandler impl * Gets display data for this block. The class and title can be provided either by data from * the handler schema (mobile.php) or using default values. * - * @param {Injector} injector Injector - * @param {any} block Block data - * @param {string} contextLevel Context level (not used) - * @param {number} instanceId Instance id (not used) - * @return {CoreBlockHandlerData|Promise} Data or promise resolved with the data + * @param injector Injector + * @param block Block data + * @param contextLevel Context level (not used) + * @param instanceId Instance id (not used) + * @return Data or promise resolved with the data */ getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number): CoreBlockHandlerData | Promise { diff --git a/src/core/siteplugins/classes/handlers/course-format-handler.ts b/src/core/siteplugins/classes/handlers/course-format-handler.ts index b8453ca2a..83a1d5149 100644 --- a/src/core/siteplugins/classes/handlers/course-format-handler.ts +++ b/src/core/siteplugins/classes/handlers/course-format-handler.ts @@ -29,8 +29,8 @@ export class CoreSitePluginsCourseFormatHandler extends CoreSitePluginsBaseHandl /** * Whether it allows seeing all sections at the same time. Defaults to true. * - * @param {any} course The course to check. - * @type {boolean} Whether it can view all sections. + * @param course The course to check. + * @return Whether it can view all sections. */ canViewAllSections(course: any): boolean { return typeof this.handlerSchema.canviewallsections != 'undefined' ? this.handlerSchema.canviewallsections : true; @@ -39,8 +39,8 @@ export class CoreSitePluginsCourseFormatHandler extends CoreSitePluginsBaseHandl /** * Whether the option to enable section/module download should be displayed. Defaults to true. * - * @param {any} course The course to check. - * @type {boolean} Whether the option to enable section/module download should be displayed. + * @param course The course to check. + * @return Whether the option to enable section/module download should be displayed. */ displayEnableDownload(course: any): boolean { return typeof this.handlerSchema.displayenabledownload != 'undefined' ? this.handlerSchema.displayenabledownload : true; @@ -49,8 +49,8 @@ export class CoreSitePluginsCourseFormatHandler extends CoreSitePluginsBaseHandl /** * Whether the default section selector should be displayed. Defaults to true. * - * @param {any} course The course to check. - * @type {boolean} Whether the default section selector should be displayed. + * @param course The course to check. + * @return Whether the default section selector should be displayed. */ displaySectionSelector(course: any): boolean { return typeof this.handlerSchema.displaysectionselector != 'undefined' ? this.handlerSchema.displaysectionselector : true; @@ -62,9 +62,9 @@ export class CoreSitePluginsCourseFormatHandler extends CoreSitePluginsBaseHandl * If you want to customize the default format there are several methods to customize parts of it. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} course The course to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param course The course to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getCourseFormatComponent(injector: Injector, course: any): any | Promise { if (this.handlerSchema.method) { diff --git a/src/core/siteplugins/classes/handlers/course-option-handler.ts b/src/core/siteplugins/classes/handlers/course-option-handler.ts index e3fde2bd2..4bc1f7ce2 100644 --- a/src/core/siteplugins/classes/handlers/course-option-handler.ts +++ b/src/core/siteplugins/classes/handlers/course-option-handler.ts @@ -42,11 +42,11 @@ export class CoreSitePluginsCourseOptionHandler extends CoreSitePluginsBaseHandl /** * Whether or not the handler is enabled for a certain course. * - * @param {number} courseId The course ID. - * @param {any} accessData Access type and data. Default, guest, ... - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @param courseId The course ID. + * @param accessData Access type and data. Default, guest, ... + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return True or promise resolved with true if enabled. */ isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise { // Wait for "init" result to be updated. @@ -61,9 +61,9 @@ export class CoreSitePluginsCourseOptionHandler extends CoreSitePluginsBaseHandl /** * Returns the data needed to render the handler (if it isn't a menu handler). * - * @param {Injector} injector Injector. - * @param {number} course The course. - * @return {CoreCourseOptionsHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param course The course. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, course: any): CoreCourseOptionsHandlerData | Promise { return { @@ -79,9 +79,9 @@ export class CoreSitePluginsCourseOptionHandler extends CoreSitePluginsBaseHandl /** * Returns the data needed to render the handler (if it's a menu handler). * - * @param {Injector} injector Injector. - * @param {any} course The course. - * @return {CoreCourseOptionsMenuHandlerData|Promise} Data or promise resolved with data. + * @param injector Injector. + * @param course The course. + * @return Data or promise resolved with data. */ getMenuDisplayData(injector: Injector, course: any): CoreCourseOptionsMenuHandlerData | Promise { @@ -106,8 +106,8 @@ export class CoreSitePluginsCourseOptionHandler extends CoreSitePluginsBaseHandl /** * Called when a course is downloaded. It should prefetch all the data to be able to see the plugin in offline. * - * @param {any} course The course. - * @return {Promise} Promise resolved when done. + * @param course The course. + * @return Promise resolved when done. */ prefetch(course: any): Promise { const args = { @@ -121,7 +121,7 @@ export class CoreSitePluginsCourseOptionHandler extends CoreSitePluginsBaseHandl /** * Set init result. * - * @param {any} result Result to set. + * @param result Result to set. */ setInitResult(result: any): void { this.initResult = result; diff --git a/src/core/siteplugins/classes/handlers/main-menu-handler.ts b/src/core/siteplugins/classes/handlers/main-menu-handler.ts index db47e3598..09be56f52 100644 --- a/src/core/siteplugins/classes/handlers/main-menu-handler.ts +++ b/src/core/siteplugins/classes/handlers/main-menu-handler.ts @@ -31,7 +31,7 @@ export class CoreSitePluginsMainMenuHandler extends CoreSitePluginsBaseHandler i /** * Returns the data needed to render the handler. * - * @return {CoreMainMenuHandlerData} Data. + * @return Data. */ getDisplayData(): CoreMainMenuHandlerData { return { diff --git a/src/core/siteplugins/classes/handlers/message-output-handler.ts b/src/core/siteplugins/classes/handlers/message-output-handler.ts index 264008d64..51e636e78 100644 --- a/src/core/siteplugins/classes/handlers/message-output-handler.ts +++ b/src/core/siteplugins/classes/handlers/message-output-handler.ts @@ -28,7 +28,7 @@ export class CoreSitePluginsMessageOutputHandler extends CoreSitePluginsBaseHand /** * Returns the data needed to render the handler. * - * @return {AddonMessageOutputHandlerData} Data. + * @return Data. */ getDisplayData(): AddonMessageOutputHandlerData { return { diff --git a/src/core/siteplugins/classes/handlers/module-handler.ts b/src/core/siteplugins/classes/handlers/module-handler.ts index 41cffe6c6..bb454ea11 100644 --- a/src/core/siteplugins/classes/handlers/module-handler.ts +++ b/src/core/siteplugins/classes/handlers/module-handler.ts @@ -40,10 +40,10 @@ export class CoreSitePluginsModuleHandler extends CoreSitePluginsBaseHandler imp /** * Get the data required to display the module in the course contents view. * - * @param {any} module The module object. - * @param {number} courseId The course ID. - * @param {number} sectionId The section ID. - * @return {CoreCourseModuleHandlerData} Data to render the module. + * @param module The module object. + * @param courseId The course ID. + * @param sectionId The section ID. + * @return Data to render the module. */ getData(module: any, courseId: number, sectionId: number): CoreCourseModuleHandlerData { const hasOffline = !!(this.handlerSchema.offlinefunctions && Object.keys(this.handlerSchema.offlinefunctions).length), @@ -70,7 +70,7 @@ export class CoreSitePluginsModuleHandler extends CoreSitePluginsBaseHandler imp /** * Get the icon src for the module. * - * @return {string} The icon src. + * @return The icon src. */ getIconSrc(): string { return this.handlerSchema.displaydata.icon; @@ -81,10 +81,10 @@ export class CoreSitePluginsModuleHandler extends CoreSitePluginsBaseHandler imp * The component returned must implement CoreCourseModuleMainComponent. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} course The course object. - * @param {any} module The module object. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param course The course object. + * @param module The module object. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getMainComponent(injector: Injector, course: any, module: any): any | Promise { return CoreSitePluginsModuleIndexComponent; diff --git a/src/core/siteplugins/classes/handlers/module-prefetch-handler.ts b/src/core/siteplugins/classes/handlers/module-prefetch-handler.ts index 434838b75..91788299b 100644 --- a/src/core/siteplugins/classes/handlers/module-prefetch-handler.ts +++ b/src/core/siteplugins/classes/handlers/module-prefetch-handler.ts @@ -54,10 +54,10 @@ export class CoreSitePluginsModulePrefetchHandler extends CoreCourseActivityPref /** * Download the module. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when all content is downloaded. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when all content is downloaded. */ download(module: any, courseId: number, dirPath?: string): Promise { return this.prefetchPackage(module, courseId, false, this.downloadPrefetchPlugin.bind(this), undefined, false, dirPath); @@ -66,13 +66,13 @@ export class CoreSitePluginsModulePrefetchHandler extends CoreCourseActivityPref /** * Download or prefetch the plugin, downloading the files and calling the needed WS. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {boolean} [prefetch] True to prefetch, false to download right away. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param siteId Site ID. If not defined, current site. + * @param prefetch True to prefetch, false to download right away. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ protected downloadPrefetchPlugin(module: any, courseId: number, single?: boolean, siteId?: string, prefetch?: boolean, dirPath?: string): Promise { @@ -99,11 +99,11 @@ export class CoreSitePluginsModulePrefetchHandler extends CoreCourseActivityPref /** * Download or prefetch the plugin files. * - * @param {any} module The module object returned by WS. - * @param {number} courseId Course ID. - * @param {boolean} [prefetch] True to prefetch, false to download right away. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module The module object returned by WS. + * @param courseId Course ID. + * @param prefetch True to prefetch, false to download right away. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ protected downloadOrPrefetchFiles(siteId: string, module: any, courseId: number, prefetch?: boolean, dirPath?: string) : Promise { @@ -137,11 +137,11 @@ export class CoreSitePluginsModulePrefetchHandler extends CoreCourseActivityPref /** * Get the download size of a module. * - * @param {any} module Module. - * @param {Number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @return {Promise<{size: number, total: boolean}>} Promise resolved with the size and a boolean indicating if it was able - * to calculate the total size. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @return Promise resolved with the size and a boolean indicating if it was able + * to calculate the total size. */ getDownloadSize(module: any, courseId: number, single?: boolean): Promise<{ size: number, total: boolean }> { // In most cases, to calculate the size we'll have to do all the WS calls. Just return unknown size. @@ -151,9 +151,9 @@ export class CoreSitePluginsModulePrefetchHandler extends CoreCourseActivityPref /** * Invalidate the prefetched content. * - * @param {number} moduleId The module ID. - * @param {number} courseId Course ID the module belongs to. - * @return {Promise} Promise resolved when the data is invalidated. + * @param moduleId The module ID. + * @param courseId Course ID the module belongs to. + * @return Promise resolved when the data is invalidated. */ invalidateContent(moduleId: number, courseId: number): Promise { const promises = [], @@ -186,7 +186,7 @@ export class CoreSitePluginsModulePrefetchHandler extends CoreCourseActivityPref /** * Whether or not the handler is enabled on a site level. * - * @return {boolean|Promise} A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. + * @return A boolean, or a promise resolved with a boolean, indicating if the handler is enabled. */ isEnabled(): boolean | Promise { return true; @@ -195,10 +195,10 @@ export class CoreSitePluginsModulePrefetchHandler extends CoreCourseActivityPref /** * Load module contents into module.contents if they aren't loaded already. * - * @param {any} module Module to load the contents. - * @param {number} [courseId] The course ID. Recommended to speed up the process and minimize data usage. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise} Promise resolved when loaded. + * @param module Module to load the contents. + * @param courseId The course ID. Recommended to speed up the process and minimize data usage. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved when loaded. */ loadContents(module: any, courseId: number, ignoreCache?: boolean): Promise { if (this.isResource) { @@ -211,11 +211,11 @@ export class CoreSitePluginsModulePrefetchHandler extends CoreCourseActivityPref /** * Prefetch a module. * - * @param {any} module Module. - * @param {number} courseId Course ID the module belongs to. - * @param {boolean} [single] True if we're downloading a single module, false if we're downloading a whole section. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @return {Promise} Promise resolved when done. + * @param module Module. + * @param courseId Course ID the module belongs to. + * @param single True if we're downloading a single module, false if we're downloading a whole section. + * @param dirPath Path of the directory where to store all the content files. + * @return Promise resolved when done. */ prefetch(module: any, courseId?: number, single?: boolean, dirPath?: string): Promise { return this.prefetchPackage(module, courseId, false, this.downloadPrefetchPlugin.bind(this), undefined, true, dirPath); diff --git a/src/core/siteplugins/classes/handlers/question-behaviour-handler.ts b/src/core/siteplugins/classes/handlers/question-behaviour-handler.ts index 1b7a8372f..62ad964b9 100644 --- a/src/core/siteplugins/classes/handlers/question-behaviour-handler.ts +++ b/src/core/siteplugins/classes/handlers/question-behaviour-handler.ts @@ -31,10 +31,10 @@ export class CoreSitePluginsQuestionBehaviourHandler extends CoreQuestionBehavio * If the behaviour requires a submit button, it should add it to question.behaviourButtons. * If the behaviour requires to show some extra data, it should return the components to render it. * - * @param {Injector} injector Injector. - * @param {any} question The question. - * @return {any[]|Promise} Components (or promise resolved with components) to render some extra data in the question - * (e.g. certainty options). Don't return anything if no extra data is required. + * @param injector Injector. + * @param question The question. + * @return Components (or promise resolved with components) to render some extra data in the question + * (e.g. certainty options). Don't return anything if no extra data is required. */ handleQuestion(injector: Injector, question: any): any[] | Promise { if (this.hasTemplate) { diff --git a/src/core/siteplugins/classes/handlers/question-handler.ts b/src/core/siteplugins/classes/handlers/question-handler.ts index b0be9ed6a..51ce3885c 100644 --- a/src/core/siteplugins/classes/handlers/question-handler.ts +++ b/src/core/siteplugins/classes/handlers/question-handler.ts @@ -29,9 +29,9 @@ export class CoreSitePluginsQuestionHandler extends CoreQuestionBaseHandler { * Return the Component to use to display the question. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} question The question to render. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param question The question to render. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return CoreSitePluginsQuestionComponent; diff --git a/src/core/siteplugins/classes/handlers/quiz-access-rule-handler.ts b/src/core/siteplugins/classes/handlers/quiz-access-rule-handler.ts index 5ddf618f3..c72ba32ca 100644 --- a/src/core/siteplugins/classes/handlers/quiz-access-rule-handler.ts +++ b/src/core/siteplugins/classes/handlers/quiz-access-rule-handler.ts @@ -25,11 +25,11 @@ export class CoreSitePluginsQuizAccessRuleHandler { /** * Whether the rule requires a preflight check when prefetch/start/continue an attempt. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean|Promise} Whether the rule requires a preflight check. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Whether the rule requires a preflight check. */ isPreflightCheckRequired(quiz: any, attempt?: any, prefetch?: boolean, siteId?: string): boolean | Promise { return this.hasTemplate; @@ -38,12 +38,12 @@ export class CoreSitePluginsQuizAccessRuleHandler { /** * Add preflight data that doesn't require user interaction. The data should be added to the preflightData param. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} preflightData Object where to add the preflight data. - * @param {any} [attempt] The attempt started/continued. If not supplied, user is starting a new attempt. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} Promise resolved when done if async, void if it's synchronous. + * @param quiz The quiz the rule belongs to. + * @param preflightData Object where to add the preflight data. + * @param attempt The attempt started/continued. If not supplied, user is starting a new attempt. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done if async, void if it's synchronous. */ getFixedPreflightData(quiz: any, preflightData: any, attempt?: any, prefetch?: boolean, siteId?: string): void | Promise { // Nothing to do. @@ -54,8 +54,8 @@ export class CoreSitePluginsQuizAccessRuleHandler { * Implement this if your access rule requires a preflight check with user interaction. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getPreflightComponent(injector: Injector): any | Promise { if (this.hasTemplate) { @@ -66,12 +66,12 @@ export class CoreSitePluginsQuizAccessRuleHandler { /** * Function called when the preflight check has passed. This is a chance to record that fact in some way. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} attempt The attempt started/continued. - * @param {any} preflightData Preflight data gathered. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} Promise resolved when done if async, void if it's synchronous. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. + * @param preflightData Preflight data gathered. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done if async, void if it's synchronous. */ notifyPreflightCheckPassed(quiz: any, attempt: any, preflightData: any, prefetch?: boolean, siteId?: string) : void | Promise { @@ -81,12 +81,12 @@ export class CoreSitePluginsQuizAccessRuleHandler { /** * Function called when the preflight check fails. This is a chance to record that fact in some way. * - * @param {any} quiz The quiz the rule belongs to. - * @param {any} attempt The attempt started/continued. - * @param {any} preflightData Preflight data gathered. - * @param {boolean} [prefetch] Whether the user is prefetching the quiz. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {void|Promise} Promise resolved when done if async, void if it's synchronous. + * @param quiz The quiz the rule belongs to. + * @param attempt The attempt started/continued. + * @param preflightData Preflight data gathered. + * @param prefetch Whether the user is prefetching the quiz. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done if async, void if it's synchronous. */ notifyPreflightCheckFailed(quiz: any, attempt: any, preflightData: any, prefetch?: boolean, siteId?: string) : void | Promise { @@ -96,10 +96,10 @@ export class CoreSitePluginsQuizAccessRuleHandler { /** * Whether or not the time left of an attempt should be displayed. * - * @param {any} attempt The attempt. - * @param {number} endTime The attempt end time (in seconds). - * @param {number} timeNow The current time in seconds. - * @return {boolean} Whether it should be displayed. + * @param attempt The attempt. + * @param endTime The attempt end time (in seconds). + * @param timeNow The current time in seconds. + * @return Whether it should be displayed. */ shouldShowTimeLeft(attempt: any, endTime: number, timeNow: number): boolean { return false; diff --git a/src/core/siteplugins/classes/handlers/settings-handler.ts b/src/core/siteplugins/classes/handlers/settings-handler.ts index a90764c8b..ee788d317 100644 --- a/src/core/siteplugins/classes/handlers/settings-handler.ts +++ b/src/core/siteplugins/classes/handlers/settings-handler.ts @@ -31,7 +31,7 @@ export class CoreSitePluginsSettingsHandler extends CoreSitePluginsBaseHandler i /** * Returns the data needed to render the handler. * - * @return {CoreSettingsHandlerData} Data. + * @return Data. */ getDisplayData(): CoreSettingsHandlerData { return { diff --git a/src/core/siteplugins/classes/handlers/user-handler.ts b/src/core/siteplugins/classes/handlers/user-handler.ts index 5bd01b063..bb5b6bbf7 100644 --- a/src/core/siteplugins/classes/handlers/user-handler.ts +++ b/src/core/siteplugins/classes/handlers/user-handler.ts @@ -24,7 +24,6 @@ import { CoreUtilsProvider, PromiseDefer } from '@providers/utils/utils'; export class CoreSitePluginsUserProfileHandler extends CoreSitePluginsBaseHandler implements CoreUserProfileHandler { /** * The highest priority is displayed first. - * @type {number} */ priority: number; @@ -34,7 +33,6 @@ export class CoreSitePluginsUserProfileHandler extends CoreSitePluginsBaseHandle * - TYPE_NEW_PAGE: will be displayed as a list of items. Should have icon. Spinner not used. * Default value if none is specified. * - TYPE_ACTION: will be displayed as a button and should not redirect to any state. Spinner use is recommended. - * @type {string} */ type: string; @@ -54,11 +52,11 @@ export class CoreSitePluginsUserProfileHandler extends CoreSitePluginsBaseHandle /** * Whether or not the handler is enabled for a user. - * @param {any} user User object. - * @param {number} courseId Course ID where to show. - * @param {any} [navOptions] Navigation options for the course. - * @param {any} [admOptions] Admin options for the course. - * @return {boolean|Promise} Whether or not the handler is enabled for a user. + * @param user User object. + * @param courseId Course ID where to show. + * @param navOptions Navigation options for the course. + * @param admOptions Admin options for the course. + * @return Whether or not the handler is enabled for a user. */ isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise { // First check if it's enabled for the user. @@ -75,9 +73,9 @@ export class CoreSitePluginsUserProfileHandler extends CoreSitePluginsBaseHandle /** * Returns the data needed to render the handler. - * @param {any} user User object. - * @param {number} courseId Course ID where to show. - * @return {CoreUserProfileHandlerData} Data to be shown. + * @param user User object. + * @param courseId Course ID where to show. + * @return Data to be shown. */ getDisplayData(user: any, courseId: number): CoreUserProfileHandlerData { return { @@ -105,7 +103,7 @@ export class CoreSitePluginsUserProfileHandler extends CoreSitePluginsBaseHandle /** * Set init result. * - * @param {any} result Result to set. + * @param result Result to set. */ setInitResult(result: any): void { this.initResult = result; diff --git a/src/core/siteplugins/classes/handlers/user-profile-field-handler.ts b/src/core/siteplugins/classes/handlers/user-profile-field-handler.ts index bd7c1250a..0dfebb1c0 100644 --- a/src/core/siteplugins/classes/handlers/user-profile-field-handler.ts +++ b/src/core/siteplugins/classes/handlers/user-profile-field-handler.ts @@ -30,8 +30,8 @@ export class CoreSitePluginsUserProfileFieldHandler extends CoreSitePluginsBaseH * Return the Component to use to display the user profile field. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return CoreSitePluginsUserProfileFieldComponent; @@ -39,11 +39,11 @@ export class CoreSitePluginsUserProfileFieldHandler extends CoreSitePluginsBaseH /** * Get the data to send for the field based on the input data. - * @param {any} field User field to get the data for. - * @param {boolean} signup True if user is in signup page. - * @param {string} [registerAuth] Register auth method. E.g. 'email'. - * @param {any} formValues Form Values. - * @return {Promise|CoreUserProfileFieldHandlerData} Data to send for the field. + * @param field User field to get the data for. + * @param signup True if user is in signup page. + * @param registerAuth Register auth method. E.g. 'email'. + * @param formValues Form Values. + * @return Data to send for the field. */ getData(field: any, signup: boolean, registerAuth: string, formValues: any): Promise | CoreUserProfileFieldHandlerData { diff --git a/src/core/siteplugins/classes/handlers/workshop-assessment-strategy-handler.ts b/src/core/siteplugins/classes/handlers/workshop-assessment-strategy-handler.ts index c85da31db..e04c5b1b4 100644 --- a/src/core/siteplugins/classes/handlers/workshop-assessment-strategy-handler.ts +++ b/src/core/siteplugins/classes/handlers/workshop-assessment-strategy-handler.ts @@ -29,10 +29,10 @@ export class CoreSitePluginsWorkshopAssessmentStrategyHandler implements AddonWo * Return the Component to use to display the plugin data, either in read or in edit mode. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @param {any} plugin The plugin object. - * @param {boolean} [edit] Whether the user is editing. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @param plugin The plugin object. + * @param edit Whether the user is editing. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return CoreSitePluginsWorkshopAssessmentStrategyComponent; @@ -41,9 +41,9 @@ export class CoreSitePluginsWorkshopAssessmentStrategyHandler implements AddonWo /** * Prepare original values to be shown and compared. * - * @param {any} form Original data of the form. - * @param {number} workshopId WorkShop Id - * @return {Promise} Promise resolved with original values sorted. + * @param form Original data of the form. + * @param workshopId WorkShop Id + * @return Promise resolved with original values sorted. */ getOriginalValues(form: any, workshopId: number): Promise { return Promise.resolve([]); @@ -52,9 +52,9 @@ export class CoreSitePluginsWorkshopAssessmentStrategyHandler implements AddonWo /** * Check if the assessment data has changed for a certain submission and workshop for a this strategy plugin. * - * @param {any[]} originalValues Original values of the form. - * @param {any[]} currentValues Current values of the form. - * @return {boolean} True if data has changed, false otherwise. + * @param originalValues Original values of the form. + * @param currentValues Current values of the form. + * @return True if data has changed, false otherwise. */ hasDataChanged(originalValues: any[], currentValues: any[]): boolean { return false; @@ -62,7 +62,7 @@ export class CoreSitePluginsWorkshopAssessmentStrategyHandler implements AddonWo /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return true; @@ -71,9 +71,9 @@ export class CoreSitePluginsWorkshopAssessmentStrategyHandler implements AddonWo /** * Prepare assessment data to be sent to the server depending on the strategy selected. * - * @param {any{}} currentValues Current values of the form. - * @param {any} form Assessment form data. - * @return {Promise} Promise resolved with the data to be sent. Or rejected with the input errors object. + * @param currentValues Current values of the form. + * @param form Assessment form data. + * @return Promise resolved with the data to be sent. Or rejected with the input errors object. */ prepareAssessmentData(currentValues: any[], form: any): Promise { return Promise.resolve({}); diff --git a/src/core/siteplugins/components/assign-feedback/assign-feedback.ts b/src/core/siteplugins/components/assign-feedback/assign-feedback.ts index 4fc0fe2eb..e7e236261 100644 --- a/src/core/siteplugins/components/assign-feedback/assign-feedback.ts +++ b/src/core/siteplugins/components/assign-feedback/assign-feedback.ts @@ -60,7 +60,7 @@ export class CoreSitePluginsAssignFeedbackComponent extends CoreSitePluginsCompi /** * Invalidate the data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ invalidate(): Promise { return Promise.resolve(); diff --git a/src/core/siteplugins/components/assign-submission/assign-submission.ts b/src/core/siteplugins/components/assign-submission/assign-submission.ts index f034caf41..572d76158 100644 --- a/src/core/siteplugins/components/assign-submission/assign-submission.ts +++ b/src/core/siteplugins/components/assign-submission/assign-submission.ts @@ -58,7 +58,7 @@ export class CoreSitePluginsAssignSubmissionComponent extends CoreSitePluginsCom /** * Invalidate the data. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ invalidate(): Promise { return Promise.resolve(); diff --git a/src/core/siteplugins/components/course-format/course-format.ts b/src/core/siteplugins/components/course-format/course-format.ts index 3f4407c6e..76c21493b 100644 --- a/src/core/siteplugins/components/course-format/course-format.ts +++ b/src/core/siteplugins/components/course-format/course-format.ts @@ -88,10 +88,10 @@ export class CoreSitePluginsCourseFormatComponent implements OnChanges { /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @param {Function} [done] Function to call when done. - * @param {boolean} [afterCompletionChange] Whether the refresh is due to a completion change. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @param done Function to call when done. + * @param afterCompletionChange Whether the refresh is due to a completion change. + * @return Promise resolved when done. */ doRefresh(refresher?: any, done?: () => void, afterCompletionChange?: boolean): Promise { return Promise.resolve(this.content.refreshContent(afterCompletionChange)); diff --git a/src/core/siteplugins/components/course-option/course-option.ts b/src/core/siteplugins/components/course-option/course-option.ts index a92fb71a4..54d534c45 100644 --- a/src/core/siteplugins/components/course-option/course-option.ts +++ b/src/core/siteplugins/components/course-option/course-option.ts @@ -56,7 +56,7 @@ export class CoreSitePluginsCourseOptionComponent implements OnInit { /** * Refresh the data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshData(refresher: any): void { this.content.refreshContent(false).finally(() => { diff --git a/src/core/siteplugins/components/module-index/module-index.ts b/src/core/siteplugins/components/module-index/module-index.ts index 79be3063c..c5947c0ca 100644 --- a/src/core/siteplugins/components/module-index/module-index.ts +++ b/src/core/siteplugins/components/module-index/module-index.ts @@ -102,9 +102,9 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C /** * Refresh the data. * - * @param {any} [refresher] Refresher. - * @param {Function} [done] Function to call when done. - * @return {Promise} Promise resolved when done. + * @param refresher Refresher. + * @param done Function to call when done. + * @return Promise resolved when done. */ doRefresh(refresher?: any, done?: () => void): Promise { if (this.content) { @@ -173,9 +173,9 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C /** * Call a certain function on the component instance. * - * @param {string} name Name of the function to call. - * @param {any[]} params List of params to send to the function. - * @return {any} Result of the call. Undefined if no component instance or the function doesn't exist. + * @param name Name of the function to call. + * @param params List of params to send to the function. + * @return Result of the call. Undefined if no component instance or the function doesn't exist. */ callComponentFunction(name: string, params?: any[]): any { return this.content.callComponentFunction(name, params); diff --git a/src/core/siteplugins/components/plugin-content/plugin-content.ts b/src/core/siteplugins/components/plugin-content/plugin-content.ts index 4b6356844..ede995524 100644 --- a/src/core/siteplugins/components/plugin-content/plugin-content.ts +++ b/src/core/siteplugins/components/plugin-content/plugin-content.ts @@ -83,8 +83,8 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck { /** * Fetches the content to render. * - * @param {boolean} [refresh] Whether the user is refreshing. - * @return {Promise} Promise resolved when done. + * @param refresh Whether the user is refreshing. + * @return Promise resolved when done. */ fetchContent(refresh?: boolean): Promise { this.onLoadingContent.emit(refresh); @@ -116,13 +116,13 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck { /** * Open a new page with a new content. * - * @param {string} title The title to display with the new content. - * @param {any} args New params. - * @param {string} [component] New component. If not provided, current component - * @param {string} [method] New method. If not provided, current method - * @param {any} [jsData] JS variables to pass to the new view so they can be used in the template or JS. - * If true is supplied instead of an object, all initial variables from current page will be copied. - * @param {any} [preSets] The preSets for the WS call of the new content. + * @param title The title to display with the new content. + * @param args New params. + * @param component New component. If not provided, current component + * @param method New method. If not provided, current method + * @param jsData JS variables to pass to the new view so they can be used in the template or JS. + * If true is supplied instead of an object, all initial variables from current page will be copied. + * @param preSets The preSets for the WS call of the new content. */ openContent(title: string, args: any, component?: string, method?: string, jsData?: any, preSets?: any): void { if (jsData === true) { @@ -143,7 +143,7 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck { /** * Refresh the data. * - * @param {boolean} [showSpinner=true] Whether to show spinner while refreshing. + * @param showSpinner Whether to show spinner while refreshing. */ refreshContent(showSpinner: boolean = true): Promise { if (showSpinner) { @@ -160,10 +160,10 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck { /** * Update the content, usually with a different method or params. * - * @param {any} args New params. - * @param {string} [component] New component. If not provided, current component - * @param {string} [method] New method. If not provided, current method - * @param {string} [jsData] JS variables to pass to the new view so they can be used in the template or JS. + * @param args New params. + * @param component New component. If not provided, current component + * @param method New method. If not provided, current method + * @param jsData JS variables to pass to the new view so they can be used in the template or JS. */ updateContent(args: any, component?: string, method?: string, jsData?: any): void { this.component = component || this.component; @@ -180,9 +180,9 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck { /** * Call a certain function on the component instance. * - * @param {string} name Name of the function to call. - * @param {any[]} params List of params to send to the function. - * @return {any} Result of the call. Undefined if no component instance or the function doesn't exist. + * @param name Name of the function to call. + * @param params List of params to send to the function. + * @return Result of the call. Undefined if no component instance or the function doesn't exist. */ callComponentFunction(name: string, params?: any[]): any { if (this.compileComponent) { diff --git a/src/core/siteplugins/directives/call-ws-new-content.ts b/src/core/siteplugins/directives/call-ws-new-content.ts index a2d80d939..159085d6d 100644 --- a/src/core/siteplugins/directives/call-ws-new-content.ts +++ b/src/core/siteplugins/directives/call-ws-new-content.ts @@ -72,7 +72,7 @@ export class CoreSitePluginsCallWSNewContentDirective extends CoreSitePluginsCal /** * Function called when the WS call is successful. * - * @param {any} result Result of the WS call. + * @param result Result of the WS call. */ protected wsCallSuccess(result: any): void { let args = this.args || {}; diff --git a/src/core/siteplugins/directives/call-ws.ts b/src/core/siteplugins/directives/call-ws.ts index 9a0742ed2..4f5b65e69 100644 --- a/src/core/siteplugins/directives/call-ws.ts +++ b/src/core/siteplugins/directives/call-ws.ts @@ -63,7 +63,7 @@ export class CoreSitePluginsCallWSDirective extends CoreSitePluginsCallWSOnClick /** * Function called when the WS call is successful. * - * @param {any} result Result of the WS call. + * @param result Result of the WS call. */ protected wsCallSuccess(result: any): void { if (typeof this.successMessage != 'undefined') { diff --git a/src/core/siteplugins/pages/module-index/module-index.ts b/src/core/siteplugins/pages/module-index/module-index.ts index f5829666c..7203d804a 100644 --- a/src/core/siteplugins/pages/module-index/module-index.ts +++ b/src/core/siteplugins/pages/module-index/module-index.ts @@ -41,7 +41,7 @@ export class CoreSitePluginsModuleIndexPage { /** * Refresh the data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshData(refresher: any): void { this.content.doRefresh().finally(() => { @@ -87,7 +87,7 @@ export class CoreSitePluginsModuleIndexPage { /** * Check if we can leave the page or not. * - * @return {boolean|Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { return this.content.callComponentFunction('ionViewCanLeave'); diff --git a/src/core/siteplugins/pages/plugin-page/plugin-page.ts b/src/core/siteplugins/pages/plugin-page/plugin-page.ts index 4d3128918..9156aa30c 100644 --- a/src/core/siteplugins/pages/plugin-page/plugin-page.ts +++ b/src/core/siteplugins/pages/plugin-page/plugin-page.ts @@ -49,7 +49,7 @@ export class CoreSitePluginsPluginPage { /** * Refresh the data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshData(refresher: any): void { this.content.refreshContent(false).finally(() => { @@ -95,7 +95,7 @@ export class CoreSitePluginsPluginPage { /** * Check if we can leave the page or not. * - * @return {boolean|Promise} Resolved if we can leave it, rejected if not. + * @return Resolved if we can leave it, rejected if not. */ ionViewCanLeave(): boolean | Promise { return this.content.callComponentFunction('ionViewCanLeave'); diff --git a/src/core/siteplugins/providers/helper.ts b/src/core/siteplugins/providers/helper.ts index b6c33d0fc..4a0230413 100644 --- a/src/core/siteplugins/providers/helper.ts +++ b/src/core/siteplugins/providers/helper.ts @@ -140,11 +140,11 @@ export class CoreSitePluginsHelperProvider { /** * Download the styles for a handler (if any). * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @param {string} [siteId] Site ID. If not provided, current site. - * @return {Promise} Promise resolved with the CSS code. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @param siteId Site ID. If not provided, current site. + * @return Promise resolved with the CSS code. */ downloadStyles(plugin: any, handlerName: string, handlerSchema: any, siteId?: string): Promise { @@ -203,10 +203,10 @@ export class CoreSitePluginsHelperProvider { /** * Execute a handler's init method if it has any. * - * @param {any} plugin Data of the plugin. - * @param {any} handlerSchema Data about the handler. - * @return {Promise} Promise resolved when done. It returns the results of the getContent call and the data returned by - * the init JS (if any). + * @param plugin Data of the plugin. + * @param handlerSchema Data about the handler. + * @return Promise resolved when done. It returns the results of the getContent call and the data returned by + * the init JS (if any). */ protected executeHandlerInit(plugin: any, handlerSchema: any): Promise { if (!handlerSchema.init) { @@ -219,11 +219,11 @@ export class CoreSitePluginsHelperProvider { /** * Execute a get_content method and run its javascript (if any). * - * @param {any} plugin Data of the plugin. - * @param {string} method The method to call. - * @param {boolean} [isInit] Whether it's the init method. - * @return {Promise} Promise resolved when done. It returns the results of the getContent call and the data returned by - * the JS (if any). + * @param plugin Data of the plugin. + * @param method The method to call. + * @param isInit Whether it's the init method. + * @return Promise resolved when done. It returns the results of the getContent call and the data returned by + * the JS (if any). */ protected executeMethodAndJS(plugin: any, method: string, isInit?: boolean): Promise { const siteId = this.sitesProvider.getCurrentSiteId(), @@ -265,8 +265,8 @@ export class CoreSitePluginsHelperProvider { /** * Fetch site plugins. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when done. Returns the list of plugins to load. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when done. Returns the list of plugins to load. */ fetchSitePlugins(siteId?: string): Promise { const plugins = []; @@ -294,8 +294,8 @@ export class CoreSitePluginsHelperProvider { /** * Given an addon name, return the prefix to add to its string keys. * - * @param {string} addon Name of the addon (plugin.addon). - * @return {string} Prefix. + * @param addon Name of the addon (plugin.addon). + * @return Prefix. */ protected getPrefixForStrings(addon: string): string { if (addon) { @@ -308,9 +308,9 @@ export class CoreSitePluginsHelperProvider { /** * Given an addon name and the key of a string, return the full string key (prefixed). * - * @param {string} addon Name of the addon (plugin.addon). - * @param {string} key The key of the string. - * @return {string} Full string key. + * @param addon Name of the addon (plugin.addon). + * @param key The key of the string. + * @return Full string key. */ protected getPrefixedString(addon: string, key: string): string { return this.getPrefixForStrings(addon) + key; @@ -319,9 +319,9 @@ export class CoreSitePluginsHelperProvider { /** * Check if a certain plugin is a site plugin and it's enabled in a certain site. * - * @param {any} plugin Data of the plugin. - * @param {CoreSite} site Site affected. - * @return {boolean} Whether it's a site plugin and it's enabled. + * @param plugin Data of the plugin. + * @param site Site affected. + * @return Whether it's a site plugin and it's enabled. */ isSitePluginEnabled(plugin: any, site: CoreSite): boolean { if (!site.isFeatureDisabled('sitePlugin_' + plugin.component + '_' + plugin.addon) && plugin.handlers) { @@ -340,7 +340,7 @@ export class CoreSitePluginsHelperProvider { /** * Load the lang strings for a plugin. * - * @param {any} plugin Data of the plugin. + * @param plugin Data of the plugin. */ loadLangStrings(plugin: any): void { if (!plugin.parsedLang) { @@ -357,8 +357,8 @@ export class CoreSitePluginsHelperProvider { /** * Load a site plugin. * - * @param {any} plugin Data of the plugin. - * @return {Promise} Promise resolved when loaded. + * @param plugin Data of the plugin. + * @return Promise resolved when loaded. */ loadSitePlugin(plugin: any): Promise { const promises = []; @@ -390,8 +390,8 @@ export class CoreSitePluginsHelperProvider { /** * Load site plugins. * - * @param {any[]} plugins The plugins to load. - * @return {Promise} Promise resolved when loaded. + * @param plugins The plugins to load. + * @return Promise resolved when loaded. */ loadSitePlugins(plugins: any[]): Promise { const promises = []; @@ -409,12 +409,12 @@ export class CoreSitePluginsHelperProvider { /** * Load the styles for a handler. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {string} fileUrl CSS file URL. - * @param {string} cssCode CSS code. - * @param {number} [version] Styles version. - * @param {string} [siteId] Site ID. If not provided, current site. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param fileUrl CSS file URL. + * @param cssCode CSS code. + * @param version Styles version. + * @param siteId Site ID. If not provided, current site. */ loadStyles(plugin: any, handlerName: string, fileUrl: string, cssCode: string, version?: number, siteId?: string): void { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -438,10 +438,10 @@ export class CoreSitePluginsHelperProvider { /** * Register a site plugin handler in the right delegate. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @return {Promise} Promise resolved when done. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @return Promise resolved when done. */ registerHandler(plugin: any, handlerName: string, handlerSchema: any): Promise { @@ -563,10 +563,10 @@ export class CoreSitePluginsHelperProvider { * These type of handlers will return a generic template and its JS in the main method, so it will be called * before registering the handler. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @return {string|Promise} A string (or a promise resolved with a string) to identify the handler. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @return A string (or a promise resolved with a string) to identify the handler. */ protected registerComponentInitHandler(plugin: any, handlerName: string, handlerSchema: any, delegate: any, createHandlerFn: (uniqueName: string, result: any) => any): string | Promise { @@ -613,10 +613,10 @@ export class CoreSitePluginsHelperProvider { /** * Given a handler in a plugin, register it in the assign feedback delegate. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @return {string|Promise} A string (or a promise resolved with a string) to identify the handler. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @return A string (or a promise resolved with a string) to identify the handler. */ protected registerAssignFeedbackHandler(plugin: any, handlerName: string, handlerSchema: any): string | Promise { @@ -633,10 +633,10 @@ export class CoreSitePluginsHelperProvider { /** * Given a handler in a plugin, register it in the assign submission delegate. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @return {string|Promise} A string (or a promise resolved with a string) to identify the handler. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @return A string (or a promise resolved with a string) to identify the handler. */ protected registerAssignSubmissionHandler(plugin: any, handlerName: string, handlerSchema: any): string | Promise { @@ -653,11 +653,11 @@ export class CoreSitePluginsHelperProvider { /** * Given a handler in a plugin, register it in the block delegate. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @param {any} initResult Result of init function. - * @return {string|Promise} A string (or a promise resolved with a string) to identify the handler. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @param initResult Result of init function. + * @return A string (or a promise resolved with a string) to identify the handler. */ protected registerBlockHandler(plugin: any, handlerName: string, handlerSchema: any, initResult: any): string | Promise { @@ -675,10 +675,10 @@ export class CoreSitePluginsHelperProvider { /** * Given a handler in a plugin, register it in the course format delegate. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @return {string} A string to identify the handler. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @return A string to identify the handler. */ protected registerCourseFormatHandler(plugin: any, handlerName: string, handlerSchema: any): string { this.logger.debug('Register site plugin in course format delegate:', plugin, handlerSchema); @@ -694,11 +694,11 @@ export class CoreSitePluginsHelperProvider { /** * Given a handler in a plugin, register it in the course options delegate. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @param {any} initResult Result of the init WS call. - * @return {string} A string to identify the handler. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @param initResult Result of the init WS call. + * @return A string to identify the handler. */ protected registerCourseOptionHandler(plugin: any, handlerName: string, handlerSchema: any, initResult: any): string { if (!handlerSchema.displaydata) { @@ -734,11 +734,11 @@ export class CoreSitePluginsHelperProvider { /** * Given a handler in a plugin, register it in the main menu delegate. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @param {any} initResult Result of the init WS call. - * @return {string} A string to identify the handler. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @param initResult Result of the init WS call. + * @return A string to identify the handler. */ protected registerMainMenuHandler(plugin: any, handlerName: string, handlerSchema: any, initResult: any): string { if (!handlerSchema.displaydata) { @@ -763,11 +763,11 @@ export class CoreSitePluginsHelperProvider { /** * Given a handler in a plugin, register it in the message output delegate. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @param {any} initResult Result of the init WS call. - * @return {string} A string to identify the handler. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @param initResult Result of the init WS call. + * @return A string to identify the handler. */ protected registerMessageOutputHandler(plugin: any, handlerName: string, handlerSchema: any, initResult: any): string { if (!handlerSchema.displaydata) { @@ -793,11 +793,11 @@ export class CoreSitePluginsHelperProvider { /** * Given a handler in a plugin, register it in the module delegate. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @param {any} initResult Result of the init WS call. - * @return {string} A string to identify the handler. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @param initResult Result of the init WS call. + * @return A string to identify the handler. */ protected registerModuleHandler(plugin: any, handlerName: string, handlerSchema: any, initResult: any): string { if (!handlerSchema.displaydata) { @@ -828,10 +828,10 @@ export class CoreSitePluginsHelperProvider { /** * Given a handler in a plugin, register it in the question delegate. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @return {string|Promise} A string (or a promise resolved with a string) to identify the handler. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @return A string (or a promise resolved with a string) to identify the handler. */ protected registerQuestionHandler(plugin: any, handlerName: string, handlerSchema: any): string | Promise { @@ -845,10 +845,10 @@ export class CoreSitePluginsHelperProvider { /** * Given a handler in a plugin, register it in the question behaviour delegate. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @return {string|Promise} A string (or a promise resolved with a string) to identify the handler. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @return A string (or a promise resolved with a string) to identify the handler. */ protected registerQuestionBehaviourHandler(plugin: any, handlerName: string, handlerSchema: any): string | Promise { @@ -864,10 +864,10 @@ export class CoreSitePluginsHelperProvider { /** * Given a handler in a plugin, register it in the quiz access rule delegate. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @return {string|Promise} A string (or a promise resolved with a string) to identify the handler. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @return A string (or a promise resolved with a string) to identify the handler. */ protected registerQuizAccessRuleHandler(plugin: any, handlerName: string, handlerSchema: any): string | Promise { @@ -882,11 +882,11 @@ export class CoreSitePluginsHelperProvider { /** * Given a handler in a plugin, register it in the settings delegate. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @param {any} initResult Result of the init WS call. - * @return {string} A string to identify the handler. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @param initResult Result of the init WS call. + * @return A string to identify the handler. */ protected registerSettingsHandler(plugin: any, handlerName: string, handlerSchema: any, initResult: any): string { if (!handlerSchema.displaydata) { @@ -911,11 +911,11 @@ export class CoreSitePluginsHelperProvider { /** * Given a handler in a plugin, register it in the user profile delegate. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @param {any} initResult Result of the init WS call. - * @return {string} A string to identify the handler. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @param initResult Result of the init WS call. + * @return A string to identify the handler. */ protected registerUserProfileHandler(plugin: any, handlerName: string, handlerSchema: any, initResult: any): string { if (!handlerSchema.displaydata) { @@ -951,10 +951,10 @@ export class CoreSitePluginsHelperProvider { /** * Given a handler in a plugin, register it in the user profile field delegate. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @return {string|Promise} A string (or a promise resolved with a string) to identify the handler. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @return A string (or a promise resolved with a string) to identify the handler. */ protected registerUserProfileFieldHandler(plugin: any, handlerName: string, handlerSchema: any): string | Promise { @@ -970,10 +970,10 @@ export class CoreSitePluginsHelperProvider { /** * Given a handler in a plugin, register it in the workshop assessment strategy delegate. * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler in the plugin. - * @param {any} handlerSchema Data about the handler. - * @return {string|Promise} A string (or a promise resolved with a string) to identify the handler. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler in the plugin. + * @param handlerSchema Data about the handler. + * @return A string (or a promise resolved with a string) to identify the handler. */ protected registerWorkshopAssessmentStrategyHandler(plugin: any, handlerName: string, handlerSchema: any) : string | Promise { @@ -990,7 +990,7 @@ export class CoreSitePluginsHelperProvider { /** * Reload the handlers that are restricted to certain courses. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected reloadCourseRestrictHandlers(): Promise { if (!Object.keys(this.courseRestrictHandlers).length) { diff --git a/src/core/siteplugins/providers/siteplugins.ts b/src/core/siteplugins/providers/siteplugins.ts index fe20b3115..0ba03045d 100644 --- a/src/core/siteplugins/providers/siteplugins.ts +++ b/src/core/siteplugins/providers/siteplugins.ts @@ -32,25 +32,21 @@ import { CoreEventsProvider } from '@providers/events'; export interface CoreSitePluginsHandler { /** * The site plugin data. - * @type {any} */ plugin: any; /** * Name of the handler. - * @type {string} */ handlerName: string; /** * Data of the handler. - * @type {any} */ handlerSchema: any; /** * Result of the init WS call. - * @type {any} */ initResult?: any; } @@ -92,9 +88,9 @@ export class CoreSitePluginsProvider { /** * Add some params that will always be sent for get content. * - * @param {any} args Original params. - * @param {CoreSite} [site] Site. If not defined, current site. - * @return {Promise} Promise resolved with the new params. + * @param args Original params. + * @param site Site. If not defined, current site. + * @return Promise resolved with the new params. */ protected addDefaultArgs(args: any, site?: CoreSite): Promise { args = args || {}; @@ -140,11 +136,11 @@ export class CoreSitePluginsProvider { /** * Call a WS for a site plugin. * - * @param {string} method WS method to use. - * @param {any} data Data to send to the WS. - * @param {CoreSiteWSPreSets} [preSets] Extra options. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the response. + * @param method WS method to use. + * @param data Data to send to the WS. + * @param preSets Extra options. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the response. */ callWS(method: string, data: any, preSets?: CoreSiteWSPreSets, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -159,9 +155,9 @@ export class CoreSitePluginsProvider { * Given the result of a init get_content and, optionally, the result of another get_content, * build an object with the data to pass to the JS of the get_content. * - * @param {any} initResult Result of the init WS call. - * @param {any} [contentResult] Result of the content WS call (if any). - * @return {any} An object with the data to pass to the JS. + * @param initResult Result of the init WS call. + * @param contentResult Result of the content WS call (if any). + * @return An object with the data to pass to the JS. */ createDataForJS(initResult: any, contentResult?: any): any { let data; @@ -190,9 +186,9 @@ export class CoreSitePluginsProvider { /** * Get cache key for a WS call. * - * @param {string} method Name of the method. - * @param {any} data Data to identify the WS call. - * @return {string} Cache key. + * @param method Name of the method. + * @param data Data to identify the WS call. + * @return Cache key. */ getCallWSCacheKey(method: string, data: any): string { return this.getCallWSCommonCacheKey(method) + ':' + this.utils.sortAndStringify(data); @@ -201,8 +197,8 @@ export class CoreSitePluginsProvider { /** * Get common cache key for a WS call. * - * @param {string} method Name of the method. - * @return {string} Cache key. + * @param method Name of the method. + * @return Cache key. */ protected getCallWSCommonCacheKey(method: string): string { return this.ROOT_CACHE_KEY + 'ws:' + method; @@ -211,12 +207,12 @@ export class CoreSitePluginsProvider { /** * Get a certain content for a site plugin. * - * @param {string} component Component where the class is. E.g. mod_assign. - * @param {string} method Method to execute in the class. - * @param {any} args The params for the method. - * @param {CoreSiteWSPreSets} [preSets] Extra options. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the result. + * @param component Component where the class is. E.g. mod_assign. + * @param method Method to execute in the class. + * @param args The params for the method. + * @param preSets Extra options. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the result. */ getContent(component: string, method: string, args: any, preSets?: CoreSiteWSPreSets, siteId?: string): Promise { this.logger.debug(`Get content for component '${component}' and method '${method}'`); @@ -262,10 +258,10 @@ export class CoreSitePluginsProvider { /** * Get cache key for get content WS calls. * - * @param {string} component Component where the class is. E.g. mod_assign. - * @param {string} method Method to execute in the class. - * @param {any} args The params for the method. - * @return {string} Cache key. + * @param component Component where the class is. E.g. mod_assign. + * @param method Method to execute in the class. + * @param args The params for the method. + * @return Cache key. */ protected getContentCacheKey(component: string, method: string, args: any): string { return this.ROOT_CACHE_KEY + 'content:' + component + ':' + method + ':' + this.utils.sortAndStringify(args); @@ -274,11 +270,11 @@ export class CoreSitePluginsProvider { /** * Get the value of a WS param for prefetch. * - * @param {string} component The component of the handler. - * @param {string} paramName Name of the param as defined by the handler. - * @param {number} [courseId] Course ID (if prefetching a course). - * @param {any} [module] The module object returned by WS (if prefetching a module). - * @return {any} The value. + * @param component The component of the handler. + * @param paramName Name of the param as defined by the handler. + * @param courseId Course ID (if prefetching a course). + * @param module The module object returned by WS (if prefetching a module). + * @return The value. */ protected getDownloadParam(component: string, paramName: string, courseId?: number, module?: any): any { switch (paramName) { @@ -298,9 +294,9 @@ export class CoreSitePluginsProvider { /** * Get the unique name of a handler (plugin + handler). * - * @param {any} plugin Data of the plugin. - * @param {string} handlerName Name of the handler inside the plugin. - * @return {string} Unique name. + * @param plugin Data of the plugin. + * @param handlerName Name of the handler inside the plugin. + * @return Unique name. */ getHandlerUniqueName(plugin: any, handlerName: string): string { return plugin.addon + '_' + handlerName; @@ -309,8 +305,8 @@ export class CoreSitePluginsProvider { /** * Get a site plugin handler. * - * @param {string} name Unique name of the handler. - * @return {CoreSitePluginsHandler} Handler. + * @param name Unique name of the handler. + * @return Handler. */ getSitePluginHandler(name: string): CoreSitePluginsHandler { return this.sitePlugins[name]; @@ -319,9 +315,9 @@ export class CoreSitePluginsProvider { /** * Invalidate all WS call to a certain method. * - * @param {string} method WS method to use. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param method WS method to use. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAllCallWSForMethod(method: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -332,11 +328,11 @@ export class CoreSitePluginsProvider { /** * Invalidate a WS call. * - * @param {string} method WS method to use. - * @param {any} data Data to send to the WS. - * @param {CoreSiteWSPreSets} [preSets] Extra options. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param method WS method to use. + * @param data Data to send to the WS. + * @param preSets Extra options. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateCallWS(method: string, data: any, preSets?: CoreSiteWSPreSets, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -347,11 +343,11 @@ export class CoreSitePluginsProvider { /** * Invalidate a page content. * - * @param {string} component Component where the class is. E.g. mod_assign. - * @param {string} method Method to execute in the class. - * @param {any} args The params for the method. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param component Component where the class is. E.g. mod_assign. + * @param method Method to execute in the class. + * @param args The params for the method. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateContent(component: string, callback: string, args: any, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -362,7 +358,7 @@ export class CoreSitePluginsProvider { /** * Check if the get content WS is available. * - * @param {CoreSite} site The site to check. If not defined, current site. + * @param site The site to check. If not defined, current site. */ isGetContentAvailable(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -373,10 +369,10 @@ export class CoreSitePluginsProvider { /** * Check if a handler is enabled for a certain course. * - * @param {number} courseId Course ID to check. - * @param {boolean} [restrictEnrolled] If true or undefined, handler is only enabled for courses the user is enrolled in. - * @param {any} [restrict] Users and courses the handler is restricted to. - * @return {boolean | Promise} Whether the handler is enabled. + * @param courseId Course ID to check. + * @param restrictEnrolled If true or undefined, handler is only enabled for courses the user is enrolled in. + * @param restrict Users and courses the handler is restricted to. + * @return Whether the handler is enabled. */ isHandlerEnabledForCourse(courseId: number, restrictEnrolled?: boolean, restrict?: any): boolean | Promise { if (restrict && restrict.courses && restrict.courses.indexOf(courseId) == -1) { @@ -399,10 +395,10 @@ export class CoreSitePluginsProvider { /** * Check if a handler is enabled for a certain user. * - * @param {number} userId User ID to check. - * @param {boolean} [restrictCurrent] Whether handler is only enabled for current user. - * @param {any} [restrict] Users and courses the handler is restricted to. - * @return {boolean} Whether the handler is enabled. + * @param userId User ID to check. + * @param restrictCurrent Whether handler is only enabled for current user. + * @param restrict Users and courses the handler is restricted to. + * @return Whether the handler is enabled. */ isHandlerEnabledForUser(userId: number, restrictCurrent?: boolean, restrict?: any): boolean { if (restrictCurrent && userId != this.sitesProvider.getCurrentSite().getUserId()) { @@ -424,10 +420,10 @@ export class CoreSitePluginsProvider { * If useOtherData is an array, it will only copy the properties whose names are in the array. * If useOtherData is any other value, it will copy all the data from otherData to args. * - * @param {any} args The current args. - * @param {any} otherData All the other data. - * @param {any} useOtherData Names of the attributes to include. - * @return {any} New args. + * @param args The current args. + * @param otherData All the other data. + * @param useOtherData Names of the attributes to include. + * @return New args. */ loadOtherDataInArgs(args: any, otherData: any, useOtherData: any): any { if (!args) { @@ -471,15 +467,15 @@ export class CoreSitePluginsProvider { /** * Prefetch offline functions for a site plugin handler. * - * @param {string} component The component of the handler. - * @param {any} args Params to send to the get_content calls. - * @param {any} handlerSchema The handler schema. - * @param {number} [courseId] Course ID (if prefetching a course). - * @param {any} [module] The module object returned by WS (if prefetching a module). - * @param {boolean} [prefetch] True to prefetch, false to download right away. - * @param {string} [dirPath] Path of the directory where to store all the content files. - * @param {CoreSite} [site] Site. If not defined, current site. - * @return {Promise} Promise resolved when done. + * @param component The component of the handler. + * @param args Params to send to the get_content calls. + * @param handlerSchema The handler schema. + * @param courseId Course ID (if prefetching a course). + * @param module The module object returned by WS (if prefetching a module). + * @param prefetch True to prefetch, false to download right away. + * @param dirPath Path of the directory where to store all the content files. + * @param site Site. If not defined, current site. + * @return Promise resolved when done. */ prefetchFunctions(component: string, args: any, handlerSchema: any, courseId?: number, module?: any, prefetch?: boolean, dirPath?: string, site?: CoreSite): Promise { @@ -536,8 +532,8 @@ export class CoreSitePluginsProvider { /** * Store a site plugin handler. * - * @param {string} name A unique name to identify the handler. - * @param {CoreSitePluginsHandler} handler Handler to set. + * @param name A unique name to identify the handler. + * @param handler Handler to set. */ setSitePluginHandler(name: string, handler: CoreSitePluginsHandler): void { this.sitePlugins[name] = handler; @@ -546,8 +542,8 @@ export class CoreSitePluginsProvider { /** * Store the promise for a plugin that is being initialised. * - * @param {String} component - * @param {Promise} promise + * @param component + * @param promise */ registerSitePluginPromise(component: string, promise: Promise): void { this.sitePluginPromises[component] = promise; @@ -563,8 +559,7 @@ export class CoreSitePluginsProvider { /** * Is a plugin being initialised for the specified component? * - * @param {String} component - * @return {boolean} + * @param component */ sitePluginPromiseExists(component: string): boolean { return this.sitePluginPromises.hasOwnProperty(component); @@ -573,8 +568,7 @@ export class CoreSitePluginsProvider { /** * Get the promise for a plugin that is being initialised. * - * @param {String} component - * @return {Promise} + * @param component */ sitePluginLoaded(component: string): Promise { return this.sitePluginPromises[component]; @@ -583,7 +577,7 @@ export class CoreSitePluginsProvider { /** * Wait for fetch plugins to be done. * - * @return {Promise} Promise resolved when site plugins have been fetched. + * @return Promise resolved when site plugins have been fetched. */ waitFetchPlugins(): Promise { return this.fetchPluginsDeferred.promise; diff --git a/src/core/tag/pages/index-area/index-area.ts b/src/core/tag/pages/index-area/index-area.ts index 9f71f0532..a5e76402f 100644 --- a/src/core/tag/pages/index-area/index-area.ts +++ b/src/core/tag/pages/index-area/index-area.ts @@ -88,8 +88,8 @@ export class CoreTagIndexAreaPage { /** * Fetch next page of the tag index area. * - * @param {boolean} [refresh=false] Whether to refresh the data or fetch a new page. - * @return {Promise} Resolved when done. + * @param refresh Whether to refresh the data or fetch a new page. + * @return Resolved when done. */ fetchData(refresh: boolean = false): Promise { this.loadMoreError = false; @@ -125,8 +125,8 @@ export class CoreTagIndexAreaPage { /** * Load more items. * - * @param {any} infiniteComplete Infinite scroll complete function. - * @return {Promise} Resolved when done. + * @param infiniteComplete Infinite scroll complete function. + * @return Resolved when done. */ loadMore(infiniteComplete: any): Promise { return this.fetchData().finally(() => { @@ -137,7 +137,7 @@ export class CoreTagIndexAreaPage { /** * Refresh data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshData(refresher: any): void { this.tagProvider.invalidateTagIndexPerArea(this.tagId, this.tagName, this.collectionId, this.areaId, this.fromContextId, diff --git a/src/core/tag/pages/index/index.ts b/src/core/tag/pages/index/index.ts index 9185bae0f..ed9fbe805 100644 --- a/src/core/tag/pages/index/index.ts +++ b/src/core/tag/pages/index/index.ts @@ -78,7 +78,7 @@ export class CoreTagIndexPage { /** * Fetch first page of tag index per area. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ fetchData(): Promise { return this.tagProvider.getTagIndexPerArea(this.tagId, this.tagName, this.collectionId, this.areaId, this.fromContextId, @@ -116,7 +116,7 @@ export class CoreTagIndexPage { /** * Refresh data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshData(refresher: any): void { this.tagProvider.invalidateTagIndexPerArea(this.tagId, this.tagName, this.collectionId, this.areaId, this.fromContextId, @@ -130,7 +130,7 @@ export class CoreTagIndexPage { /** * Navigate to an index area. * - * @param {any} area Area. + * @param area Area. */ openArea(area: any): void { this.selectedAreaId = area.id; diff --git a/src/core/tag/pages/search/search.ts b/src/core/tag/pages/search/search.ts index 13f09bb4c..c79edfa28 100644 --- a/src/core/tag/pages/search/search.ts +++ b/src/core/tag/pages/search/search.ts @@ -67,7 +67,7 @@ export class CoreTagSearchPage { /** * Fetch tag collections. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ fetchCollections(): Promise { return this.tagProvider.getTagCollections().then((collections) => { @@ -83,7 +83,7 @@ export class CoreTagSearchPage { /** * Fetch tags. * - * @return {Promise} Resolved when done. + * @return Resolved when done. */ fetchTags(): Promise { return this.tagProvider.getTagCloud(this.collectionId, undefined, undefined, this.query).then((cloud) => { @@ -102,7 +102,7 @@ export class CoreTagSearchPage { /** * Refresh data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshData(refresher: any): void { this.utils.allPromises([ @@ -118,8 +118,8 @@ export class CoreTagSearchPage { /** * Search tags. * - * @param {string} query Search query. - * @return {Promise} Resolved when done. + * @param query Search query. + * @return Resolved when done. */ searchTags(query: string): Promise { this.searching = true; diff --git a/src/core/tag/providers/area-delegate.ts b/src/core/tag/providers/area-delegate.ts index 2b0e2ffb8..ac1693ec1 100644 --- a/src/core/tag/providers/area-delegate.ts +++ b/src/core/tag/providers/area-delegate.ts @@ -24,23 +24,22 @@ import { CoreDelegate, CoreDelegateHandler } from '@classes/delegate'; export interface CoreTagAreaHandler extends CoreDelegateHandler { /** * Component and item type separated by a slash. E.g. 'core/course_modules'. - * @type {string} */ type: string; /** * Parses the rendered content of a tag index and returns the items. * - * @param {string} content Rendered content. - * @return {any[]|Promise} Area items (or promise resolved with the items). + * @param content Rendered content. + * @return Area items (or promise resolved with the items). */ parseContent(content: string): any[] | Promise; /** * Get the component to use to display items. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise; } @@ -60,9 +59,9 @@ export class CoreTagAreaDelegate extends CoreDelegate { /** * Returns the display name string for this area. * - * @param {string} component Component name. - * @param {string} itemType Item type. - * @return {string} String key. + * @param component Component name. + * @param itemType Item type. + * @return String key. */ getDisplayNameKey(component: string, itemType: string): string { return (component == 'core' ? 'core.tag' : 'addon.' + component) + '.tagarea_' + itemType; @@ -71,10 +70,10 @@ export class CoreTagAreaDelegate extends CoreDelegate { /** * Parses the rendered content of a tag index and returns the items. * - * @param {string} component Component name. - * @param {string} itemType Item type. - * @param {string} content Rendered content. - * @return {Promise} Promise resolved with the area items, or undefined if not found. + * @param component Component name. + * @param itemType Item type. + * @param content Rendered content. + * @return Promise resolved with the area items, or undefined if not found. */ parseContent(component: string, itemType: string, content: string): Promise { const type = component + '/' + itemType; @@ -85,10 +84,10 @@ export class CoreTagAreaDelegate extends CoreDelegate { /** * Get the component to use to display an area item. * - * @param {string} component Component name. - * @param {string} itemType Item type. - * @param {Injector} injector Injector. - * @return {Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param component Component name. + * @param itemType Item type. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(component: string, itemType: string, injector: Injector): Promise { const type = component + '/' + itemType; diff --git a/src/core/tag/providers/helper.ts b/src/core/tag/providers/helper.ts index 38c097b79..f62cac0ec 100644 --- a/src/core/tag/providers/helper.ts +++ b/src/core/tag/providers/helper.ts @@ -26,8 +26,8 @@ export class CoreTagHelperProvider { /** * Parses the rendered content of the "core_tag/tagfeed" web template and returns the items. * - * @param {string} content Rendered content. - * @return {any[]} Area items. + * @param content Rendered content. + * @return Area items. */ parseFeedContent(content: string): any[] { const items = []; diff --git a/src/core/tag/providers/index-link-handler.ts b/src/core/tag/providers/index-link-handler.ts index c8e1d7c49..e94bca812 100644 --- a/src/core/tag/providers/index-link-handler.ts +++ b/src/core/tag/providers/index-link-handler.ts @@ -33,12 +33,12 @@ export class CoreTagIndexLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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 {any} [data] Extra data to handle the URL. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @param data Extra data to handle the URL. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number, data?: any): CoreContentLinksAction[] | Promise { @@ -69,11 +69,11 @@ export class CoreTagIndexLinkHandler extends CoreContentLinksHandlerBase { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return this.tagProvider.areTagsAvailable(siteId); diff --git a/src/core/tag/providers/mainmenu-handler.ts b/src/core/tag/providers/mainmenu-handler.ts index 8e676acc1..60f7b1e8c 100644 --- a/src/core/tag/providers/mainmenu-handler.ts +++ b/src/core/tag/providers/mainmenu-handler.ts @@ -30,7 +30,7 @@ export class CoreTagMainMenuHandler implements CoreMainMenuHandler { /** * Check if the handler is enabled on a site level. * - * @return {boolean | Promise} 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 { return this.tagProvider.areTagsAvailable().then((available) => { @@ -46,7 +46,7 @@ export class CoreTagMainMenuHandler implements CoreMainMenuHandler { /** * 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 { return { diff --git a/src/core/tag/providers/search-link-handler.ts b/src/core/tag/providers/search-link-handler.ts index 68ea7cb96..e0b16f7df 100644 --- a/src/core/tag/providers/search-link-handler.ts +++ b/src/core/tag/providers/search-link-handler.ts @@ -33,12 +33,12 @@ export class CoreTagSearchLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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 {any} [data] Extra data to handle the URL. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @param data Extra data to handle the URL. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number, data?: any): CoreContentLinksAction[] | Promise { @@ -58,11 +58,11 @@ export class CoreTagSearchLinkHandler extends CoreContentLinksHandlerBase { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return this.tagProvider.areTagsAvailable(siteId); diff --git a/src/core/tag/providers/tag.ts b/src/core/tag/providers/tag.ts index 3a377cba9..4b012d32f 100644 --- a/src/core/tag/providers/tag.ts +++ b/src/core/tag/providers/tag.ts @@ -100,8 +100,8 @@ export class CoreTagProvider { /** * Check whether tags are available in a certain site. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if available, resolved with false otherwise. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if available, resolved with false otherwise. * @since 3.7 */ areTagsAvailable(siteId?: string): Promise { @@ -113,8 +113,8 @@ export class CoreTagProvider { /** * Check whether tags are available in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} True if available. + * @param site Site. If not defined, use current site. + * @return True if available. */ areTagsAvailableInSite(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -128,16 +128,16 @@ export class CoreTagProvider { /** * Fetch the tag cloud. * - * @param {number} [collectionId=0] Tag collection ID. - * @param {boolean} [isStandard=false] Whether to return only standard tags. - * @param {string} [sort='name'] Sort order for display (id, name, rawname, count, flag, isstandard, tagcollid). - * @param {string} [search=''] Search string. - * @param {number} [fromContextId=0] Context ID where this tag cloud is displayed. - * @param {number} [contextId=0] Only retrieve tag instances in this context. - * @param {boolean} [recursive=true] Retrieve tag instances in the context and its children. - * @param {number} [limit] Maximum number of tags to retrieve. Defaults to SEARCH_LIMIT. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the tag cloud. + * @param collectionId Tag collection ID. + * @param isStandard Whether to return only standard tags. + * @param sort Sort order for display (id, name, rawname, count, flag, isstandard, tagcollid). + * @param search Search string. + * @param fromContextId Context ID where this tag cloud is displayed. + * @param contextId Only retrieve tag instances in this context. + * @param recursive Retrieve tag instances in the context and its children. + * @param limit Maximum number of tags to retrieve. Defaults to SEARCH_LIMIT. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the tag cloud. * @since 3.7 */ getTagCloud(collectionId: number = 0, isStandard: boolean = false, sort: string = 'name', search: string = '', @@ -169,8 +169,8 @@ export class CoreTagProvider { /** * Fetch the tag collections. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the tag collections. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the tag collections. * @since 3.7 */ getTagCollections(siteId?: string): Promise { @@ -193,16 +193,16 @@ export class CoreTagProvider { /** * Fetch the tag index. * - * @param {number} [id=0] Tag ID. - * @param {string} [name=''] Tag name. - * @param {number} [collectionId=0] Tag collection ID. - * @param {number} [areaId=0] Tag area ID. - * @param {number} [fromContextId=0] Context ID where the link was displayed. - * @param {number} [contextId=0] Context ID where to search for items. - * @param {boolean} [recursive=true] Search in the context and its children. - * @param {number} [page=0] Page number. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with the tag index per area. + * @param id Tag ID. + * @param name Tag name. + * @param collectionId Tag collection ID. + * @param areaId Tag area ID. + * @param fromContextId Context ID where the link was displayed. + * @param contextId Context ID where to search for items. + * @param recursive Search in the context and its children. + * @param page Page number. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with the tag index per area. * @since 3.7 */ getTagIndexPerArea(id: number, name: string = '', collectionId: number = 0, areaId: number = 0, fromContextId: number = 0, @@ -246,14 +246,14 @@ export class CoreTagProvider { /** * Invalidate tag cloud. * - * @param {number} [collectionId=0] Tag collection ID. - * @param {boolean} [isStandard=false] Whether to return only standard tags. - * @param {string} [sort='name'] Sort order for display (id, name, rawname, count, flag, isstandard, tagcollid). - * @param {string} [search=''] Search string. - * @param {number} [fromContextId=0] Context ID where this tag cloud is displayed. - * @param {number} [contextId=0] Only retrieve tag instances in this context. - * @param {boolean} [recursive=true] Retrieve tag instances in the context and its children. - * @return {Promise} Promise resolved when the data is invalidated. + * @param collectionId Tag collection ID. + * @param isStandard Whether to return only standard tags. + * @param sort Sort order for display (id, name, rawname, count, flag, isstandard, tagcollid). + * @param search Search string. + * @param fromContextId Context ID where this tag cloud is displayed. + * @param contextId Only retrieve tag instances in this context. + * @param recursive Retrieve tag instances in the context and its children. + * @return Promise resolved when the data is invalidated. */ invalidateTagCloud(collectionId: number = 0, isStandard: boolean = false, sort: string = 'name', search: string = '', fromContextId: number = 0, contextId: number = 0, recursive: boolean = true, siteId?: string): Promise { @@ -267,7 +267,7 @@ export class CoreTagProvider { /** * Invalidate tag collections. * - * @return {Promise} Promise resolved when the data is invalidated. + * @return Promise resolved when the data is invalidated. */ invalidateTagCollections(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -280,14 +280,14 @@ export class CoreTagProvider { /** * Invalidate tag index. * - * @param {number} [id=0] Tag ID. - * @param {string} [name=''] Tag name. - * @param {number} [collectionId=0] Tag collection ID. - * @param {number} [areaId=0] Tag area ID. - * @param {number} [fromContextId=0] Context ID where the link was displayed. - * @param {number} [contextId=0] Context ID where to search for items. - * @param {boolean} [recursive=true] Search in the context and its children. - * @return {Promise} Promise resolved when the data is invalidated. + * @param id Tag ID. + * @param name Tag name. + * @param collectionId Tag collection ID. + * @param areaId Tag area ID. + * @param fromContextId Context ID where the link was displayed. + * @param contextId Context ID where to search for items. + * @param recursive Search in the context and its children. + * @return Promise resolved when the data is invalidated. */ invalidateTagIndexPerArea(id: number, name: string = '', collectionId: number = 0, areaId: number = 0, fromContextId: number = 0, contextId: number = 0, recursive: boolean = true, siteId?: string): Promise { @@ -301,14 +301,14 @@ export class CoreTagProvider { /** * Get cache key for tag cloud. * - * @param {number} collectionId Tag collection ID. - * @param {boolean} isStandard Whether to return only standard tags. - * @param {string} sort Sort order for display (id, name, rawname, count, flag, isstandard, tagcollid). - * @param {string} search Search string. - * @param {number} fromContextId Context ID where this tag cloud is displayed. - * @param {number} contextId Only retrieve tag instances in this context. - * @param {boolean} recursive Retrieve tag instances in the context and it's children. - * @return {string} Cache key. + * @param collectionId Tag collection ID. + * @param isStandard Whether to return only standard tags. + * @param sort Sort order for display (id, name, rawname, count, flag, isstandard, tagcollid). + * @param search Search string. + * @param fromContextId Context ID where this tag cloud is displayed. + * @param contextId Only retrieve tag instances in this context. + * @param recursive Retrieve tag instances in the context and it's children. + * @return Cache key. */ protected getTagCloudKey(collectionId: number, isStandard: boolean, sort: string, search: string, fromContextId: number, contextId: number, recursive: boolean): string { @@ -319,7 +319,7 @@ export class CoreTagProvider { /** * Get cache key for tag collections. * - * @return {string} Cache key. + * @return Cache key. */ protected getTagCollectionsKey(): string { return this.ROOT_CACHE_KEY + 'collections'; @@ -328,14 +328,14 @@ export class CoreTagProvider { /** * Get cache key for tag index. * - * @param {number} id Tag ID. - * @param {string} name Tag name. - * @param {number} collectionId Tag collection ID. - * @param {number} areaId Tag area ID. - * @param {number} fromContextId Context ID where the link was displayed. - * @param {number} contextId Context ID where to search for items. - * @param {boolean} [recursive=true] Search in the context and its children. - * @return {string} Cache key. + * @param id Tag ID. + * @param name Tag name. + * @param collectionId Tag collection ID. + * @param areaId Tag area ID. + * @param fromContextId Context ID where the link was displayed. + * @param contextId Context ID where to search for items. + * @param recursive Search in the context and its children. + * @return Cache key. */ protected getTagIndexPerAreaKey(id: number, name: string, collectionId: number, areaId: number, fromContextId: number, contextId: number, recursive: boolean): string { diff --git a/src/core/user/components/participants/participants.ts b/src/core/user/components/participants/participants.ts index 35475a2b4..236345e90 100644 --- a/src/core/user/components/participants/participants.ts +++ b/src/core/user/components/participants/participants.ts @@ -64,8 +64,8 @@ export class CoreUserParticipantsComponent implements OnInit { /** * Fetch all the data required for the view. * - * @param {boolean} [refresh] Empty events array first. - * @return {Promise} Resolved when done. + * @param refresh Empty events array first. + * @return Resolved when done. */ fetchData(refresh: boolean = false): Promise { const firstToGet = refresh ? 0 : this.participants.length; @@ -87,8 +87,8 @@ export class CoreUserParticipantsComponent implements OnInit { /** * Function to load more data. * - * @param {any} [infiniteComplete] Infinite scroll complete function. Only used from core-infinite-loading. - * @return {Promise} Resolved when done. + * @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading. + * @return Resolved when done. */ loadMoreData(infiniteComplete?: any): Promise { return this.fetchData().finally(() => { @@ -99,7 +99,7 @@ export class CoreUserParticipantsComponent implements OnInit { /** * Refresh data. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshParticipants(refresher: any): void { this.userProvider.invalidateParticipantsList(this.courseId).finally(() => { @@ -111,7 +111,7 @@ export class CoreUserParticipantsComponent implements OnInit { /** * Navigate to a particular user profile. - * @param {number} userId User Id where to navigate. + * @param userId User Id where to navigate. */ gotoParticipant(userId: number): void { this.participantId = userId; diff --git a/src/core/user/pages/about/about.ts b/src/core/user/pages/about/about.ts index baed48158..96ab5b210 100644 --- a/src/core/user/pages/about/about.ts +++ b/src/core/user/pages/about/about.ts @@ -83,7 +83,7 @@ export class CoreUserAboutPage { /** * Refresh the user. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshUser(refresher?: any): void { this.userProvider.invalidateUserCache(this.userId).finally(() => { diff --git a/src/core/user/pages/profile/profile.ts b/src/core/user/pages/profile/profile.ts index fd3875f0d..c60bb9a2f 100644 --- a/src/core/user/pages/profile/profile.ts +++ b/src/core/user/pages/profile/profile.ts @@ -192,7 +192,7 @@ export class CoreUserProfilePage { /** * Refresh the user. * - * @param {any} refresher Refresher. + * @param refresher Refresher. */ refreshUser(refresher?: any): void { const promises = []; @@ -225,8 +225,8 @@ export class CoreUserProfilePage { /** * A handler was clicked. * - * @param {Event} event Click event. - * @param {CoreUserProfileHandlerData} handler Handler that was clicked. + * @param event Click event. + * @param handler Handler that was clicked. */ handlerClicked(event: Event, handler: CoreUserProfileHandlerData): void { // Decide which navCtrl to use. If this page is inside a split view, use the split view's master nav. diff --git a/src/core/user/providers/course-option-handler.ts b/src/core/user/providers/course-option-handler.ts index 9636dcfeb..5d1c61d33 100644 --- a/src/core/user/providers/course-option-handler.ts +++ b/src/core/user/providers/course-option-handler.ts @@ -31,10 +31,10 @@ export class CoreUserParticipantsCourseOptionHandler implements CoreCourseOption /** * Should invalidate the data to determine if the handler is enabled for a certain course. * - * @param {number} courseId The course ID. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {Promise} Promise resolved when done. + * @param courseId The course ID. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved when done. */ invalidateEnabledForCourse(courseId: number, navOptions?: any, admOptions?: any): Promise { if (navOptions && typeof navOptions.participants != 'undefined') { @@ -48,7 +48,7 @@ export class CoreUserParticipantsCourseOptionHandler implements CoreCourseOption /** * 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 { return true; @@ -57,11 +57,11 @@ export class CoreUserParticipantsCourseOptionHandler implements CoreCourseOption /** * Whether or not the handler is enabled for a certain course. * - * @param {number} courseId The course ID. - * @param {any} accessData Access type and data. Default, guest, ... - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} True or promise resolved with true if enabled. + * @param courseId The course ID. + * @param accessData Access type and data. Default, guest, ... + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return True or promise resolved with true if enabled. */ isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise { if (accessData && accessData.type == CoreCourseProvider.ACCESS_GUEST) { @@ -78,9 +78,9 @@ export class CoreUserParticipantsCourseOptionHandler implements CoreCourseOption /** * Returns the data needed to render the handler. * - * @param {Injector} injector Injector. - * @param {number} course The course. - * @return {CoreCourseOptionsHandlerData|Promise} Data or promise resolved with the data. + * @param injector Injector. + * @param course The course. + * @return Data or promise resolved with the data. */ getDisplayData(injector: Injector, course: any): CoreCourseOptionsHandlerData | Promise { return { @@ -93,8 +93,8 @@ export class CoreUserParticipantsCourseOptionHandler implements CoreCourseOption /** * 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. - * @return {Promise} Promise resolved when done. + * @param course The course. + * @return Promise resolved when done. */ prefetch(course: any): Promise { return this.getParticipantsPage(course.id, 0); @@ -103,9 +103,9 @@ export class CoreUserParticipantsCourseOptionHandler implements CoreCourseOption /** * Get a participant page and, if there are more participants, call the function again to get it too. * - * @param {number} courseId Course ID. - * @param {number} limitFrom The number of participants already loaded. - * @return {Promise} Promise resolved when done. + * @param courseId Course ID. + * @param limitFrom The number of participants already loaded. + * @return Promise resolved when done. */ protected getParticipantsPage(courseId: number, limitFrom: number): Promise { return this.userProvider.getParticipants(courseId, limitFrom, undefined, undefined, true).then((result) => { diff --git a/src/core/user/providers/helper.ts b/src/core/user/providers/helper.ts index fd9367869..876ea1aa0 100644 --- a/src/core/user/providers/helper.ts +++ b/src/core/user/providers/helper.ts @@ -30,10 +30,10 @@ export class CoreUserHelperProvider { /** * Formats a user address, concatenating address, city and country. * - * @param {string} address Address. - * @param {string} city City. - * @param {string} country Country. - * @return {string} Formatted address. + * @param address Address. + * @param city City. + * @param country Country. + * @return Formatted address. */ formatAddress(address: string, city: string, country: string): string { const separator = this.translate.instant('core.listsep'); @@ -49,8 +49,8 @@ export class CoreUserHelperProvider { /** * Formats a user role list, translating and concatenating them. * - * @param {any[]} [roles] List of user roles. - * @return {string} The formatted roles. + * @param roles List of user roles. + * @return The formatted roles. */ formatRoleList(roles?: any[]): string { if (!roles || roles.length <= 0) { diff --git a/src/core/user/providers/offline.ts b/src/core/user/providers/offline.ts index 36ccc4c05..470a52c9d 100644 --- a/src/core/user/providers/offline.ts +++ b/src/core/user/providers/offline.ts @@ -65,7 +65,7 @@ export class CoreUserOfflineProvider { /** * Get preferences that were changed offline. * - * @return {Promise} Promise resolved with list of preferences. + * @return Promise resolved with list of preferences. */ getChangedPreferences(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -76,8 +76,8 @@ export class CoreUserOfflineProvider { /** * Get an offline preference. * - * @param {string} name Name of the preference. - * @return {Promise} Promise resolved with the preference, rejected if not found. + * @param name Name of the preference. + * @return Promise resolved with the preference, rejected if not found. */ getPreference(name: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -90,10 +90,10 @@ export class CoreUserOfflineProvider { /** * Set an offline preference. * - * @param {string} name Name of the preference. - * @param {string} value Value of the preference. - * @param {string} onlineValue Online value of the preference. If unedfined, preserve previously stored value. - * @return {Promise} Promise resolved when done. + * @param name Name of the preference. + * @param value Value of the preference. + * @param onlineValue Online value of the preference. If unedfined, preserve previously stored value. + * @return Promise resolved when done. */ setPreference(name: string, value: string, onlineValue?: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { diff --git a/src/core/user/providers/participants-link-handler.ts b/src/core/user/providers/participants-link-handler.ts index fb9971f02..501ecc937 100644 --- a/src/core/user/providers/participants-link-handler.ts +++ b/src/core/user/providers/participants-link-handler.ts @@ -39,11 +39,11 @@ export class CoreUserParticipantsLinkHandler extends CoreContentLinksHandlerBase /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -84,11 +84,11 @@ export class CoreUserParticipantsLinkHandler extends CoreContentLinksHandlerBase * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { courseId = parseInt(params.id, 10) || courseId; diff --git a/src/core/user/providers/sync-cron-handler.ts b/src/core/user/providers/sync-cron-handler.ts index a51b2da8b..5ee16c66d 100644 --- a/src/core/user/providers/sync-cron-handler.ts +++ b/src/core/user/providers/sync-cron-handler.ts @@ -29,9 +29,9 @@ export class CoreUserSyncCronHandler implements CoreCronHandler { * Execute the process. * Receives the ID of the site affected, undefined for all sites. * - * @param {string} [siteId] ID of the site affected, undefined for all sites. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @return {Promise} Promise resolved when done, rejected if failure. + * @param siteId ID of the site affected, undefined for all sites. + * @param force Wether the execution is forced (manual sync). + * @return Promise resolved when done, rejected if failure. */ execute(siteId?: string, force?: boolean): Promise { return this.userSync.syncPreferences(siteId); @@ -40,7 +40,7 @@ export class CoreUserSyncCronHandler implements CoreCronHandler { /** * Get the time between consecutive executions. * - * @return {number} Time between consecutive executions (in ms). + * @return Time between consecutive executions (in ms). */ getInterval(): number { return 300000; // 5 minutes. diff --git a/src/core/user/providers/sync.ts b/src/core/user/providers/sync.ts index 62de2f679..58cbf6ea7 100644 --- a/src/core/user/providers/sync.ts +++ b/src/core/user/providers/sync.ts @@ -43,8 +43,8 @@ export class CoreUserSyncProvider extends CoreSyncBaseProvider { /** * Try to synchronize user preferences in a certain site or in all sites. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @return {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @return Promise resolved if sync is successful, rejected if sync fails. */ syncPreferences(siteId?: string): Promise { const syncFunctionLog = 'all user preferences'; @@ -55,8 +55,8 @@ export class CoreUserSyncProvider extends CoreSyncBaseProvider { /** * Sync user preferences of a site. * - * @param {string} [siteId] Site ID to sync. If not defined, sync all sites. - * @param {Promise} Promise resolved if sync is successful, rejected if sync fails. + * @param siteId Site ID to sync. If not defined, sync all sites. + * @param Promise resolved if sync is successful, rejected if sync fails. */ protected syncPreferencesFunc(siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); diff --git a/src/core/user/providers/tag-area-handler.ts b/src/core/user/providers/tag-area-handler.ts index ab2d167cf..3bd607f44 100644 --- a/src/core/user/providers/tag-area-handler.ts +++ b/src/core/user/providers/tag-area-handler.ts @@ -29,7 +29,7 @@ export class CoreUserTagAreaHandler implements CoreTagAreaHandler { /** * Whether or not the handler is enabled on a site level. - * @return {boolean|Promise} 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 { return true; @@ -38,8 +38,8 @@ export class CoreUserTagAreaHandler implements CoreTagAreaHandler { /** * Parses the rendered content of a tag index and returns the items. * - * @param {string} content Rendered content. - * @return {any[]|Promise} Area items (or promise resolved with the items). + * @param content Rendered content. + * @return Area items (or promise resolved with the items). */ parseContent(content: string): any[] | Promise { const items = []; @@ -73,8 +73,8 @@ export class CoreUserTagAreaHandler implements CoreTagAreaHandler { /** * Get the component to use to display items. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise { return CoreUserTagAreaComponent; diff --git a/src/core/user/providers/user-delegate.ts b/src/core/user/providers/user-delegate.ts index 92796f273..0e74b38f8 100644 --- a/src/core/user/providers/user-delegate.ts +++ b/src/core/user/providers/user-delegate.ts @@ -28,7 +28,6 @@ import { Subject, BehaviorSubject } from 'rxjs'; export interface CoreUserProfileHandler extends CoreDelegateHandler { /** * The highest priority is displayed first. - * @type {number} */ priority: number; @@ -38,25 +37,24 @@ export interface CoreUserProfileHandler extends CoreDelegateHandler { * - TYPE_NEW_PAGE: will be displayed as a list of items. Should have icon. Spinner not used. * Default value if none is specified. * - TYPE_ACTION: will be displayed as a button and should not redirect to any state. Spinner use is recommended. - * @type {string} */ type: string; /** * Whether or not the handler is enabled for a user. - * @param {any} user User object. - * @param {number} courseId Course ID where to show. - * @param {any} [navOptions] Navigation options for the course. - * @param {any} [admOptions] Admin options for the course. - * @return {boolean|Promise} Whether or not the handler is enabled for a user. + * @param user User object. + * @param courseId Course ID where to show. + * @param navOptions Navigation options for the course. + * @param admOptions Admin options for the course. + * @return Whether or not the handler is enabled for a user. */ isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise; /** * Returns the data needed to render the handler. - * @param {any} user User object. - * @param {number} courseId Course ID where to show. - * @return {CoreUserProfileHandlerData} Data to be shown. + * @param user User object. + * @param courseId Course ID where to show. + * @return Data to be shown. */ getDisplayData(user: any, courseId: number): CoreUserProfileHandlerData; } @@ -67,41 +65,36 @@ export interface CoreUserProfileHandler extends CoreDelegateHandler { export interface CoreUserProfileHandlerData { /** * Title to display. - * @type {string} */ title: string; /** * Name of the icon to display. Mandatory for TYPE_COMMUNICATION. - * @type {string} */ icon?: string; /** * Additional class to add to the HTML. - * @type {string} */ class?: string; /** * If enabled, element will be hidden. Only for TYPE_NEW_PAGE and TYPE_ACTION. - * @type {boolean} */ hidden?: boolean; /** * If enabled will show an spinner. Only for TYPE_ACTION. - * @type {boolean} */ spinner?: boolean; /** * Action to do when clicked. * - * @param {Event} event Click event. - * @param {NavController} Nav controller to use to navigate. - * @param {any} user User object. - * @param {number} [courseId] Course ID being viewed. If not defined, site context. + * @param event Click event. + * @param Nav controller to use to navigate. + * @param user User object. + * @param courseId Course ID being viewed. If not defined, site context. */ action?(event: Event, navCtrl: NavController, user: any, courseId?: number): void; } @@ -112,25 +105,21 @@ export interface CoreUserProfileHandlerData { export interface CoreUserProfileHandlerToDisplay { /** * Name of the handler. - * @type {string} */ name?: string; /** * Data to display. - * @type {CoreUserProfileHandlerData} */ data: CoreUserProfileHandlerData; /** * The highest priority is displayed first. - * @type {number} */ priority?: number; /** * The type of the handler. See CoreUserProfileHandler. - * @type {string} */ type: string; } @@ -143,23 +132,19 @@ export interface CoreUserProfileHandlerToDisplay { export class CoreUserDelegate extends CoreDelegate { /** * User profile handler type for communication. - * @type {string} */ static TYPE_COMMUNICATION = 'communication'; /** * User profile handler type for new page. - * @type {string} */ static TYPE_NEW_PAGE = 'newpage'; /** * User profile handler type for actions. - * @type {string} */ static TYPE_ACTION = 'action'; /** * Update handler information event. - * @type {string} */ static UPDATE_HANDLER_EVENT = 'CoreUserDelegate_update_handler_event'; @@ -198,7 +183,7 @@ export class CoreUserDelegate extends CoreDelegate { /** * Check if handlers are loaded. * - * @return {boolean} True if handlers are loaded, false otherwise. + * @return True if handlers are loaded, false otherwise. */ areHandlersLoaded(userId: number): boolean { return this.userHandlers[userId] && this.userHandlers[userId].loaded; @@ -207,7 +192,7 @@ export class CoreUserDelegate extends CoreDelegate { /** * Clear current user handlers. * - * @param {number} userId The user to clear. + * @param userId The user to clear. */ clearUserHandlers(userId: number): void { const userData = this.userHandlers[userId]; @@ -222,9 +207,9 @@ export class CoreUserDelegate extends CoreDelegate { /** * Get the profile handlers for a user. * - * @param {any} user The user object. - * @param {number} courseId The course ID. - * @return {Subject} Resolved with the handlers. + * @param user The user object. + * @param courseId The course ID. + * @return Resolved with the handlers. */ getProfileHandlersFor(user: any, courseId: number): Subject { let promise, diff --git a/src/core/user/providers/user-handler.ts b/src/core/user/providers/user-handler.ts index 699f1fac2..862dde6a5 100644 --- a/src/core/user/providers/user-handler.ts +++ b/src/core/user/providers/user-handler.ts @@ -31,7 +31,7 @@ export class CoreUserProfileMailHandler implements CoreUserProfileHandler { /** * Check if handler is enabled. * - * @return {boolean} Always enabled. + * @return Always enabled. */ isEnabled(): boolean { return true; @@ -40,11 +40,11 @@ export class CoreUserProfileMailHandler implements CoreUserProfileHandler { /** * Check if handler is enabled for this user in this context. * - * @param {any} user User to check. - * @param {number} courseId Course ID. - * @param {any} [navOptions] Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. - * @param {any} [admOptions] Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. - * @return {boolean|Promise} Promise resolved with true if enabled, resolved with false otherwise. + * @param user User to check. + * @param courseId Course ID. + * @param navOptions Course navigation options for current user. See CoreCoursesProvider.getUserNavigationOptions. + * @param admOptions Course admin options for current user. See CoreCoursesProvider.getUserAdministrationOptions. + * @return Promise resolved with true if enabled, resolved with false otherwise. */ isEnabledForUser(user: any, courseId: number, navOptions?: any, admOptions?: any): boolean | Promise { // Not current user required. @@ -54,7 +54,7 @@ export class CoreUserProfileMailHandler implements CoreUserProfileHandler { /** * 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 { return { diff --git a/src/core/user/providers/user-link-handler.ts b/src/core/user/providers/user-link-handler.ts index eb9a0b0b6..6fd64e759 100644 --- a/src/core/user/providers/user-link-handler.ts +++ b/src/core/user/providers/user-link-handler.ts @@ -33,11 +33,11 @@ export class CoreUserProfileLinkHandler extends CoreContentLinksHandlerBase { /** * Get the list of actions for a link (url). * - * @param {string[]} siteIds List of sites the URL belongs to. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {CoreContentLinksAction[]|Promise} List of (or promise resolved with list of) actions. + * @param siteIds List of sites the URL belongs to. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return List of (or promise resolved with list of) actions. */ getActions(siteIds: string[], url: string, params: any, courseId?: number): CoreContentLinksAction[] | Promise { @@ -56,11 +56,11 @@ export class CoreUserProfileLinkHandler extends CoreContentLinksHandlerBase { * Check if the handler is enabled for a certain site (site + user) and a URL. * If not defined, defaults to true. * - * @param {string} siteId The site ID. - * @param {string} url The URL to treat. - * @param {any} 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. - * @return {boolean|Promise} Whether the handler is enabled for the URL and site. + * @param siteId The site ID. + * @param url The URL to treat. + * @param params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1} + * @param courseId Course ID related to the URL. Optional but recommended. + * @return Whether the handler is enabled for the URL and site. */ isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise { return url.indexOf('/grade/report/') == -1; diff --git a/src/core/user/providers/user-profile-field-delegate.ts b/src/core/user/providers/user-profile-field-delegate.ts index e047100bd..a059ad1a5 100644 --- a/src/core/user/providers/user-profile-field-delegate.ts +++ b/src/core/user/providers/user-profile-field-delegate.ts @@ -21,7 +21,6 @@ import { CoreEventsProvider } from '@providers/events'; export interface CoreUserProfileFieldHandler extends CoreDelegateHandler { /** * Type of the field the handler supports. E.g. 'checkbox'. - * @type {string} */ type: string; @@ -29,18 +28,18 @@ export interface CoreUserProfileFieldHandler extends CoreDelegateHandler { * Return the Component to use to display the user profile field. * It's recommended to return the class of the component, but you can also return an instance of the component. * - * @param {Injector} injector Injector. - * @return {any|Promise} The component (or promise resolved with component) to use, undefined if not found. + * @param injector Injector. + * @return The component (or promise resolved with component) to use, undefined if not found. */ getComponent(injector: Injector): any | Promise; /** * Get the data to send for the field based on the input data. - * @param {any} field User field to get the data for. - * @param {boolean} signup True if user is in signup page. - * @param {string} [registerAuth] Register auth method. E.g. 'email'. - * @param {any} formValues Form Values. - * @return {Promise|CoreUserProfileFieldHandlerData} Data to send for the field. + * @param field User field to get the data for. + * @param signup True if user is in signup page. + * @param registerAuth Register auth method. E.g. 'email'. + * @param formValues Form Values. + * @return Data to send for the field. */ getData?(field: any, signup: boolean, registerAuth: string, formValues: any): Promise | CoreUserProfileFieldHandlerData; @@ -49,19 +48,16 @@ export interface CoreUserProfileFieldHandler extends CoreDelegateHandler { export interface CoreUserProfileFieldHandlerData { /** * Name to display. - * @type {string} */ name: string; /** * Field type. - * @type {string} */ type?: string; /** * Value of the field. - * @type {any} */ value: any; } @@ -81,10 +77,10 @@ export class CoreUserProfileFieldDelegate extends CoreDelegate { /** * Get the component to use to display an user field. * - * @param {Injector} injector Injector. - * @param {any} field User field to get the directive for. - * @param {boolean} signup True if user is in signup page. - * @return {Promise} Promise resolved with component to use, undefined if not found. + * @param injector Injector. + * @param field User field to get the directive for. + * @param signup True if user is in signup page. + * @return Promise resolved with component to use, undefined if not found. */ getComponent(injector: Injector, field: any, signup: boolean): Promise { const type = field.type || field.datatype; @@ -103,11 +99,11 @@ export class CoreUserProfileFieldDelegate extends CoreDelegate { /** * Get the data to send for a certain field based on the input data. * - * @param {any} field User field to get the data for. - * @param {boolean} signup True if user is in signup page. - * @param {string} registerAuth Register auth method. E.g. 'email'. - * @param {any} formValues Form values. - * @return {Promise} Data to send for the field. + * @param field User field to get the data for. + * @param signup True if user is in signup page. + * @param registerAuth Register auth method. E.g. 'email'. + * @param formValues Form values. + * @return Data to send for the field. */ getDataForField(field: any, signup: boolean, registerAuth: string, formValues: any): Promise { const type = field.type || field.datatype, @@ -133,11 +129,11 @@ export class CoreUserProfileFieldDelegate extends CoreDelegate { /** * Get the data to send for a list of fields based on the input data. * - * @param {any[]} fields User fields to get the data for. - * @param {boolean} [signup] True if user is in signup page. - * @param {string} [registerAuth] Register auth method. E.g. 'email'. - * @param {any} formValues Form values. - * @return {Promise} Data to send. + * @param fields User fields to get the data for. + * @param signup True if user is in signup page. + * @param registerAuth Register auth method. E.g. 'email'. + * @param formValues Form values. + * @return Data to send. */ getDataForFields(fields: any[], signup: boolean = false, registerAuth: string = '', formValues: any): Promise { const result = [], diff --git a/src/core/user/providers/user.ts b/src/core/user/providers/user.ts index 5b6141006..7529b0b90 100644 --- a/src/core/user/providers/user.ts +++ b/src/core/user/providers/user.ts @@ -72,9 +72,9 @@ export class CoreUserProvider { /** * Change the given user profile picture. * - * @param {number} draftItemId New picture draft item id. - * @param {number} userId User ID. - * @return {Promise} Promise resolve with the new profileimageurl + * @param draftItemId New picture draft item id. + * @param userId User ID. + * @return Promise resolve with the new profileimageurl */ changeProfilePicture(draftItemId: number, userId: number): Promise { const data = { @@ -95,9 +95,9 @@ export class CoreUserProvider { /** * Store user basic information in local DB to be retrieved if the WS call fails. * - * @param {number} userId User ID. - * @param {string} [siteId] ID of the site. If not defined, use current site. - * @return {Promise} Promise resolve when the user is deleted. + * @param userId User ID. + * @param siteId ID of the site. If not defined, use current site. + * @return Promise resolve when the user is deleted. */ deleteStoredUser(userId: number, siteId?: string): Promise { if (isNaN(userId)) { @@ -121,12 +121,12 @@ export class CoreUserProvider { /** * Get participants for a certain course. * - * @param {number} courseId ID of the course. - * @param {number} limitFrom Position of the first participant to get. - * @param {number} limitNumber Number of participants to get. - * @param {string} [siteId] Site Id. If not defined, use current site. - * @param {boolean} [ignoreCache] True if it should ignore cached data (it will always fail in offline or server down). - * @return {Promise<{participants: any[], canLoadMore: boolean}>} Promise resolved when the participants are retrieved. + * @param courseId ID of the course. + * @param limitFrom Position of the first participant to get. + * @param limitNumber Number of participants to get. + * @param siteId Site Id. If not defined, use current site. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved when the participants are retrieved. */ getParticipants(courseId: number, limitFrom: number = 0, limitNumber: number = CoreUserProvider.PARTICIPANTS_LIST_LIMIT, siteId?: string, ignoreCache?: boolean): Promise<{participants: any[], canLoadMore: boolean}> { @@ -172,8 +172,8 @@ export class CoreUserProvider { /** * Get cache key for participant list WS calls. * - * @param {number} courseId Course ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @return Cache key. */ protected getParticipantsListCacheKey(courseId: number): string { return this.ROOT_CACHE_KEY + 'list:' + courseId; @@ -182,11 +182,11 @@ export class CoreUserProvider { /** * Get user profile. The type of profile retrieved depends on the params. * - * @param {number} userId User's ID. - * @param {number} [courseId] Course ID to get course profile, undefined or 0 to get site profile. - * @param {boolean} [forceLocal] True to retrieve the user data from local DB, false to retrieve it from WS. - * @param {string} [siteId] ID of the site. If not defined, use current site. - * @return {Promise} Promise resolved with the user data. + * @param userId User's ID. + * @param courseId Course ID to get course profile, undefined or 0 to get site profile. + * @param forceLocal True to retrieve the user data from local DB, false to retrieve it from WS. + * @param siteId ID of the site. If not defined, use current site. + * @return Promise resolved with the user data. */ getProfile(userId: number, courseId?: number, forceLocal: boolean = false, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -205,8 +205,8 @@ export class CoreUserProvider { /** * Get cache key for a user WS call. * - * @param {number} userId User ID. - * @return {string} Cache key. + * @param userId User ID. + * @return Cache key. */ protected getUserCacheKey(userId: number): string { return this.ROOT_CACHE_KEY + 'data:' + userId; @@ -215,9 +215,9 @@ export class CoreUserProvider { /** * Get user basic information from local DB. * - * @param {number} userId User ID. - * @param {string} [siteId] ID of the site. If not defined, use current site. - * @return {Promise} Promise resolve when the user is retrieved. + * @param userId User ID. + * @param siteId ID of the site. If not defined, use current site. + * @return Promise resolve when the user is retrieved. */ protected getUserFromLocalDb(userId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -228,10 +228,10 @@ export class CoreUserProvider { /** * Get user profile from WS. * - * @param {number} userId User ID. - * @param {number} [courseId] Course ID to get course profile, undefined or 0 to get site profile. - * @param {string} [siteId] ID of the site. If not defined, use current site. - * @return {Promise} Promise resolve when the user is retrieved. + * @param userId User ID. + * @param courseId Course ID to get course profile, undefined or 0 to get site profile. + * @param siteId ID of the site. If not defined, use current site. + * @return Promise resolve when the user is retrieved. */ protected getUserFromWS(userId: number, courseId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -282,9 +282,9 @@ export class CoreUserProvider { /** * Get a user preference (online or offline). * - * @param {string} name Name of the preference. - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {string} Preference value or null if preference not set. + * @param name Name of the preference. + * @param siteId Site Id. If not defined, use current site. + * @return Preference value or null if preference not set. */ getUserPreference(name: string, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -313,8 +313,8 @@ export class CoreUserProvider { /** * Get cache key for a user preference WS call. * - * @param {string} name Preference name. - * @return {string} Cache key. + * @param name Preference name. + * @return Cache key. */ protected getUserPreferenceCacheKey(name: string): string { return this.ROOT_CACHE_KEY + 'preference:' + name; @@ -323,9 +323,9 @@ export class CoreUserProvider { /** * Get a user preference online. * - * @param {string} name Name of the preference. - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {string} Preference value or null if preference not set. + * @param name Name of the preference. + * @param siteId Site Id. If not defined, use current site. + * @return Preference value or null if preference not set. */ getUserPreferenceOnline(name: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -344,9 +344,9 @@ export class CoreUserProvider { /** * Invalidates user WS calls. * - * @param {number} userId User ID. - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param userId User ID. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateUserCache(userId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -357,9 +357,9 @@ export class CoreUserProvider { /** * Invalidates participant list for a certain course. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the list is invalidated. + * @param courseId Course ID. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the list is invalidated. */ invalidateParticipantsList(courseId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -370,9 +370,9 @@ export class CoreUserProvider { /** * Invalidate user preference. * - * @param {string} name Name of the preference. - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param name Name of the preference. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved when the data is invalidated. */ invalidateUserPreference(name: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -383,8 +383,8 @@ export class CoreUserProvider { /** * Check if course participants is disabled in a certain site. * - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if disabled, rejected or resolved with false otherwise. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if disabled, rejected or resolved with false otherwise. */ isParticipantsDisabled(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -395,8 +395,8 @@ export class CoreUserProvider { /** * Check if course participants is disabled in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} Whether it's disabled. + * @param site Site. If not defined, use current site. + * @return Whether it's disabled. */ isParticipantsDisabledInSite(site?: any): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -407,9 +407,9 @@ export class CoreUserProvider { /** * Returns whether or not participants is enabled for a certain course. * - * @param {number} courseId Course ID. - * @param {string} [siteId] Site Id. If not defined, use current site. - * @return {Promise} Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. + * @param courseId Course ID. + * @param siteId Site Id. If not defined, use current site. + * @return Promise resolved with true if plugin is enabled, rejected or resolved with false otherwise. */ isPluginEnabledForCourse(courseId: number, siteId?: string): Promise { if (!courseId) { @@ -423,8 +423,8 @@ export class CoreUserProvider { /** * Check if update profile picture is disabled in a certain site. * - * @param {CoreSite} [site] Site. If not defined, use current site. - * @return {boolean} True if disabled, false otherwise. + * @param site Site. If not defined, use current site. + * @return True if disabled, false otherwise. */ isUpdatePictureDisabledInSite(site?: CoreSite): boolean { site = site || this.sitesProvider.getCurrentSite(); @@ -434,10 +434,10 @@ export class CoreUserProvider { /** * Log User Profile View in Moodle. - * @param {number} userId User ID. - * @param {number} [courseId] Course ID. - * @param {string} [name] Name of the user. - * @return {Promise} Promise resolved when done. + * @param userId User ID. + * @param courseId Course ID. + * @param name Name of the user. + * @return Promise resolved when done. */ logView(userId: number, courseId?: number, name?: string): Promise { const params = { @@ -456,8 +456,8 @@ export class CoreUserProvider { /** * Log Participants list view in Moodle. - * @param {number} courseId Course ID. - * @return {Promise} Promise resolved when done. + * @param courseId Course ID. + * @return Promise resolved when done. */ logParticipantsView(courseId?: number): Promise { const params = { @@ -472,10 +472,10 @@ export class CoreUserProvider { /** * Prefetch user profiles and their images from a certain course. It prevents duplicates. * - * @param {number[]} userIds List of user IDs. - * @param {number} [courseId] Course the users belong to. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when prefetched. + * @param userIds List of user IDs. + * @param courseId Course the users belong to. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when prefetched. */ prefetchProfiles(userIds: number[], courseId?: number, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -508,11 +508,11 @@ export class CoreUserProvider { /** * Store user basic information in local DB to be retrieved if the WS call fails. * - * @param {number} userId User ID. - * @param {string} fullname User full name. - * @param {string} avatar User avatar URL. - * @param {string} [siteId] ID of the site. If not defined, use current site. - * @return {Promise} Promise resolve when the user is stored. + * @param userId User ID. + * @param fullname User full name. + * @param avatar User avatar URL. + * @param siteId ID of the site. If not defined, use current site. + * @return Promise resolve when the user is stored. */ protected storeUser(userId: number, fullname: string, avatar: string, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -529,9 +529,9 @@ export class CoreUserProvider { /** * Store users basic information in local DB. * - * @param {any[]} users Users to store. Fields stored: id, fullname, profileimageurl. - * @param {string} [siteId] ID of the site. If not defined, use current site. - * @return {Promise} Promise resolve when the user is stored. + * @param users Users to store. Fields stored: id, fullname, profileimageurl. + * @param siteId ID of the site. If not defined, use current site. + * @return Promise resolve when the user is stored. */ storeUsers(users: any[], siteId?: string): Promise { const promises = []; @@ -548,10 +548,10 @@ export class CoreUserProvider { /** * Set a user preference (online or offline). * - * @param {string} name Name of the preference. - * @param {string} value Value of the preference. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved on success. + * @param name Name of the preference. + * @param value Value of the preference. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved on success. */ setUserPreference(name: string, value: string, siteId?: string): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -587,11 +587,11 @@ export class CoreUserProvider { /** * Update a preference for a user. * - * @param {string} name Preference name. - * @param {any} value Preference new value. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success. + * @param name Preference name. + * @param value Preference new value. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success. */ updateUserPreference(name: string, value: any, userId?: number, siteId?: string): Promise { const preferences = [ @@ -607,11 +607,11 @@ export class CoreUserProvider { /** * Update some preferences for a user. * - * @param {{name: string, value: string}[]} preferences List of preferences. - * @param {boolean} [disableNotifications] Whether to disable all notifications. Undefined to not update this value. - * @param {number} [userId] User ID. If not defined, site's current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved if success. + * @param preferences List of preferences. + * @param disableNotifications Whether to disable all notifications. Undefined to not update this value. + * @param userId User ID. If not defined, site's current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved if success. */ updateUserPreferences(preferences: {type: string, value: string}[], disableNotifications?: boolean, userId?: number, siteId?: string): Promise { diff --git a/src/directives/auto-rows.ts b/src/directives/auto-rows.ts index 3160c00f1..6bd56aa22 100644 --- a/src/directives/auto-rows.ts +++ b/src/directives/auto-rows.ts @@ -56,7 +56,7 @@ export class CoreAutoRowsDirective { /** * Resize the textarea. - * @param {any} $event Event fired. + * @param $event Event fired. */ protected resize($event?: any): void { let nativeElement = this.element.nativeElement; diff --git a/src/directives/external-content.ts b/src/directives/external-content.ts index 4026e7e0a..d86493a80 100644 --- a/src/directives/external-content.ts +++ b/src/directives/external-content.ts @@ -84,7 +84,7 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges { /** * Add a new source with a certain URL as a sibling of the current element. * - * @param {string} url URL to use in the source. + * @param url URL to use in the source. */ protected addSource(url: string): void { if (this.element.tagName !== 'SOURCE') { @@ -174,10 +174,10 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges { /** * Handle external content, setting the right URL. * - * @param {string} targetAttr Attribute to modify. - * @param {string} url Original URL to treat. - * @param {string} [siteId] Site ID. - * @return {Promise} Promise resolved if the element is successfully treated. + * @param targetAttr Attribute to modify. + * @param url Original URL to treat. + * @param siteId Site ID. + * @return Promise resolved if the element is successfully treated. */ protected handleExternalContent(targetAttr: string, url: string, siteId?: string): Promise { @@ -285,8 +285,8 @@ export class CoreExternalContentDirective implements AfterViewInit, OnChanges { /** * Handle inline styles, trying to download referenced files. * - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved if the element is successfully treated. + * @param siteId Site ID. + * @return Promise resolved if the element is successfully treated. */ protected handleInlineStyles(siteId: string): Promise { let inlineStyles = this.element.getAttribute('style'); diff --git a/src/directives/format-text.ts b/src/directives/format-text.ts index ede668a6b..bada2a967 100644 --- a/src/directives/format-text.ts +++ b/src/directives/format-text.ts @@ -37,7 +37,6 @@ import { CoreSplitViewComponent } from '@components/split-view/split-view'; * * Example usage: * - * */ @Directive({ selector: 'core-format-text' @@ -89,8 +88,8 @@ export class CoreFormatTextDirective implements OnChanges { /** * Apply CoreExternalContentDirective to a certain element. * - * @param {HTMLElement} element Element to add the attributes to. - * @return {CoreExternalContentDirective} External content instance. + * @param element Element to add the attributes to. + * @return External content instance. */ protected addExternalContent(element: HTMLElement): CoreExternalContentDirective { // Angular 2 doesn't let adding directives dynamically. Create the CoreExternalContentDirective manually. @@ -113,7 +112,7 @@ export class CoreFormatTextDirective implements OnChanges { /** * Add class to adapt media to a certain element. * - * @param {HTMLElement} element Element to add the class to. + * @param element Element to add the class to. */ protected addMediaAdaptClass(element: HTMLElement): void { element.classList.add('core-media-adapt-width'); @@ -122,7 +121,7 @@ export class CoreFormatTextDirective implements OnChanges { /** * Wrap an image with a container to adapt its width. * - * @param {HTMLElement} img Image to adapt. + * @param img Image to adapt. */ protected adaptImage(img: HTMLElement): void { // Element to wrap the image. @@ -251,7 +250,7 @@ export class CoreFormatTextDirective implements OnChanges { /** * Listener to call when the element is clicked. * - * @param {MouseEvent} e Click event. + * @param e Click event. */ protected elementClicked(e: MouseEvent): void { if (e.defaultPrevented) { @@ -352,7 +351,7 @@ export class CoreFormatTextDirective implements OnChanges { /** * Apply formatText and set sub-directives. * - * @return {Promise} Promise resolved with a div element containing the code. + * @return Promise resolved with a div element containing the code. */ protected formatContents(): Promise { @@ -497,8 +496,8 @@ export class CoreFormatTextDirective implements OnChanges { /** * Returns the element width in pixels. * - * @param {HTMLElement} element Element to get width from. - * @return {number} The width of the element in pixels. When 0 is returned it means the element is not visible. + * @param element Element to get width from. + * @return The width of the element in pixels. When 0 is returned it means the element is not visible. */ protected getElementWidth(element: HTMLElement): number { let width = this.domUtils.getElementWidth(element); @@ -526,8 +525,8 @@ export class CoreFormatTextDirective implements OnChanges { /** * Returns the element height in pixels. * - * @param {HTMLElement} elementAng Element to get height from. - * @return {number} The height of the element in pixels. When 0 is returned it means the element is not visible. + * @param elementAng Element to get height from. + * @return The height of the element in pixels. When 0 is returned it means the element is not visible. */ protected getElementHeight(element: HTMLElement): number { return this.domUtils.getElementHeight(element) || 0; @@ -553,8 +552,8 @@ export class CoreFormatTextDirective implements OnChanges { /** * Treat video filters. Currently only treating youtube video using video JS. * - * @param {HTMLElement} el Video element. - * @param {NavController} navCtrl NavController to use. + * @param el Video element. + * @param navCtrl NavController to use. */ protected treatVideoFilters(video: HTMLElement, navCtrl: NavController): void { // Treat Video JS Youtube video links and translate them to iframes. @@ -587,7 +586,7 @@ export class CoreFormatTextDirective implements OnChanges { /** * Add media adapt class and apply CoreExternalContentDirective to the media element and its sources and tracks. * - * @param {HTMLElement} element Video or audio to treat. + * @param element Video or audio to treat. */ protected treatMedia(element: HTMLElement): void { this.addMediaAdaptClass(element); @@ -615,10 +614,10 @@ export class CoreFormatTextDirective implements OnChanges { /** * Add media adapt class and treat the iframe source. * - * @param {HTMLIFrameElement} iframe Iframe to treat. - * @param {CoreSite} site Site instance. - * @param {boolean} canTreatVimeo Whether Vimeo videos can be treated in the site. - * @param {NavController} navCtrl NavController to use. + * @param iframe Iframe to treat. + * @param site Site instance. + * @param canTreatVimeo Whether Vimeo videos can be treated in the site. + * @param navCtrl NavController to use. */ protected treatIframe(iframe: HTMLIFrameElement, site: CoreSite, canTreatVimeo: boolean, navCtrl: NavController): void { const src = iframe.src, @@ -699,7 +698,7 @@ export class CoreFormatTextDirective implements OnChanges { * Parse a YouTube URL. * Based on Youtube.parseUrl from Moodle media/player/videojs/amd/src/Youtube-lazy.js * - * @param {string} url URL of the video. + * @param url URL of the video. */ protected parseYoutubeUrl(url: string): {videoId: string, listId?: string, start?: number} { const result = { diff --git a/src/directives/link.ts b/src/directives/link.ts index a10f69fde..53ac98f78 100644 --- a/src/directives/link.ts +++ b/src/directives/link.ts @@ -87,7 +87,7 @@ export class CoreLinkDirective implements OnInit { /** * Convenience function to correctly navigate, open file or url in the browser. * - * @param {string} href HREF to be opened. + * @param href HREF to be opened. */ protected navigate(href: string): void { const contentLinksScheme = CoreConfigConstants.customurlscheme + '://link='; diff --git a/src/directives/supress-events.ts b/src/directives/supress-events.ts index 88bfc891b..5c35bb8f2 100644 --- a/src/directives/supress-events.ts +++ b/src/directives/supress-events.ts @@ -86,7 +86,7 @@ export class CoreSupressEventsDirective implements OnInit { /** * Stop event default and propagation. * - * @param {Event} event Event. + * @param event Event. */ protected stopBubble(event: Event): void { event.preventDefault(); diff --git a/src/pipes/bytes-to-size.ts b/src/pipes/bytes-to-size.ts index 6e2d07127..620e1782f 100644 --- a/src/pipes/bytes-to-size.ts +++ b/src/pipes/bytes-to-size.ts @@ -32,8 +32,8 @@ export class CoreBytesToSizePipe implements PipeTransform { /** * Takes a number and turns it to a human readable size. * - * @param {number|string} value The bytes to convert. - * @return {string} Readable bytes. + * @param value The bytes to convert. + * @return Readable bytes. */ transform(value: number | string): string { if (typeof value == 'string') { diff --git a/src/pipes/create-links.ts b/src/pipes/create-links.ts index 35bb659d5..b7a5453e4 100644 --- a/src/pipes/create-links.ts +++ b/src/pipes/create-links.ts @@ -26,8 +26,8 @@ export class CoreCreateLinksPipe implements PipeTransform { /** * Takes some text and adds anchor tags to all links that aren't inside anchors. * - * @param {string} text Text to treat. - * @return {string} Treated text. + * @param text Text to treat. + * @return Treated text. */ transform(text: string): string { return text.replace(this.replacePattern, '$1'); diff --git a/src/pipes/date-day-or-time.ts b/src/pipes/date-day-or-time.ts index ae1da2238..ed90d1193 100644 --- a/src/pipes/date-day-or-time.ts +++ b/src/pipes/date-day-or-time.ts @@ -44,8 +44,8 @@ export class CoreDateDayOrTimePipe implements PipeTransform { /** * Format a timestamp. * - * @param {number|string} timestamp The UNIX timestamp (without milliseconds). - * @return {string} Formatted time. + * @param timestamp The UNIX timestamp (without milliseconds). + * @return Formatted time. */ transform(timestamp: string | number): string { if (typeof timestamp == 'string') { diff --git a/src/pipes/duration.ts b/src/pipes/duration.ts index 7e2f03b5b..4be29d433 100644 --- a/src/pipes/duration.ts +++ b/src/pipes/duration.ts @@ -32,8 +32,8 @@ export class CoreDurationPipe implements PipeTransform { /** * Turn a number of seconds to a duration. E.g. 60 -> 1 minute. * - * @param {number|string} seconds The number of seconds. - * @return {string} Formatted duration. + * @param seconds The number of seconds. + * @return Formatted duration. */ transform(seconds: string | number): string { if (typeof seconds == 'string') { diff --git a/src/pipes/format-date.ts b/src/pipes/format-date.ts index f255d4716..e01f62645 100644 --- a/src/pipes/format-date.ts +++ b/src/pipes/format-date.ts @@ -32,11 +32,11 @@ export class CoreFormatDatePipe implements PipeTransform { /** * Format a date. * - * @param {string|number} timestamp Timestamp to format (in milliseconds). If not defined, use current time. - * @param {string} [format] Format to use. It should be a string code to handle i18n (e.g. core.strftimetime). - * Defaults to strftimedaydatetime. - * @param {boolean} [convert] If true, convert the format from PHP to Moment. Set it to false for Moment formats. - * @return {string} Formatted date. + * @param timestamp Timestamp to format (in milliseconds). If not defined, use current time. + * @param format Format to use. It should be a string code to handle i18n (e.g. core.strftimetime). + * Defaults to strftimedaydatetime. + * @param convert If true, convert the format from PHP to Moment. Set it to false for Moment formats. + * @return Formatted date. */ transform(timestamp: string | number, format?: string, convert?: boolean): string { timestamp = timestamp || Date.now(); diff --git a/src/pipes/no-tags.ts b/src/pipes/no-tags.ts index 921241ac4..cc415e720 100644 --- a/src/pipes/no-tags.ts +++ b/src/pipes/no-tags.ts @@ -25,8 +25,8 @@ export class CoreNoTagsPipe implements PipeTransform { /** * Takes a text and removes HTML tags. * - * @param {string} text The text to treat. - * @return {string} Treated text. + * @param text The text to treat. + * @return Treated text. */ transform(text: string): string { return text.replace(/(<([^>]+)>)/ig, ''); diff --git a/src/pipes/seconds-to-hms.ts b/src/pipes/seconds-to-hms.ts index dd71624d6..dd2913936 100644 --- a/src/pipes/seconds-to-hms.ts +++ b/src/pipes/seconds-to-hms.ts @@ -35,8 +35,8 @@ export class CoreSecondsToHMSPipe implements PipeTransform { /** * Convert a number of seconds to Hours:Minutes:Seconds. * - * @param {number|string} seconds Number of seconds. - * @return {string} Formatted seconds. + * @param seconds Number of seconds. + * @return Formatted seconds. */ transform(seconds: string | number): string { let hours, diff --git a/src/pipes/time-ago.ts b/src/pipes/time-ago.ts index bef10d8f0..cbb67e3df 100644 --- a/src/pipes/time-ago.ts +++ b/src/pipes/time-ago.ts @@ -33,8 +33,8 @@ export class CoreTimeAgoPipe implements PipeTransform { /** * Turn a UNIX timestamp to "time ago". * - * @param {number|string} timestamp The UNIX timestamp (without milliseconds). - * @return {string} Formatted time. + * @param timestamp The UNIX timestamp (without milliseconds). + * @return Formatted time. */ transform(timestamp: string | number): string { if (typeof timestamp == 'string') { diff --git a/src/pipes/to-locale-string.ts b/src/pipes/to-locale-string.ts index 2bc2bae49..be74e7f64 100644 --- a/src/pipes/to-locale-string.ts +++ b/src/pipes/to-locale-string.ts @@ -33,8 +33,8 @@ export class CoreToLocaleStringPipe implements PipeTransform { /** * Format a timestamp to a locale string. * - * @param {number|string} timestamp The timestamp (can be in seconds or milliseconds). - * @return {string} Formatted time. + * @param timestamp The timestamp (can be in seconds or milliseconds). + * @return Formatted time. */ transform(timestamp: number | string): string { if (typeof timestamp == 'string') { diff --git a/src/providers/app.ts b/src/providers/app.ts index abbf4dd9f..5e9336eb7 100644 --- a/src/providers/app.ts +++ b/src/providers/app.ts @@ -30,25 +30,21 @@ import { CoreConfigConstants } from '../configconstants'; export interface CoreRedirectData { /** * ID of the site to load. - * @type {string} */ siteId?: string; /** * Name of the page to redirect to. - * @type {string} */ page?: string; /** * Params to pass to the page. - * @type {any} */ params?: any; /** * Timestamp when this redirect was last modified. - * @type {number} */ timemodified?: number; } @@ -111,7 +107,7 @@ export class CoreAppProvider { /** * Check if the browser supports mediaDevices.getUserMedia. * - * @return {boolean} Whether the function is supported. + * @return Whether the function is supported. */ canGetUserMedia(): boolean { return !!(navigator && navigator.mediaDevices && navigator.mediaDevices.getUserMedia); @@ -120,7 +116,7 @@ export class CoreAppProvider { /** * Check if the browser supports MediaRecorder. * - * @return {boolean} Whether the function is supported. + * @return Whether the function is supported. */ canRecordMedia(): boolean { return !!( window).MediaRecorder; @@ -138,7 +134,7 @@ export class CoreAppProvider { /** * Get the application global database. * - * @return {SQLiteDB} App's DB. + * @return App's DB. */ getDB(): SQLiteDB { return this.db; @@ -147,7 +143,7 @@ export class CoreAppProvider { /** * Get an ID for a main menu. * - * @return {number} Main menu ID. + * @return Main menu ID. */ getMainMenuId(): number { return this.mainMenuId++; @@ -156,7 +152,7 @@ export class CoreAppProvider { /** * Get the app's root NavController. * - * @return {NavController} Root NavController. + * @return Root NavController. */ getRootNavController(): NavController { // Function getRootNav is deprecated. Get the first root nav, there should always be one. @@ -166,7 +162,7 @@ export class CoreAppProvider { /** * Checks if the app is running in a 64 bits desktop environment (not browser). * - * @return {boolean} Whether the app is running in a 64 bits desktop environment (not browser). + * @return Whether the app is running in a 64 bits desktop environment (not browser). */ is64Bits(): boolean { const process = ( window).process; @@ -177,7 +173,7 @@ export class CoreAppProvider { /** * Checks if the app is running in a desktop environment (not browser). * - * @return {boolean} Whether the app is running in a desktop environment (not browser). + * @return Whether the app is running in a desktop environment (not browser). */ isDesktop(): boolean { const process = ( window).process; @@ -188,7 +184,7 @@ export class CoreAppProvider { /** * Check if the keyboard is visible. * - * @return {boolean} Whether keyboard is visible. + * @return Whether keyboard is visible. */ isKeyboardVisible(): boolean { return this.isKeyboardShown; @@ -197,7 +193,7 @@ export class CoreAppProvider { /** * Check if the app is running in a Linux environment. * - * @return {boolean} Whether it's running in a Linux environment. + * @return Whether it's running in a Linux environment. */ isLinux(): boolean { if (!this.isDesktop()) { @@ -214,7 +210,7 @@ export class CoreAppProvider { /** * Check if the app is running in a Mac OS environment. * - * @return {boolean} Whether it's running in a Mac OS environment. + * @return Whether it's running in a Mac OS environment. */ isMac(): boolean { if (!this.isDesktop()) { @@ -231,7 +227,7 @@ export class CoreAppProvider { /** * Check if the main menu is open. * - * @return {boolean} Whether the main menu is open. + * @return Whether the main menu is open. */ isMainMenuOpen(): boolean { return typeof this.mainMenuOpen != 'undefined'; @@ -240,7 +236,7 @@ export class CoreAppProvider { /** * Checks if the app is running in a mobile or tablet device (Cordova). * - * @return {boolean} Whether the app is running in a mobile or tablet device. + * @return Whether the app is running in a mobile or tablet device. */ isMobile(): boolean { return this.platform.is('cordova'); @@ -249,7 +245,7 @@ export class CoreAppProvider { /** * Checks if the current window is wider than a mobile. * - * @return {boolean} Whether the app the current window is wider than a mobile. + * @return Whether the app the current window is wider than a mobile. */ isWide(): boolean { return this.platform.width() > 768; @@ -258,7 +254,7 @@ export class CoreAppProvider { /** * Returns whether we are online. * - * @return {boolean} Whether the app is online. + * @return Whether the app is online. */ isOnline(): boolean { if (this.forceOffline) { @@ -277,7 +273,7 @@ export class CoreAppProvider { /** * Check if device uses a limited connection. * - * @return {boolean} Whether the device uses a limited connection. + * @return Whether the device uses a limited connection. */ isNetworkAccessLimited(): boolean { const type = this.network.type; @@ -294,7 +290,7 @@ export class CoreAppProvider { /** * Check if device uses a wifi connection. * - * @return {boolean} Whether the device uses a wifi connection. + * @return Whether the device uses a wifi connection. */ isWifi(): boolean { return this.isOnline() && !this.isNetworkAccessLimited(); @@ -303,7 +299,7 @@ export class CoreAppProvider { /** * Check if the app is running in a Windows environment. * - * @return {boolean} Whether it's running in a Windows environment. + * @return Whether it's running in a Windows environment. */ isWindows(): boolean { if (!this.isDesktop()) { @@ -330,8 +326,8 @@ export class CoreAppProvider { /** * Set a main menu as open or not. * - * @param {number} id Main menu ID. - * @param {boolean} open Whether it's open or not. + * @param id Main menu ID. + * @param open Whether it's open or not. */ setMainMenuOpen(id: number, open: boolean): void { if (open) { @@ -382,7 +378,7 @@ export class CoreAppProvider { /** * Check if there's an ongoing SSO authentication process. * - * @return {boolean} Whether there's a SSO authentication ongoing. + * @return Whether there's a SSO authentication ongoing. */ isSSOAuthenticationOngoing(): boolean { return !!this.ssoAuthenticationPromise; @@ -391,7 +387,7 @@ export class CoreAppProvider { /** * Returns a promise that will be resolved once SSO authentication finishes. * - * @return {Promise} Promise resolved once SSO authentication finishes. + * @return Promise resolved once SSO authentication finishes. */ waitForSSOAuthentication(): Promise { return this.ssoAuthenticationPromise || Promise.resolve(); @@ -400,7 +396,7 @@ export class CoreAppProvider { /** * Retrieve redirect data. * - * @return {CoreRedirectData} Object with siteid, state, params and timemodified. + * @return Object with siteid, state, params and timemodified. */ getRedirect(): CoreRedirectData { if (localStorage && localStorage.getItem) { @@ -428,9 +424,9 @@ export class CoreAppProvider { /** * Store redirect params. * - * @param {string} siteId Site ID. - * @param {string} page Page to go. - * @param {any} params Page params. + * @param siteId Site ID. + * @param page Page to go. + * @param params Page params. */ storeRedirect(siteId: string, page: string, params: any): void { if (localStorage && localStorage.setItem) { @@ -511,14 +507,14 @@ export class CoreAppProvider { * button is pressed. This method decides which of the registered back button * actions has the highest priority and should be called. * - * @param {Function} fn Called when the back button is pressed, - * if this registered action has the highest priority. - * @param {number} priority Set the priority for this action. All actions sorted by priority will be executed since one of - * them returns true. - * * Priorities higher or equal than 1000 will go before closing modals - * * Priorities lower than 500 will only be executed if you are in the first state of the app (before exit). - * @returns {Function} A function that, when called, will unregister - * the back button action. + * @param fn Called when the back button is pressed, + * if this registered action has the highest priority. + * @param priority Set the priority for this action. All actions sorted by priority will be executed since one of + * them returns true. + * * Priorities higher or equal than 1000 will go before closing modals + * * Priorities lower than 500 will only be executed if you are in the first state of the app (before exit). + * @return A function that, when called, will unregister + * the back button action. */ registerBackButtonAction(fn: Function, priority: number = 0): Function { const action = { fn: fn, priority: priority }; @@ -579,7 +575,7 @@ export class CoreAppProvider { /** * Set value of forceOffline flag. If true, the app will think the device is offline. * - * @param {boolean} value Value to set. + * @param value Value to set. */ setForceOffline(value: boolean): void { this.forceOffline = !!value; diff --git a/src/providers/config.ts b/src/providers/config.ts index e368c073b..f5f42b573 100644 --- a/src/providers/config.ts +++ b/src/providers/config.ts @@ -47,8 +47,8 @@ export class CoreConfigProvider { /** * Deletes an app setting. * - * @param {string} name The config name. - * @return {Promise} Promise resolved when done. + * @param name The config name. + * @return Promise resolved when done. */ delete(name: string): Promise { return this.appDB.deleteRecords(this.TABLE_NAME, { name: name }); @@ -57,9 +57,9 @@ export class CoreConfigProvider { /** * Get an app setting. * - * @param {string} name The config name. - * @param {any} [defaultValue] Default value to use if the entry is not found. - * @return {Promise} Resolves upon success along with the config data. Reject on failure. + * @param name The config name. + * @param defaultValue Default value to use if the entry is not found. + * @return Resolves upon success along with the config data. Reject on failure. */ get(name: string, defaultValue?: any): Promise { return this.appDB.getRecord(this.TABLE_NAME, { name: name }).then((entry) => { @@ -76,9 +76,9 @@ export class CoreConfigProvider { /** * Set an app setting. * - * @param {string} name The config name. - * @param {number|string} value The config value. Can only store number or strings. - * @return {Promise} Promise resolved when done. + * @param name The config name. + * @param value The config value. Can only store number or strings. + * @return Promise resolved when done. */ set(name: string, value: number | string): Promise { return this.appDB.insertRecord(this.TABLE_NAME, { name: name, value: value }); diff --git a/src/providers/cron.ts b/src/providers/cron.ts index b29bc654f..0970f12e0 100644 --- a/src/providers/cron.ts +++ b/src/providers/cron.ts @@ -27,57 +27,54 @@ import { SQLiteDB, SQLiteDBTableSchema } from '@classes/sqlitedb'; export interface CoreCronHandler { /** * A name to identify the handler. - * @type {string} */ name: string; /** * Returns handler's interval in milliseconds. Defaults to CoreCronDelegate.DEFAULT_INTERVAL. * - * @return {number} Interval time (in milliseconds). + * @return Interval time (in milliseconds). */ getInterval?(): number; /** * Check whether the process uses network or not. True if not defined. * - * @return {boolean} Whether the process uses network or not + * @return Whether the process uses network or not */ usesNetwork?(): boolean; /** * Check whether it's a synchronization process or not. True if not defined. * - * @return {boolean} Whether it's a synchronization process or not. + * @return Whether it's a synchronization process or not. */ isSync?(): boolean; /** * Check whether the sync can be executed manually. Call isSync if not defined. * - * @return {boolean} Whether the sync can be executed manually. + * @return Whether the sync can be executed manually. */ canManualSync?(): boolean; /** * Execute the process. * - * @param {string} [siteId] ID of the site affected. If not defined, all sites. - * @param {boolean} [force] Determines if it's a forced execution. - * @return {Promise} Promise resolved when done. If the promise is rejected, this function will be called again often, - * it shouldn't be abused. + * @param siteId ID of the site affected. If not defined, all sites. + * @param force Determines if it's a forced execution. + * @return Promise resolved when done. If the promise is rejected, this function will be called again often, + * it shouldn't be abused. */ execute?(siteId?: string, force?: boolean): Promise; /** * Whether the handler is running. Used internally by the provider, there's no need to set it. - * @type {boolean} */ running?: boolean; /** * Timeout ID for the handler scheduling. Used internally by the provider, there's no need to set it. - * @type {number} */ timeout?: number; } @@ -135,10 +132,10 @@ export class CoreCronDelegate { * Try to execute a handler. It will schedule the next execution once done. * If the handler cannot be executed or it fails, it will be re-executed after mmCoreCronMinInterval. * - * @param {string} name Name of the handler. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @param {string} [siteId] Site ID. If not defined, all sites. - * @return {Promise} Promise resolved if handler is executed successfully, rejected otherwise. + * @param name Name of the handler. + * @param force Wether the execution is forced (manual sync). + * @param siteId Site ID. If not defined, all sites. + * @return Promise resolved if handler is executed successfully, rejected otherwise. */ protected checkAndExecuteHandler(name: string, force?: boolean, siteId?: string): Promise { if (!this.handlers[name] || !this.handlers[name].execute) { @@ -204,10 +201,10 @@ export class CoreCronDelegate { /** * Run a handler, cancelling the execution if it takes more than MAX_TIME_PROCESS. * - * @param {string} name Name of the handler. - * @param {boolean} [force] Wether the execution is forced (manual sync). - * @param {string} [siteId] Site ID. If not defined, all sites. - * @return {Promise} Promise resolved when the handler finishes or reaches max time, rejected if it fails. + * @param name Name of the handler. + * @param force Wether the execution is forced (manual sync). + * @param siteId Site ID. If not defined, all sites. + * @return Promise resolved when the handler finishes or reaches max time, rejected if it fails. */ protected executeHandler(name: string, force?: boolean, siteId?: string): Promise { return new Promise((resolve, reject): void => { @@ -232,8 +229,8 @@ export class CoreCronDelegate { * Force execution of synchronization cron tasks without waiting for the scheduled time. * Please notice that some tasks may not be executed depending on the network connection and sync settings. * - * @param {string} [siteId] Site ID. If not defined, all sites. - * @return {Promise} Promise resolved if all handlers are executed successfully, rejected otherwise. + * @param siteId Site ID. If not defined, all sites. + * @return Promise resolved if all handlers are executed successfully, rejected otherwise. */ forceSyncExecution(siteId?: string): Promise { const promises = []; @@ -252,9 +249,9 @@ export class CoreCronDelegate { * Force execution of a cron tasks without waiting for the scheduled time. * Please notice that some tasks may not be executed depending on the network connection and sync settings. * - * @param {string} [name] If provided, the name of the handler. - * @param {string} [siteId] Site ID. If not defined, all sites. - * @return {Promise} Promise resolved if handler has been executed successfully, rejected otherwise. + * @param name If provided, the name of the handler. + * @param siteId Site ID. If not defined, all sites. + * @return Promise resolved if handler has been executed successfully, rejected otherwise. */ forceCronHandlerExecution(name?: string, siteId?: string): Promise { const handler = this.handlers[name]; @@ -273,8 +270,8 @@ export class CoreCronDelegate { /** * Get a handler's interval. * - * @param {string} name Handler's name. - * @return {number} Handler's interval. + * @param name Handler's name. + * @return Handler's interval. */ protected getHandlerInterval(name: string): number { if (!this.handlers[name] || !this.handlers[name].getInterval) { @@ -296,8 +293,8 @@ export class CoreCronDelegate { /** * Get a handler's last execution ID. * - * @param {string} name Handler's name. - * @return {string} Handler's last execution ID. + * @param name Handler's name. + * @return Handler's last execution ID. */ protected getHandlerLastExecutionId(name: string): string { return 'last_execution_' + name; @@ -306,8 +303,8 @@ export class CoreCronDelegate { /** * Get a handler's last execution time. If not defined, return 0. * - * @param {string} name Handler's name. - * @return {Promise} Promise resolved with the handler's last execution time. + * @param name Handler's name. + * @return Promise resolved with the handler's last execution time. */ protected getHandlerLastExecutionTime(name: string): Promise { const id = this.getHandlerLastExecutionId(name); @@ -324,8 +321,8 @@ export class CoreCronDelegate { /** * Check if a handler uses network. Defaults to true. * - * @param {string} name Handler's name. - * @return {boolean} True if handler uses network or not defined, false otherwise. + * @param name Handler's name. + * @return True if handler uses network or not defined, false otherwise. */ protected handlerUsesNetwork(name: string): boolean { if (!this.handlers[name] || !this.handlers[name].usesNetwork) { @@ -339,7 +336,7 @@ export class CoreCronDelegate { /** * Check if there is any manual sync handler registered. * - * @return {boolean} Whether it has at least 1 manual sync handler. + * @return Whether it has at least 1 manual sync handler. */ hasManualSyncHandlers(): boolean { for (const name in this.handlers) { @@ -354,7 +351,7 @@ export class CoreCronDelegate { /** * Check if there is any sync handler registered. * - * @return {boolean} Whether it has at least 1 sync handler. + * @return Whether it has at least 1 sync handler. */ hasSyncHandlers(): boolean { for (const name in this.handlers) { @@ -369,8 +366,8 @@ export class CoreCronDelegate { /** * Check if a handler can be manually synced. Defaults will use isSync instead. * - * @param {string} name Handler's name. - * @return {boolean} True if handler is a sync process and can be manually executed or not defined, false otherwise. + * @param name Handler's name. + * @return True if handler is a sync process and can be manually executed or not defined, false otherwise. */ protected isHandlerManualSync(name: string): boolean { if (!this.handlers[name] || !this.handlers[name].canManualSync) { @@ -384,8 +381,8 @@ export class CoreCronDelegate { /** * Check if a handler is a sync process. Defaults to true. * - * @param {string} name Handler's name. - * @return {boolean} True if handler is a sync process or not defined, false otherwise. + * @param name Handler's name. + * @return True if handler is a sync process or not defined, false otherwise. */ protected isHandlerSync(name: string): boolean { if (!this.handlers[name] || !this.handlers[name].isSync) { @@ -399,7 +396,7 @@ export class CoreCronDelegate { /** * Register a handler to be executed every certain time. * - * @param {CoreCronHandler} handler The handler to register. + * @param handler The handler to register. */ register(handler: CoreCronHandler): void { if (!handler || !handler.name) { @@ -424,9 +421,9 @@ export class CoreCronDelegate { /** * Schedule a next execution for a handler. * - * @param {string} name Name of the handler. - * @param {number} [time] Time to the next execution. If not supplied it will be calculated using the last execution and - * the handler's interval. This param should be used only if it's really necessary. + * @param name Name of the handler. + * @param time Time to the next execution. If not supplied it will be calculated using the last execution and + * the handler's interval. This param should be used only if it's really necessary. */ protected scheduleNextExecution(name: string, time?: number): void { if (!this.handlers[name]) { @@ -470,9 +467,9 @@ export class CoreCronDelegate { /** * Set a handler's last execution time. * - * @param {string} name Handler's name. - * @param {number} time Time to set. - * @return {Promise} Promise resolved when the execution time is saved. + * @param name Handler's name. + * @param time Time to set. + * @return Promise resolved when the execution time is saved. */ protected setHandlerLastExecutionTime(name: string, time: number): Promise { const id = this.getHandlerLastExecutionId(name), @@ -487,7 +484,7 @@ export class CoreCronDelegate { /** * Start running a handler periodically. * - * @param {string} name Name of the handler. + * @param name Name of the handler. */ protected startHandler(name: string): void { if (!this.handlers[name]) { @@ -522,7 +519,7 @@ export class CoreCronDelegate { /** * Stop running a handler periodically. * - * @param {string} name Name of the handler. + * @param name Name of the handler. */ protected stopHandler(name: string): void { if (!this.handlers[name]) { diff --git a/src/providers/db.ts b/src/providers/db.ts index e1007fa27..20c94218e 100644 --- a/src/providers/db.ts +++ b/src/providers/db.ts @@ -33,9 +33,9 @@ export class CoreDbProvider { * * The database objects are cached statically. * - * @param {string} name DB name. - * @param {boolean} forceNew True if it should always create a new instance. - * @return {SQLiteDB} DB. + * @param name DB name. + * @param forceNew True if it should always create a new instance. + * @return DB. */ getDB(name: string, forceNew?: boolean): SQLiteDB { if (typeof this.dbInstances[name] === 'undefined' || forceNew) { @@ -52,8 +52,8 @@ export class CoreDbProvider { /** * Delete a DB. * - * @param {string} name DB name. - * @return {Promise} Promise resolved when the DB is deleted. + * @param name DB name. + * @return Promise resolved when the DB is deleted. */ deleteDB(name: string): Promise { let promise; diff --git a/src/providers/events.ts b/src/providers/events.ts index 48f3dcf32..243d4a3d4 100644 --- a/src/providers/events.ts +++ b/src/providers/events.ts @@ -77,10 +77,10 @@ export class CoreEventsProvider { * ... * observer.off(); * - * @param {string} eventName Name of the event to listen to. - * @param {Function} callBack Function to call when the event is triggered. - * @param {string} [siteId] Site where to trigger the event. Undefined won't check the site. - * @return {CoreEventObserver} Observer to stop listening. + * @param eventName Name of the event to listen to. + * @param callBack Function to call when the event is triggered. + * @param siteId Site where to trigger the event. Undefined won't check the site. + * @return Observer to stop listening. */ on(eventName: string, callBack: (value: any) => void, siteId?: string): CoreEventObserver { // If it's a unique event and has been triggered already, call the callBack. @@ -121,9 +121,9 @@ export class CoreEventsProvider { /** * Triggers an event, notifying all the observers. * - * @param {string} event Name of the event to trigger. - * @param {any} [data] Data to pass to the observers. - * @param {string} [siteId] Site where to trigger the event. Undefined means no Site. + * @param event Name of the event to trigger. + * @param data Data to pass to the observers. + * @param siteId Site where to trigger the event. Undefined means no Site. */ trigger(eventName: string, data?: any, siteId?: string): void { this.logger.debug(`Event '${eventName}' triggered.`); @@ -141,9 +141,9 @@ export class CoreEventsProvider { /** * Triggers a unique event, notifying all the observers. If the event has already been triggered, don't do anything. * - * @param {string} event Name of the event to trigger. - * @param {any} data Data to pass to the observers. - * @param {string} [siteId] Site where to trigger the event. Undefined means no Site. + * @param event Name of the event to trigger. + * @param data Data to pass to the observers. + * @param siteId Site where to trigger the event. Undefined means no Site. */ triggerUnique(eventName: string, data: any, siteId?: string): void { if (this.uniqueEvents[eventName]) { diff --git a/src/providers/file-helper.ts b/src/providers/file-helper.ts index 0260eb610..91b91c8c8 100644 --- a/src/providers/file-helper.ts +++ b/src/providers/file-helper.ts @@ -34,13 +34,13 @@ export class CoreFileHelperProvider { /** * Convenience function to open a file, downloading it if needed. * - * @param {any} file The file to download. - * @param {string} [component] The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {string} [state] The file's state. If not provided, it will be calculated. - * @param {Function} [onProgress] Function to call on progress. - * @param {string} [siteId] The site ID. If not defined, current site. - * @return {Promise} Resolved on success. + * @param file The file to download. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component. + * @param state The file's state. If not provided, it will be calculated. + * @param onProgress Function to call on progress. + * @param siteId The site ID. If not defined, current site. + * @return Resolved on success. */ downloadAndOpenFile(file: any, component: string, componentId: string | number, state?: string, onProgress?: (event: any) => any, siteId?: string): Promise { @@ -104,15 +104,15 @@ export class CoreFileHelperProvider { /** * Download a file if it needs to be downloaded. * - * @param {any} file The file to download. - * @param {string} fileUrl The file URL. - * @param {string} [component] The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {number} [timemodified] The time this file was modified. - * @param {string} [state] The file's state. If not provided, it will be calculated. - * @param {Function} [onProgress] Function to call on progress. - * @param {string} [siteId] The site ID. If not defined, current site. - * @return {Promise} Resolved with the URL to use on success. + * @param file The file to download. + * @param fileUrl The file URL. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component. + * @param timemodified The time this file was modified. + * @param state The file's state. If not provided, it will be calculated. + * @param onProgress Function to call on progress. + * @param siteId The site ID. If not defined, current site. + * @return Resolved with the URL to use on success. */ protected downloadFileIfNeeded(file: any, fileUrl: string, component?: string, componentId?: string | number, timemodified?: number, state?: string, onProgress?: (event: any) => any, siteId?: string): Promise { @@ -185,14 +185,14 @@ export class CoreFileHelperProvider { /** * Download the file. * - * @param {string} fileUrl The file URL. - * @param {string} [component] The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {number} [timemodified] The time this file was modified. - * @param {Function} [onProgress] Function to call on progress. - * @param {any} [file] The file to download. - * @param {string} [siteId] The site ID. If not defined, current site. - * @return {Promise} Resolved with internal URL on success, rejected otherwise. + * @param fileUrl The file URL. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component. + * @param timemodified The time this file was modified. + * @param onProgress Function to call on progress. + * @param file The file to download. + * @param siteId The site ID. If not defined, current site. + * @return Resolved with internal URL on success, rejected otherwise. */ downloadFile(fileUrl: string, component?: string, componentId?: string | number, timemodified?: number, onProgress?: (event: any) => any, file?: any, siteId?: string): Promise { @@ -222,7 +222,7 @@ export class CoreFileHelperProvider { /** * Get the file's URL. * - * @param {any} file The file. + * @param file The file. */ getFileUrl(file: any): string { return file.fileurl || file.url; @@ -231,7 +231,7 @@ export class CoreFileHelperProvider { /** * Get the file's timemodified. * - * @param {any} file The file. + * @param file The file. */ getFileTimemodified(file: any): number { return file.timemodified || 0; @@ -240,7 +240,7 @@ export class CoreFileHelperProvider { /** * Check if a state is downloaded or outdated. * - * @param {string} state The state to check. + * @param state The state to check. */ isStateDownloaded(state: string): boolean { return state === CoreConstants.DOWNLOADED || state === CoreConstants.OUTDATED; @@ -250,8 +250,8 @@ export class CoreFileHelperProvider { * Whether the file has to be opened in browser (external repository). * The file must have a mimetype attribute. * - * @param {any} file The file to check. - * @return {boolean} Whether the file should be opened in browser. + * @param file The file to check. + * @return Whether the file should be opened in browser. */ shouldOpenInBrowser(file: any): boolean { if (!file || !file.isexternalfile || !file.mimetype) { diff --git a/src/providers/file-session.ts b/src/providers/file-session.ts index 8d35df55e..bd71659e3 100644 --- a/src/providers/file-session.ts +++ b/src/providers/file-session.ts @@ -31,10 +31,10 @@ export class CoreFileSessionProvider { /** * Add a file to the session. * - * @param {string} component Component Name. - * @param {string|number} id File area identifier. - * @param {any} file File to add. - * @param {string} [siteId] Site ID. If not defined, current site. + * @param component Component Name. + * @param id File area identifier. + * @param file File to add. + * @param siteId Site ID. If not defined, current site. */ addFile(component: string, id: string | number, file: any, siteId?: string): void { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -47,9 +47,9 @@ export class CoreFileSessionProvider { /** * Clear files stored in session. * - * @param {string} component Component Name. - * @param {string|number} id File area identifier. - * @param {string} [siteId] Site ID. If not defined, current site. + * @param component Component Name. + * @param id File area identifier. + * @param siteId Site ID. If not defined, current site. */ clearFiles(component: string, id: string | number, siteId?: string): void { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -61,10 +61,10 @@ export class CoreFileSessionProvider { /** * Get files stored in session. * - * @param {string} component Component Name. - * @param {string|number} id File area identifier. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {any[]} Array of files in session. + * @param component Component Name. + * @param id File area identifier. + * @param siteId Site ID. If not defined, current site. + * @return Array of files in session. */ getFiles(component: string, id: string | number, siteId?: string): any[] { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -78,9 +78,9 @@ export class CoreFileSessionProvider { /** * Initializes the filearea to store the file. * - * @param {string} component Component Name. - * @param {string|number} id File area identifier. - * @param {string} [siteId] Site ID. If not defined, current site. + * @param component Component Name. + * @param id File area identifier. + * @param siteId Site ID. If not defined, current site. */ protected initFileArea(component: string, id: string | number, siteId?: string): void { if (!this.files[siteId]) { @@ -99,10 +99,10 @@ export class CoreFileSessionProvider { /** * Remove a file stored in session. * - * @param {string} component Component Name. - * @param {string|number} id File area identifier. - * @param {any} file File to remove. The instance should be exactly the same as the one stored in session. - * @param {string} [siteId] Site ID. If not defined, current site. + * @param component Component Name. + * @param id File area identifier. + * @param file File to remove. The instance should be exactly the same as the one stored in session. + * @param siteId Site ID. If not defined, current site. */ removeFile(component: string, id: string | number, file: any, siteId?: string): void { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -117,10 +117,10 @@ export class CoreFileSessionProvider { /** * Remove a file stored in session. * - * @param {string} component Component Name. - * @param {string|number} id File area identifier. - * @param {number} index Position of the file to remove. - * @param {string} [siteId] Site ID. If not defined, current site. + * @param component Component Name. + * @param id File area identifier. + * @param index Position of the file to remove. + * @param siteId Site ID. If not defined, current site. */ removeFileByIndex(component: string, id: string | number, index: number, siteId?: string): void { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -133,10 +133,10 @@ export class CoreFileSessionProvider { /** * Set a group of files in the session. * - * @param {string} component Component Name. - * @param {string|number} id File area identifier. - * @param {any[]} newFiles Files to set. - * @param {string} [siteId] Site ID. If not defined, current site. + * @param component Component Name. + * @param id File area identifier. + * @param newFiles Files to set. + * @param siteId Site ID. If not defined, current site. */ setFiles(component: string, id: string | number, newFiles: any[], siteId?: string): void { siteId = siteId || this.sitesProvider.getCurrentSiteId(); diff --git a/src/providers/file.ts b/src/providers/file.ts index a2c53ceb1..916a2fb7c 100644 --- a/src/providers/file.ts +++ b/src/providers/file.ts @@ -28,19 +28,16 @@ import { Zip } from '@ionic-native/zip'; export interface CoreFileProgressEvent { /** * Whether the values are reliabñe. - * @type {boolean} */ lengthComputable?: boolean; /** * Number of treated bytes. - * @type {number} */ loaded?: number; /** * Total of bytes. - * @type {number} */ total?: number; } @@ -97,7 +94,7 @@ export class CoreFileProvider { /** * Define an event for FileReader. * - * @param {string} eventName Name of the event. + * @param eventName Name of the event. */ protected defineEvent(eventName: string): void { this.defineGetterSetter(FileReader.prototype, eventName, function(): any { @@ -110,10 +107,10 @@ export class CoreFileProvider { /** * Define a getter and, optionally, a setter for a certain property in an object. * - * @param {any} obj Object to set the getter/setter for. - * @param {string} key Name of the property where to set them. - * @param {Function} getFunc The getter function. - * @param {Function} [setFunc] The setter function. + * @param obj Object to set the getter/setter for. + * @param key Name of the property where to set them. + * @param getFunc The getter function. + * @param setFunc The setter function. */ protected defineGetterSetter(obj: any, key: string, getFunc: Function, setFunc?: Function): void { if (Object.defineProperty) { @@ -138,7 +135,7 @@ export class CoreFileProvider { /** * Sets basePath to use with HTML API. Reserved for core use. * - * @param {string} path Base path to use. + * @param path Base path to use. */ setHTMLBasePath(path: string): void { this.isHTMLAPI = true; @@ -148,7 +145,7 @@ export class CoreFileProvider { /** * Checks if we're using HTML API. * - * @return {boolean} True if uses HTML API, false otherwise. + * @return True if uses HTML API, false otherwise. */ usesHTMLAPI(): boolean { return this.isHTMLAPI; @@ -157,7 +154,7 @@ export class CoreFileProvider { /** * Initialize basePath based on the OS if it's not initialized already. * - * @return {Promise} Promise to be resolved when the initialization is finished. + * @return Promise to be resolved when the initialization is finished. */ init(): Promise { if (this.initialized) { @@ -184,7 +181,7 @@ export class CoreFileProvider { /** * Check if the plugin is available. * - * @return {boolean} Whether the plugin is available. + * @return Whether the plugin is available. */ isAvailable(): boolean { return typeof window.resolveLocalFileSystemURL !== 'undefined'; @@ -193,8 +190,8 @@ export class CoreFileProvider { /** * Get a file. * - * @param {string} path Relative path to the file. - * @return {Promise} Promise resolved when the file is retrieved. + * @param path Relative path to the file. + * @return Promise resolved when the file is retrieved. */ getFile(path: string): Promise { return this.init().then(() => { @@ -209,8 +206,8 @@ export class CoreFileProvider { /** * Get a directory. * - * @param {string} path Relative path to the directory. - * @return {Promise} Promise resolved when the directory is retrieved. + * @param path Relative path to the directory. + * @return Promise resolved when the directory is retrieved. */ getDir(path: string): Promise { return this.init().then(() => { @@ -223,8 +220,8 @@ export class CoreFileProvider { /** * Get site folder path. * - * @param {string} siteId Site ID. - * @return {string} Site folder path. + * @param siteId Site ID. + * @return Site folder path. */ getSiteFolder(siteId: string): string { return CoreFileProvider.SITESFOLDER + '/' + siteId; @@ -233,11 +230,11 @@ export class CoreFileProvider { /** * Create a directory or a file. * - * @param {boolean} isDirectory True if a directory should be created, false if it should create a file. - * @param {string} path Relative path to the dir/file. - * @param {boolean} [failIfExists] True if it should fail if the dir/file exists, false otherwise. - * @param {string} [base] Base path to create the dir/file in. If not set, use basePath. - * @return {Promise} Promise to be resolved when the dir/file is created. + * @param isDirectory True if a directory should be created, false if it should create a file. + * @param path Relative path to the dir/file. + * @param failIfExists True if it should fail if the dir/file exists, false otherwise. + * @param base Base path to create the dir/file in. If not set, use basePath. + * @return Promise to be resolved when the dir/file is created. */ protected create(isDirectory: boolean, path: string, failIfExists?: boolean, base?: string): Promise { return this.init().then(() => { @@ -277,9 +274,9 @@ export class CoreFileProvider { /** * Create a directory. * - * @param {string} path Relative path to the directory. - * @param {boolean} [failIfExists] True if it should fail if the directory exists, false otherwise. - * @return {Promise} Promise to be resolved when the directory is created. + * @param path Relative path to the directory. + * @param failIfExists True if it should fail if the directory exists, false otherwise. + * @return Promise to be resolved when the directory is created. */ createDir(path: string, failIfExists?: boolean): Promise { return this.create(true, path, failIfExists); @@ -288,9 +285,9 @@ export class CoreFileProvider { /** * Create a file. * - * @param {string} path Relative path to the file. - * @param {boolean} [failIfExists] True if it should fail if the file exists, false otherwise.. - * @return {Promise} Promise to be resolved when the file is created. + * @param path Relative path to the file. + * @param failIfExists True if it should fail if the file exists, false otherwise.. + * @return Promise to be resolved when the file is created. */ createFile(path: string, failIfExists?: boolean): Promise { return this.create(false, path, failIfExists); @@ -299,8 +296,8 @@ export class CoreFileProvider { /** * Removes a directory and all its contents. * - * @param {string} path Relative path to the directory. - * @return {Promise} Promise to be resolved when the directory is deleted. + * @param path Relative path to the directory. + * @return Promise to be resolved when the directory is deleted. */ removeDir(path: string): Promise { return this.init().then(() => { @@ -315,8 +312,8 @@ export class CoreFileProvider { /** * Removes a file and all its contents. * - * @param {string} path Relative path to the file. - * @return {Promise} Promise to be resolved when the file is deleted. + * @param path Relative path to the file. + * @return Promise to be resolved when the file is deleted. */ removeFile(path: string): Promise { return this.init().then(() => { @@ -340,8 +337,8 @@ export class CoreFileProvider { /** * Removes a file given its FileEntry. * - * @param {FileEntry} fileEntry File Entry. - * @return {Promise} Promise resolved when the file is deleted. + * @param fileEntry File Entry. + * @return Promise resolved when the file is deleted. */ removeFileByFileEntry(fileEntry: any): Promise { return new Promise((resolve, reject): void => { @@ -352,8 +349,8 @@ export class CoreFileProvider { /** * Retrieve the contents of a directory (not subdirectories). * - * @param {string} path Relative path to the directory. - * @return {Promise} Promise to be resolved when the contents are retrieved. + * @param path Relative path to the directory. + * @return Promise to be resolved when the contents are retrieved. */ getDirectoryContents(path: string): Promise { return this.init().then(() => { @@ -368,8 +365,8 @@ export class CoreFileProvider { /** * Calculate the size of a directory or a file. * - * @param {any} entry Directory or file. - * @return {Promise} Promise to be resolved when the size is calculated. + * @param entry Directory or file. + * @return Promise to be resolved when the size is calculated. */ protected getSize(entry: any): Promise { return new Promise((resolve, reject): void => { @@ -411,8 +408,8 @@ export class CoreFileProvider { /** * Calculate the size of a directory. * - * @param {string} path Relative path to the directory. - * @return {Promise} Promise to be resolved when the size is calculated. + * @param path Relative path to the directory. + * @return Promise to be resolved when the size is calculated. */ getDirectorySize(path: string): Promise { // Remove basePath if it's in the path. @@ -428,8 +425,8 @@ export class CoreFileProvider { /** * Calculate the size of a file. * - * @param {string} path Relative path to the file. - * @return {Promise} Promise to be resolved when the size is calculated. + * @param path Relative path to the file. + * @return Promise to be resolved when the size is calculated. */ getFileSize(path: string): Promise { // Remove basePath if it's in the path. @@ -445,8 +442,8 @@ export class CoreFileProvider { /** * Get file object from a FileEntry. * - * @param {FileEntry} path Relative path to the file. - * @return {Promise} Promise to be resolved when the file is retrieved. + * @param path Relative path to the file. + * @return Promise to be resolved when the file is retrieved. */ getFileObjectFromFileEntry(entry: FileEntry): Promise { return new Promise((resolve, reject): void => { @@ -459,7 +456,7 @@ export class CoreFileProvider { * Calculate the free space in the disk. * Please notice that this function isn't reliable and it's not documented in the Cordova File plugin. * - * @return {Promise} Promise resolved with the estimated free space in bytes. + * @return Promise resolved with the estimated free space in bytes. */ calculateFreeSpace(): Promise { return this.file.getFreeDiskSpace().then((size) => { @@ -476,8 +473,8 @@ export class CoreFileProvider { /** * Normalize a filename that usually comes URL encoded. * - * @param {string} filename The file name. - * @return {string} The file name normalized. + * @param filename The file name. + * @return The file name normalized. */ normalizeFileName(filename: string): string { filename = this.textUtils.decodeURIComponent(filename); @@ -488,13 +485,13 @@ export class CoreFileProvider { /** * Read a file from local file system. * - * @param {string} path Relative path to the file. - * @param {number} [format=FORMATTEXT] Format to read the file. Must be one of: - * FORMATTEXT - * FORMATDATAURL - * FORMATBINARYSTRING - * FORMATARRAYBUFFER - * @return {Promise} Promise to be resolved when the file is read. + * @param path Relative path to the file. + * @param format Format to read the file. Must be one of: + * FORMATTEXT + * FORMATDATAURL + * FORMATBINARYSTRING + * FORMATARRAYBUFFER + * @return Promise to be resolved when the file is read. */ readFile(path: string, format: number = CoreFileProvider.FORMATTEXT): Promise { // Remove basePath if it's in the path. @@ -516,13 +513,13 @@ export class CoreFileProvider { /** * Read file contents from a file data object. * - * @param {any} fileData File's data. - * @param {number} [format=FORMATTEXT] Format to read the file. Must be one of: - * FORMATTEXT - * FORMATDATAURL - * FORMATBINARYSTRING - * FORMATARRAYBUFFER - * @return {Promise} Promise to be resolved when the file is read. + * @param fileData File's data. + * @param format Format to read the file. Must be one of: + * FORMATTEXT + * FORMATDATAURL + * FORMATBINARYSTRING + * FORMATARRAYBUFFER + * @return Promise to be resolved when the file is read. */ readFileData(fileData: any, format: number = CoreFileProvider.FORMATTEXT): Promise { format = format || CoreFileProvider.FORMATTEXT; @@ -574,10 +571,10 @@ export class CoreFileProvider { /** * Writes some data in a file. * - * @param {string} path Relative path to the file. - * @param {any} data Data to write. - * @param {boolean} [append] Whether to append the data to the end of the file. - * @return {Promise} Promise to be resolved when the file is written. + * @param path Relative path to the file. + * @param data Data to write. + * @param append Whether to append the data to the end of the file. + * @return Promise to be resolved when the file is written. */ writeFile(path: string, data: any, append?: boolean): Promise { return this.init().then(() => { @@ -605,12 +602,12 @@ export class CoreFileProvider { * Write some file data into a filesystem file. * It's done in chunks to prevent crashing the app for big files. * - * @param {any} file The data to write. - * @param {string} path Path where to store the data. - * @param {Function} [onProgress] Function to call on progress. - * @param {number} [offset=0] Offset where to start reading from. - * @param {boolean} [append] Whether to append the data to the end of the file. - * @return {Promise} Promise resolved when done. + * @param file The data to write. + * @param path Path where to store the data. + * @param onProgress Function to call on progress. + * @param offset Offset where to start reading from. + * @param append Whether to append the data to the end of the file. + * @return Promise resolved when done. */ writeFileDataInFile(file: any, path: string, onProgress?: (event: CoreFileProgressEvent) => any, offset: number = 0, append?: boolean): Promise { @@ -642,10 +639,10 @@ export class CoreFileProvider { /** * Write a chunk of data into a file. * - * @param {any} chunkData The chunk of data. - * @param {string} path Path where to store the data. - * @param {boolean} [append] Whether to append the data to the end of the file. - * @return {Promise} Promise resolved when done. + * @param chunkData The chunk of data. + * @param path Path where to store the data. + * @param append Whether to append the data to the end of the file. + * @return Promise resolved when done. */ protected writeFileDataInFileChunk(chunkData: any, path: string, append?: boolean): Promise { // Read the chunk data. @@ -658,8 +655,8 @@ export class CoreFileProvider { /** * Gets a file that might be outside the app's folder. * - * @param {string} fullPath Absolute path to the file. - * @return {Promise} Promise to be resolved when the file is retrieved. + * @param fullPath Absolute path to the file. + * @return Promise to be resolved when the file is retrieved. */ getExternalFile(fullPath: string): Promise { return this.file.resolveLocalFilesystemUrl(fullPath).then((entry) => { @@ -670,8 +667,8 @@ export class CoreFileProvider { /** * Removes a file that might be outside the app's folder. * - * @param {string} fullPath Absolute path to the file. - * @return {Promise} Promise to be resolved when the file is removed. + * @param fullPath Absolute path to the file. + * @return Promise to be resolved when the file is removed. */ removeExternalFile(fullPath: string): Promise { const directory = fullPath.substring(0, fullPath.lastIndexOf('/')), @@ -683,7 +680,7 @@ export class CoreFileProvider { /** * Get the base path where the application files are stored. * - * @return {Promise} Promise to be resolved when the base path is retrieved. + * @return Promise to be resolved when the base path is retrieved. */ getBasePath(): Promise { return this.init().then(() => { @@ -700,7 +697,7 @@ export class CoreFileProvider { * iOS: Internal URL (cdvfile://). * Others: basePath (file://) * - * @return {Promise} Promise to be resolved when the base path is retrieved. + * @return Promise to be resolved when the base path is retrieved. */ getBasePathToDownload(): Promise { return this.init().then(() => { @@ -719,7 +716,7 @@ export class CoreFileProvider { /** * Get the base path where the application files are stored. Returns the value instantly, without waiting for it to be ready. * - * @return {string} Base path. If the service hasn't been initialized it will return an invalid value. + * @return Base path. If the service hasn't been initialized it will return an invalid value. */ getBasePathInstant(): string { if (!this.basePath) { @@ -734,9 +731,9 @@ export class CoreFileProvider { /** * Move a file. * - * @param {string} [originalPath] Path to the file to move. - * @param {string} [newPath] New path of the file. - * @return {Promise} Promise resolved when the entry is moved. + * @param originalPath Path to the file to move. + * @param newPath New path of the file. + * @return Promise resolved when the entry is moved. */ moveFile(originalPath: string, newPath: string): Promise { return this.init().then(() => { @@ -786,9 +783,9 @@ export class CoreFileProvider { /** * Copy a file. * - * @param {string} from Path to the file to move. - * @param {string} to New path of the file. - * @return {Promise} Promise resolved when the entry is copied. + * @param from Path to the file to move. + * @param to New path of the file. + * @return Promise resolved when the entry is copied. */ copyFile(from: string, to: string): Promise { let fromFileAndDir, @@ -832,8 +829,8 @@ export class CoreFileProvider { /** * Extract the file name and directory from a given path. * - * @param {string} path Path to be extracted. - * @return {any} Plain object containing the file name and directory. + * @param path Path to be extracted. + * @return Plain object containing the file name and directory. * @description * file.pdf -> directory: '', name: 'file.pdf' * /file.pdf -> directory: '', name: 'file.pdf' @@ -856,8 +853,8 @@ export class CoreFileProvider { /** * Get the internal URL of a file. * - * @param {FileEntry} fileEntry File Entry. - * @return {string} Internal URL. + * @param fileEntry File Entry. + * @return Internal URL. */ getInternalURL(fileEntry: FileEntry): string { if (!fileEntry.toInternalURL) { @@ -871,8 +868,8 @@ export class CoreFileProvider { /** * Adds the basePath to a path if it doesn't have it already. * - * @param {string} path Path to treat. - * @return {string} Path with basePath added. + * @param path Path to treat. + * @return Path with basePath added. */ addBasePathIfNeeded(path: string): string { if (path.indexOf(this.basePath) > -1) { @@ -885,8 +882,8 @@ export class CoreFileProvider { /** * Remove the base path from a path. If basePath isn't found, return false. * - * @param {string} path Path to treat. - * @return {string} Path without basePath if basePath was found, undefined otherwise. + * @param path Path to treat. + * @return Path without basePath if basePath was found, undefined otherwise. */ removeBasePath(path: string): string { if (path.indexOf(this.basePath) > -1) { @@ -897,11 +894,11 @@ export class CoreFileProvider { /** * Unzips a file. * - * @param {string} path Path to the ZIP file. - * @param {string} [destFolder] Path to the destination folder. If not defined, a new folder will be created with the - * same location and name as the ZIP file (without extension). - * @param {Function} [onProgress] Function to call on progress. - * @return {Promise} Promise resolved when the file is unzipped. + * @param path Path to the ZIP file. + * @param destFolder Path to the destination folder. If not defined, a new folder will be created with the + * same location and name as the ZIP file (without extension). + * @param onProgress Function to call on progress. + * @return Promise resolved when the file is unzipped. */ unzipFile(path: string, destFolder?: string, onProgress?: Function): Promise { // Get the source file. @@ -920,10 +917,10 @@ export class CoreFileProvider { /** * Search a string or regexp in a file contents and replace it. The result is saved in the same file. * - * @param {string} path Path to the file. - * @param {string|RegExp} search Value to search. - * @param {string} newValue New value. - * @return {Promise} Promise resolved in success. + * @param path Path to the file. + * @param search Value to search. + * @param newValue New value. + * @return Promise resolved in success. */ replaceInFile(path: string, search: string | RegExp, newValue: string): Promise { return this.readFile(path).then((content) => { @@ -942,8 +939,8 @@ export class CoreFileProvider { /** * Get a file/dir metadata given the file's entry. * - * @param {Entry} fileEntry FileEntry retrieved from getFile or similar. - * @return {Promise} Promise resolved with metadata. + * @param fileEntry FileEntry retrieved from getFile or similar. + * @return Promise resolved with metadata. */ getMetadata(fileEntry: Entry): Promise { if (!fileEntry || !fileEntry.getMetadata) { @@ -958,9 +955,9 @@ export class CoreFileProvider { /** * Get a file/dir metadata given the path. * - * @param {string} path Path to the file/dir. - * @param {boolean} [isDir] True if directory, false if file. - * @return {Promise} Promise resolved with metadata. + * @param path Path to the file/dir. + * @param isDir True if directory, false if file. + * @return Promise resolved with metadata. */ getMetadataFromPath(path: string, isDir?: boolean): Promise { let promise; @@ -978,8 +975,8 @@ export class CoreFileProvider { /** * Remove the starting slash of a path if it's there. E.g. '/sites/filepool' -> 'sites/filepool'. * - * @param {string} path Path. - * @return {string} Path without a slash in the first position. + * @param path Path. + * @return Path without a slash in the first position. */ removeStartingSlash(path: string): string { if (path[0] == '/') { @@ -992,10 +989,10 @@ export class CoreFileProvider { /** * Convenience function to copy or move an external file. * - * @param {string} from Absolute path to the file to copy/move. - * @param {string} to Relative new path of the file (inside the app folder). - * @param {boolean} copy True to copy, false to move. - * @return {Promise} Promise resolved when the entry is copied/moved. + * @param from Absolute path to the file to copy/move. + * @param to Relative new path of the file (inside the app folder). + * @param copy True to copy, false to move. + * @return Promise resolved when the entry is copied/moved. */ protected copyOrMoveExternalFile(from: string, to: string, copy?: boolean): Promise { // Get the file to copy/move. @@ -1019,9 +1016,9 @@ export class CoreFileProvider { /** * Copy a file from outside of the app folder to somewhere inside the app folder. * - * @param {string} from Absolute path to the file to copy. - * @param {string} to Relative new path of the file (inside the app folder). - * @return {Promise} Promise resolved when the entry is copied. + * @param from Absolute path to the file to copy. + * @param to Relative new path of the file (inside the app folder). + * @return Promise resolved when the entry is copied. */ copyExternalFile(from: string, to: string): Promise { return this.copyOrMoveExternalFile(from, to, true); @@ -1030,9 +1027,9 @@ export class CoreFileProvider { /** * Move a file from outside of the app folder to somewhere inside the app folder. * - * @param {string} from Absolute path to the file to move. - * @param {string} to Relative new path of the file (inside the app folder). - * @return {Promise} Promise resolved when the entry is moved. + * @param from Absolute path to the file to move. + * @param to Relative new path of the file (inside the app folder). + * @return Promise resolved when the entry is moved. */ moveExternalFile(from: string, to: string): Promise { return this.copyOrMoveExternalFile(from, to, false); @@ -1041,10 +1038,10 @@ export class CoreFileProvider { /** * Get a unique file name inside a folder, adding numbers to the file name if needed. * - * @param {string} dirPath Path to the destination folder. - * @param {string} fileName File name that wants to be used. - * @param {string} [defaultExt] Default extension to use if no extension found in the file. - * @return {Promise} Promise resolved with the unique file name. + * @param dirPath Path to the destination folder. + * @param fileName File name that wants to be used. + * @param defaultExt Default extension to use if no extension found in the file. + * @return Promise resolved with the unique file name. */ getUniqueNameInFolder(dirPath: string, fileName: string, defaultExt?: string): Promise { // Get existing files in the folder. @@ -1094,7 +1091,7 @@ export class CoreFileProvider { /** * Remove app temporary folder. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ clearTmpFolder(): Promise { return this.removeDir(CoreFileProvider.TMPFOLDER).catch(() => { @@ -1105,9 +1102,9 @@ export class CoreFileProvider { /** * Given a folder path and a list of used files, remove all the files of the folder that aren't on the list of used files. * - * @param {string} dirPath Folder path. - * @param {any[]} files List of used files. - * @return {Promise} Promise resolved when done, rejected if failure. + * @param dirPath Folder path. + * @param files List of used files. + * @return Promise resolved when done, rejected if failure. */ removeUnusedFiles(dirPath: string, files: any[]): Promise { // Get the directory contents. @@ -1143,8 +1140,8 @@ export class CoreFileProvider { /** * Check if a file is inside the app's folder. * - * @param {string} path The absolute path of the file to check. - * @return {boolean} Whether the file is in the app's folder. + * @param path The absolute path of the file to check. + * @return Whether the file is in the app's folder. */ isFileInAppFolder(path: string): boolean { return path.indexOf(this.basePath) != -1; diff --git a/src/providers/filepool.ts b/src/providers/filepool.ts index aded3de7e..8f45b4a0e 100644 --- a/src/providers/filepool.ts +++ b/src/providers/filepool.ts @@ -38,61 +38,51 @@ import { Md5 } from 'ts-md5/dist/md5'; export interface CoreFilepoolFileEntry { /** * The fileId to identify the file. - * @type {string} */ fileId?: string; /** * File's URL. - * @type {string} */ url?: string; /** * File's revision. - * @type {number} */ revision?: number; /** * File's timemodified. - * @type {number} */ timemodified?: number; /** * 1 if file is stale (needs to be updated), 0 otherwise. - * @type {number} */ stale?: number; /** * Timestamp when this file was downloaded. - * @type {number} */ downloadTime?: number; /** * 1 if it's a external file (from an external repository), 0 otherwise. - * @type {number} */ isexternalfile?: number; /** * Type of the repository this file belongs to. - * @type {string} */ repositorytype?: string; /** * File's path. - * @type {string} */ path?: string; /** * File's extension. - * @type {string} */ extension?: string; } @@ -103,67 +93,56 @@ export interface CoreFilepoolFileEntry { export interface CoreFilepoolQueueEntry { /** * The site the file belongs to. - * @type {string} */ siteId?: string; /** * The fileId to identify the file. - * @type {string} */ fileId?: string; /** * Timestamp when the file was added to the queue. - * @type {number} */ added?: number; /** * The priority of the file. - * @type {number} */ priority?: number; /** * File's URL. - * @type {string} */ url?: string; /** * File's revision. - * @type {number} */ revision?: number; /** * File's timemodified. - * @type {number} */ timemodified?: number; /** * 1 if it's a external file (from an external repository), 0 otherwise. - * @type {number} */ isexternalfile?: number; /** * Type of the repository this file belongs to. - * @type {string} */ repositorytype?: string; /** * File's path. - * @type {string} */ path?: string; /** * File links (to link the file to components and componentIds). - * @type {any[]} */ links?: any[]; } @@ -174,55 +153,46 @@ export interface CoreFilepoolQueueEntry { export interface CoreFilepoolPackageEntry { /** * Package id. - * @type {string} */ id?: string; /** * The component to link the files to. - * @type {string} */ component?: string; /** * An ID to use in conjunction with the component. - * @type {string|number} */ componentId?: string | number; /** * Package status. - * @type {string} */ status?: string; /** * Package previous status. - * @type {string} */ previous?: string; /** * Timestamp when this package was updated. - * @type {number} */ updated?: number; /** * Timestamp when this package was downloaded. - * @type {number} */ downloadTime?: number; /** * Previous download time. - * @type {number} */ previousDownloadTime?: number; /** * Extra data stored by the package. - * @type {string} */ extra?: string; } @@ -466,11 +436,11 @@ export class CoreFilepoolProvider { /** * Link a file with a component. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. - * @param {string} component The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @return {Promise} Promise resolved on success. + * @param siteId The site ID. + * @param fileId The file ID. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component. + * @return Promise resolved on success. */ protected addFileLink(siteId: string, fileId: string, component: string, componentId?: string | number): Promise { if (!component) { @@ -493,11 +463,11 @@ export class CoreFilepoolProvider { /** * Link a file with a component by URL. * - * @param {string} siteId The site ID. - * @param {string} fileUrl The file Url. - * @param {string} component The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @return {Promise} Promise resolved on success. + * @param siteId The site ID. + * @param fileUrl The file Url. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component. + * @return Promise resolved on success. * @description * Use this method to create a link between a URL and a component. You usually do not need to call this manually since * downloading a file automatically does this. Note that this method does not check if the file exists in the pool. @@ -513,10 +483,10 @@ export class CoreFilepoolProvider { /** * Link a file with several components. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. - * @param {any[]} links Array of objects containing the component and optionally componentId. - * @return {Promise} Promise resolved on success. + * @param siteId The site ID. + * @param fileId The file ID. + * @param links Array of objects containing the component and optionally componentId. + * @return Promise resolved on success. */ protected addFileLinks(siteId: string, fileId: string, links: any[]): Promise { const promises = []; @@ -530,11 +500,11 @@ export class CoreFilepoolProvider { /** * Add files to queue using a URL. * - * @param {string} siteId The site ID. - * @param {any[]} files Array of files to add. - * @param {string} [component] The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component (optional). - * @return {Promise} Resolved on success. + * @param siteId The site ID. + * @param files Array of files to add. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component (optional). + * @return Resolved on success. */ addFilesToQueue(siteId: string, files: any[], component?: string, componentId?: string | number): Promise { return this.downloadOrPrefetchFiles(siteId, files, true, false, component, componentId); @@ -543,10 +513,10 @@ export class CoreFilepoolProvider { /** * Add a file to the pool. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. - * @param {any} data Additional information to store about the file (timemodified, url, ...). See FILES_TABLE schema. - * @return {Promise} Promise resolved on success. + * @param siteId The site ID. + * @param fileId The file ID. + * @param data Additional information to store about the file (timemodified, url, ...). See FILES_TABLE schema. + * @return Promise resolved on success. */ protected addFileToPool(siteId: string, fileId: string, data: any): Promise { const values = Object.assign({}, data); @@ -560,9 +530,9 @@ export class CoreFilepoolProvider { /** * Adds a hash to a filename if needed. * - * @param {string} url The URL of the file, already treated (decoded, without revision, etc.). - * @param {string} filename The filename. - * @return {string} The filename with the hash. + * @param url The URL of the file, already treated (decoded, without revision, etc.). + * @param filename The filename. + * @return The filename with the hash. */ protected addHashToFilename(url: string, filename: string): string { // Check if the file already has a hash. If a file is downloaded and re-uploaded with the app it will have a hash already. @@ -586,16 +556,16 @@ export class CoreFilepoolProvider { /** * Add a file to the queue. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. - * @param {string} url The absolute URL to the file. - * @param {number} priority The priority this file should get in the queue (range 0-999). - * @param {number} revision The revision of the file. - * @param {number} timemodified The time this file was modified. Can be used to check file state. - * @param {string} [filePath] Filepath to download the file to. If not defined, download to the filepool folder. - * @param {any} options Extra options (isexternalfile, repositorytype). - * @param {any} [link] The link to add for the file. - * @return {Promise} Promise resolved when the file is downloaded. + * @param siteId The site ID. + * @param fileId The file ID. + * @param url The absolute URL to the file. + * @param priority The priority this file should get in the queue (range 0-999). + * @param revision The revision of the file. + * @param timemodified The time this file was modified. Can be used to check file state. + * @param filePath Filepath to download the file to. If not defined, download to the filepool folder. + * @param options Extra options (isexternalfile, repositorytype). + * @param link The link to add for the file. + * @return Promise resolved when the file is downloaded. */ protected addToQueue(siteId: string, fileId: string, url: string, priority: number, revision: number, timemodified: number, filePath: string, onProgress?: (event: any) => any, options: any = {}, link?: any): Promise { @@ -625,17 +595,17 @@ export class CoreFilepoolProvider { /** * Add an entry to queue using a URL. * - * @param {string} siteId The site ID. - * @param {string} fileUrl The absolute URL to the file. - * @param {string} [component] The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component (optional). - * @param {number} [timemodified=0] The time this file was modified. Can be used to check file state. - * @param {string} [filePath] Filepath to download the file to. If not defined, download to the filepool folder. - * @param {Function} [onProgress] Function to call on progress. - * @param {number} [priority=0] The priority this file should get in the queue (range 0-999). - * @param {any} [options] Extra options (isexternalfile, repositorytype). - * @param {number} [revision] File revision. If not defined, it will be calculated using the URL. - * @return {Promise} Resolved on success. + * @param siteId The site ID. + * @param fileUrl The absolute URL to the file. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component (optional). + * @param timemodified The time this file was modified. Can be used to check file state. + * @param filePath Filepath to download the file to. If not defined, download to the filepool folder. + * @param onProgress Function to call on progress. + * @param priority The priority this file should get in the queue (range 0-999). + * @param options Extra options (isexternalfile, repositorytype). + * @param revision File revision. If not defined, it will be calculated using the URL. + * @return Resolved on success. */ addToQueueByUrl(siteId: string, fileUrl: string, component?: string, componentId?: string | number, timemodified: number = 0, filePath?: string, onProgress?: (event: any) => any, priority: number = 0, options: any = {}, revision?: number) @@ -748,17 +718,17 @@ export class CoreFilepoolProvider { /** * Adds a file to the queue if the size is allowed to be downloaded. * - * @param {string} siteId The site ID. - * @param {string} fileUrl The absolute URL to the file. - * @param {string} component The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {number} [timemodified=0] The time this file was modified. - * @param {boolean} [checkSize=true] True if we shouldn't download files if their size is big, false otherwise. - * @param {boolean} [downloadUnknown] True to download file in WiFi if their size is unknown, false otherwise. - * Ignored if checkSize=false. - * @param {any} [options] Extra options (isexternalfile, repositorytype). - * @param {number} [revision] File revision. If not defined, it will be calculated using the URL. - * @return {Promise} Promise resolved when the file is downloaded. + * @param siteId The site ID. + * @param fileUrl The absolute URL to the file. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component. + * @param timemodified The time this file was modified. + * @param checkSize True if we shouldn't download files if their size is big, false otherwise. + * @param downloadUnknown True to download file in WiFi if their size is unknown, false otherwise. + * Ignored if checkSize=false. + * @param options Extra options (isexternalfile, repositorytype). + * @param revision File revision. If not defined, it will be calculated using the URL. + * @return Promise resolved when the file is downloaded. */ protected addToQueueIfNeeded(siteId: string, fileUrl: string, component: string, componentId?: string | number, timemodified: number = 0, checkSize: boolean = true, downloadUnknown?: boolean, options: any = {}, revision?: number) @@ -829,8 +799,8 @@ export class CoreFilepoolProvider { /** * Clear all packages status in a site. * - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when all status are cleared. + * @param siteId Site ID. + * @return Promise resolved when all status are cleared. */ clearAllPackagesStatus(siteId: string): Promise { this.logger.debug('Clear all packages status for site ' + siteId); @@ -852,8 +822,8 @@ export class CoreFilepoolProvider { /** * Clears the filepool. Use it only when all the files from a site are deleted. * - * @param {string} siteId ID of the site to clear. - * @return {Promise} Promise resolved when the filepool is cleared. + * @param siteId ID of the site to clear. + * @return Promise resolved when the filepool is cleared. */ clearFilepool(siteId: string): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -867,10 +837,10 @@ export class CoreFilepoolProvider { /** * Returns whether a component has files in the pool. * - * @param {string} siteId The site ID. - * @param {string} component The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @return {Promise} Resolved means yes, rejected means no. + * @param siteId The site ID. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component. + * @return Resolved means yes, rejected means no. */ componentHasFiles(siteId: string, component: string, componentId?: string | number): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -898,9 +868,9 @@ export class CoreFilepoolProvider { * - CoreConstants.OUTDATED if ALL the downloadable packages have status CoreConstants.OUTDATED or CoreConstants.DOWNLOADED * or CoreConstants.DOWNLOADING, with at least 1 package with CoreConstants.OUTDATED. * - * @param {string} current Current status of the list of packages. - * @param {string} packagestatus Status of one of the packages. - * @return {string} New status for the list of packages; + * @param current Current status of the list of packages. + * @param packagestatus Status of one of the packages. + * @return New status for the list of packages; */ determinePackagesStatus(current: string, packageStatus: string): string { if (!current) { @@ -931,13 +901,13 @@ export class CoreFilepoolProvider { * * This uses the file system, you should always make sure that it is accessible before calling this method. * - * @param {string} siteId The site ID. - * @param {string} fileUrl The file URL. - * @param {any} [options] Extra options (revision, timemodified, isexternalfile, repositorytype). - * @param {string} [filePath] Filepath to download the file to. If defined, no extension will be added. - * @param {Function} [onProgress] Function to call on progress. - * @param {CoreFilepoolFileEntry} [poolFileObject] When set, the object will be updated, a new entry will not be created. - * @return {Promise} Resolved with internal URL on success, rejected otherwise. + * @param siteId The site ID. + * @param fileUrl The file URL. + * @param options Extra options (revision, timemodified, isexternalfile, repositorytype). + * @param filePath Filepath to download the file to. If defined, no extension will be added. + * @param onProgress Function to call on progress. + * @param poolFileObject When set, the object will be updated, a new entry will not be created. + * @return Resolved with internal URL on success, rejected otherwise. */ protected downloadForPoolByUrl(siteId: string, fileUrl: string, options: any = {}, filePath?: string, onProgress?: (event: any) => any, poolFileObject?: CoreFilepoolFileEntry): Promise { @@ -997,15 +967,15 @@ export class CoreFilepoolProvider { /** * Download or prefetch several files into the filepool folder. * - * @param {string} siteId The site ID. - * @param {any[]} files Array of files to download. - * @param {boolean} prefetch True if should prefetch the contents (queue), false if they should be downloaded right now. - * @param {boolean} [ignoreStale] True if 'stale' should be ignored. Only if prefetch=false. - * @param {string} [component] The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {string} [dirPath] Name of the directory where to store the files (inside filepool dir). If not defined, store - * the files directly inside the filepool folder. - * @return {Promise} Resolved on success. + * @param siteId The site ID. + * @param files Array of files to download. + * @param prefetch True if should prefetch the contents (queue), false if they should be downloaded right now. + * @param ignoreStale True if 'stale' should be ignored. Only if prefetch=false. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component. + * @param dirPath Name of the directory where to store the files (inside filepool dir). If not defined, store + * the files directly inside the filepool folder. + * @return Resolved on success. */ downloadOrPrefetchFiles(siteId: string, files: any[], prefetch: boolean, ignoreStale?: boolean, component?: string, componentId?: string | number, dirPath?: string): Promise { @@ -1045,16 +1015,16 @@ export class CoreFilepoolProvider { /** * Downloads or prefetches a list of files as a "package". * - * @param {string} siteId The site ID. - * @param {any[]} fileList List of files to download. - * @param {boolean} [prefetch] True if should prefetch the contents (queue), false if they should be downloaded right now. - * @param {string} [component] The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {string} [extra] Extra data to store for the package. - * @param {string} [dirPath] Name of the directory where to store the files (inside filepool dir). If not defined, store - * the files directly inside the filepool folder. - * @param {Function} [onProgress] Function to call on progress. - * @return {Promise} Promise resolved when the package is downloaded. + * @param siteId The site ID. + * @param fileList List of files to download. + * @param prefetch True if should prefetch the contents (queue), false if they should be downloaded right now. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component. + * @param extra Extra data to store for the package. + * @param dirPath Name of the directory where to store the files (inside filepool dir). If not defined, store + * the files directly inside the filepool folder. + * @param onProgress Function to call on progress. + * @return Promise resolved when the package is downloaded. */ protected downloadOrPrefetchPackage(siteId: string, fileList: any[], prefetch?: boolean, component?: string, componentId?: string | number, extra?: string, dirPath?: string, onProgress?: (event: any) => any): Promise { @@ -1145,15 +1115,15 @@ export class CoreFilepoolProvider { /** * Downloads a list of files. * - * @param {string} siteId The site ID. - * @param {any[]} fileList List of files to download. - * @param {string} component The component to link the file to. - * @param {string|number} [componentId] An ID to identify the download. - * @param {string} [extra] Extra data to store for the package. - * @param {string} [dirPath] Name of the directory where to store the files (inside filepool dir). If not defined, store - * the files directly inside the filepool folder. - * @param {Function} [onProgress] Function to call on progress. - * @return {Promise} Promise resolved when all files are downloaded. + * @param siteId The site ID. + * @param fileList List of files to download. + * @param component The component to link the file to. + * @param componentId An ID to identify the download. + * @param extra Extra data to store for the package. + * @param dirPath Name of the directory where to store the files (inside filepool dir). If not defined, store + * the files directly inside the filepool folder. + * @param onProgress Function to call on progress. + * @return Promise resolved when all files are downloaded. */ downloadPackage(siteId: string, fileList: any[], component: string, componentId?: string | number, extra?: string, dirPath?: string, onProgress?: (event: any) => any): Promise { @@ -1163,16 +1133,16 @@ export class CoreFilepoolProvider { /** * Downloads a file on the spot. * - * @param {string} siteId The site ID. - * @param {string} fileUrl The file URL. - * @param {boolean} [ignoreStale] Whether 'stale' should be ignored. - * @param {string} [component] The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {number} [timemodified=0] The time this file was modified. Can be used to check file state. - * @param {string} [filePath] Filepath to download the file to. If not defined, download to the filepool folder. - * @param {any} [options] Extra options (isexternalfile, repositorytype). - * @param {number} [revision] File revision. If not defined, it will be calculated using the URL. - * @return {Promise} Resolved with internal URL on success, rejected otherwise. + * @param siteId The site ID. + * @param fileUrl The file URL. + * @param ignoreStale Whether 'stale' should be ignored. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component. + * @param timemodified The time this file was modified. Can be used to check file state. + * @param filePath Filepath to download the file to. If not defined, download to the filepool folder. + * @param options Extra options (isexternalfile, repositorytype). + * @param revision File revision. If not defined, it will be calculated using the URL. + * @return Resolved with internal URL on success, rejected otherwise. * @description * Downloads a file on the spot. * @@ -1256,9 +1226,9 @@ export class CoreFilepoolProvider { * Fill Missing Extension In the File Object if needed. * This is to migrate from old versions. * - * @param {CoreFilepoolFileEntry} fileObject File object to be migrated. - * @param {string} siteId SiteID to get migrated. - * @return {Promise} Promise resolved when done. + * @param fileObject File object to be migrated. + * @param siteId SiteID to get migrated. + * @return Promise resolved when done. */ protected fillExtensionInFile(entry: CoreFilepoolFileEntry, siteId: string): Promise { if (typeof entry.extension != 'undefined') { @@ -1299,8 +1269,8 @@ export class CoreFilepoolProvider { * Fill Missing Extension In Files, used to migrate from previous file handling. * Reserved for core use, please do not call. * - * @param {string} siteId SiteID to get migrated - * @return {Promise} Promise resolved when done. + * @param siteId SiteID to get migrated + * @return Promise resolved when done. */ fillMissingExtensionInFiles(siteId: string): Promise { this.logger.debug('Fill missing extensions in files of ' + siteId); @@ -1320,8 +1290,8 @@ export class CoreFilepoolProvider { /** * Fix a component ID to always be a Number if possible. * - * @param {string|number} componentId The component ID. - * @return {string|number} The normalised component ID. -1 when undefined was passed. + * @param componentId The component ID. + * @return The normalised component ID. -1 when undefined was passed. */ protected fixComponentId(componentId: string | number): string | number { if (typeof componentId == 'number') { @@ -1345,9 +1315,9 @@ export class CoreFilepoolProvider { /** * Add the wstoken url and points to the correct script. * - * @param {string} siteId The site ID. - * @param {string} fileUrl The file URL. - * @return {Promise} Resolved with fixed URL on success, rejected otherwise. + * @param siteId The site ID. + * @param fileUrl The file URL. + * @return Resolved with fixed URL on success, rejected otherwise. */ protected fixPluginfileURL(siteId: string, fileUrl: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -1358,10 +1328,10 @@ export class CoreFilepoolProvider { /** * Convenience function to get component files. * - * @param {SQLiteDB} db Site's DB. - * @param {string} component The component to get. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @return {Promise} Promise resolved with the files. + * @param db Site's DB. + * @param component The component to get. + * @param componentId An ID to use in conjunction with the component. + * @return Promise resolved with the files. */ protected getComponentFiles(db: SQLiteDB, component: string, componentId?: string | number): Promise { const conditions = { @@ -1375,9 +1345,9 @@ export class CoreFilepoolProvider { /** * Returns the local URL of a directory. * - * @param {string} siteId The site ID. - * @param {string} fileUrl The file URL. - * @return {Promise} Resolved with the URL. Rejected otherwise. + * @param siteId The site ID. + * @param fileUrl The file URL. + * @return Resolved with the URL. Rejected otherwise. */ getDirectoryUrlByUrl(siteId: string, fileUrl: string): Promise { if (this.fileProvider.isAvailable()) { @@ -1397,9 +1367,9 @@ export class CoreFilepoolProvider { /** * Get the ID of a file download. Used to keep track of filePromises. * - * @param {string} fileUrl The file URL. - * @param {string} filePath The file destination path. - * @return {string} File download ID. + * @param fileUrl The file URL. + * @param filePath The file destination path. + * @return File download ID. */ protected getFileDownloadId(fileUrl: string, filePath: string): string { return Md5.hashAsciiStr(fileUrl + '###' + filePath); @@ -1408,9 +1378,9 @@ export class CoreFilepoolProvider { /** * Get the name of the event used to notify download events (CoreEventsProvider). * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. - * @return {string} Event name. + * @param siteId The site ID. + * @param fileId The file ID. + * @return Event name. */ protected getFileEventName(siteId: string, fileId: string): string { return 'CoreFilepoolFile:' + siteId + ':' + fileId; @@ -1419,9 +1389,9 @@ export class CoreFilepoolProvider { /** * Get the name of the event used to notify download events (CoreEventsProvider). * - * @param {string} siteId The site ID. - * @param {string} fileUrl The absolute URL to the file. - * @return {Promise} Promise resolved with event name. + * @param siteId The site ID. + * @param fileUrl The absolute URL to the file. + * @return Promise resolved with event name. */ getFileEventNameByUrl(siteId: string, fileUrl: string): Promise { return this.fixPluginfileURL(siteId, fileUrl).then((fileUrl) => { @@ -1437,8 +1407,8 @@ export class CoreFilepoolProvider { * This has a minimal handling of pluginfiles in order to generate a clean file ID which will not change if * pointing to the same pluginfile URL even if the token or extra attributes have changed. * - * @param {string} fileUrl The absolute URL to the file. - * @return {string} The file ID. + * @param fileUrl The absolute URL to the file. + * @return The file ID. */ protected getFileIdByUrl(fileUrl: string): string { let url = this.removeRevisionFromUrl(fileUrl), @@ -1464,9 +1434,9 @@ export class CoreFilepoolProvider { /** * Get the links of a file. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. - * @return {Promise} Promise resolved with the links. + * @param siteId The site ID. + * @param fileId The file ID. + * @return Promise resolved with the links. */ protected getFileLinks(siteId: string, fileId: string): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -1477,10 +1447,10 @@ export class CoreFilepoolProvider { /** * Get the path to a file. This does not check if the file exists or not. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. - * @param {string} [extension] Previously calculated extension. Empty to not add any. Undefined to calculate it. - * @return {string|Promise} The path to the file relative to storage root. + * @param siteId The site ID. + * @param fileId The file ID. + * @param extension Previously calculated extension. Empty to not add any. Undefined to calculate it. + * @return The path to the file relative to storage root. */ protected getFilePath(siteId: string, fileId: string, extension?: string): string | Promise { let path = this.getFilepoolFolderPath(siteId) + '/' + fileId; @@ -1508,9 +1478,9 @@ export class CoreFilepoolProvider { /** * Get the path to a file from its URL. This does not check if the file exists or not. * - * @param {string} siteId The site ID. - * @param {string} fileUrl The file URL. - * @return {Promise} Promise resolved with the path to the file relative to storage root. + * @param siteId The site ID. + * @param fileUrl The file URL. + * @return Promise resolved with the path to the file relative to storage root. */ getFilePathByUrl(siteId: string, fileUrl: string): Promise { return this.fixPluginfileURL(siteId, fileUrl).then((fileUrl) => { @@ -1523,8 +1493,8 @@ export class CoreFilepoolProvider { /** * Get site Filepool Folder Path * - * @param {string} siteId The site ID. - * @return {string} The root path to the filepool of the site. + * @param siteId The site ID. + * @return The root path to the filepool of the site. */ getFilepoolFolderPath(siteId: string): string { return this.fileProvider.getSiteFolder(siteId) + '/' + this.FOLDER; @@ -1533,10 +1503,10 @@ export class CoreFilepoolProvider { /** * Get all the matching files from a component. Returns objects containing properties like path, extension and url. * - * @param {string} siteId The site ID. - * @param {string} component The component to get. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @return {Promise} Promise resolved with the files on success. + * @param siteId The site ID. + * @param component The component to get. + * @param componentId An ID to use in conjunction with the component. + * @return Promise resolved with the files on success. */ getFilesByComponent(siteId: string, component: string, componentId?: string | number): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -1572,10 +1542,10 @@ export class CoreFilepoolProvider { /** * Get the size of all the files from a component. * - * @param {string} siteId The site ID. - * @param {string} component The component to get. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @return {Promise} Promise resolved with the size on success. + * @param siteId The site ID. + * @param component The component to get. + * @param componentId An ID to use in conjunction with the component. + * @return Promise resolved with the size on success. */ getFilesSizeByComponent(siteId: string, component: string, componentId?: string | number): Promise { return this.getFilesByComponent(siteId, component, componentId).then((files) => { @@ -1599,12 +1569,12 @@ export class CoreFilepoolProvider { /** * Returns the file state: mmCoreDownloaded, mmCoreDownloading, mmCoreNotDownloaded or mmCoreOutdated. * - * @param {string} siteId The site ID. - * @param {string} fileUrl File URL. - * @param {number} [timemodified=0] The time this file was modified. - * @param {string} [filePath] Filepath to download the file to. If defined, no extension will be added. - * @param {number} [revision] File revision. If not defined, it will be calculated using the URL. - * @return {Promise} Promise resolved with the file state. + * @param siteId The site ID. + * @param fileUrl File URL. + * @param timemodified The time this file was modified. + * @param filePath Filepath to download the file to. If defined, no extension will be added. + * @param revision File revision. If not defined, it will be calculated using the URL. + * @return Promise resolved with the file state. */ getFileStateByUrl(siteId: string, fileUrl: string, timemodified: number = 0, filePath?: string, revision?: number) : Promise { @@ -1647,18 +1617,18 @@ export class CoreFilepoolProvider { /** * Returns an absolute URL to access the file URL. * - * @param {string} siteId The site ID. - * @param {string} fileUrl The absolute URL to the file. - * @param {string} [mode=url] The type of URL to return. Accepts 'url' or 'src'. - * @param {string} component The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {number} [timemodified=0] The time this file was modified. - * @param {boolean} [checkSize=true] True if we shouldn't download files if their size is big, false otherwise. - * @param {boolean} [downloadUnknown] True to download file in WiFi if their size is unknown, false otherwise. - * Ignored if checkSize=false. - * @param {any} [options] Extra options (isexternalfile, repositorytype). - * @param {number} [revision] File revision. If not defined, it will be calculated using the URL. - * @return {Promise} Resolved with the URL to use. + * @param siteId The site ID. + * @param fileUrl The absolute URL to the file. + * @param mode The type of URL to return. Accepts 'url' or 'src'. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component. + * @param timemodified The time this file was modified. + * @param checkSize True if we shouldn't download files if their size is big, false otherwise. + * @param downloadUnknown True to download file in WiFi if their size is unknown, false otherwise. + * Ignored if checkSize=false. + * @param options Extra options (isexternalfile, repositorytype). + * @param revision File revision. If not defined, it will be calculated using the URL. + * @return Resolved with the URL to use. * @description * This will return a URL pointing to the content of the requested URL. * @@ -1736,9 +1706,9 @@ export class CoreFilepoolProvider { * * The returned URL from this method is typically used with IMG tags. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. - * @return {Promise} Resolved with the internal URL. Rejected otherwise. + * @param siteId The site ID. + * @param fileId The file ID. + * @return Resolved with the internal URL. Rejected otherwise. */ protected getInternalSrcById(siteId: string, fileId: string): Promise { if (this.fileProvider.isAvailable()) { @@ -1756,9 +1726,9 @@ export class CoreFilepoolProvider { /** * Returns the local URL of a file. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. - * @return {Promise} Resolved with the URL. Rejected otherwise. + * @param siteId The site ID. + * @param fileId The file ID. + * @return Resolved with the URL. Rejected otherwise. */ protected getInternalUrlById(siteId: string, fileId: string): Promise { if (this.fileProvider.isAvailable()) { @@ -1780,8 +1750,8 @@ export class CoreFilepoolProvider { /** * Returns the local URL of a file. * - * @param {string} filePath The file path. - * @return {Promise} Resolved with the URL. + * @param filePath The file path. + * @return Resolved with the URL. */ protected getInternalUrlByPath(filePath: string): Promise { if (this.fileProvider.isAvailable()) { @@ -1796,9 +1766,9 @@ export class CoreFilepoolProvider { /** * Returns the local URL of a file. * - * @param {string} siteId The site ID. - * @param {string} fileUrl The file URL. - * @return {Promise} Resolved with the URL. Rejected otherwise. + * @param siteId The site ID. + * @param fileUrl The file URL. + * @return Resolved with the URL. Rejected otherwise. */ getInternalUrlByUrl(siteId: string, fileUrl: string): Promise { if (this.fileProvider.isAvailable()) { @@ -1815,10 +1785,10 @@ export class CoreFilepoolProvider { /** * Get the data stored for a package. * - * @param {string} siteId Site ID. - * @param {string} component Package's component. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @return {Promise} Promise resolved with the data. + * @param siteId Site ID. + * @param component Package's component. + * @param componentId An ID to use in conjunction with the component. + * @return Promise resolved with the data. */ getPackageData(siteId: string, component: string, componentId?: string | number): Promise { componentId = this.fixComponentId(componentId); @@ -1833,8 +1803,8 @@ export class CoreFilepoolProvider { /** * Creates the name for a package directory (hash). * - * @param {string} url An URL to identify the package. - * @return {string} The directory name. + * @param url An URL to identify the package. + * @return The directory name. */ protected getPackageDirNameByUrl(url: string): string { let candidate, @@ -1861,9 +1831,9 @@ export class CoreFilepoolProvider { /** * Get the path to a directory to store a package files. This does not check if the file exists or not. * - * @param {string} siteId The site ID. - * @param {string} url An URL to identify the package. - * @return {Promise} Promise resolved with the path of the package. + * @param siteId The site ID. + * @param url An URL to identify the package. + * @return Promise resolved with the path of the package. */ getPackageDirPathByUrl(siteId: string, url: string): Promise { return this.fixPluginfileURL(siteId, url).then((fixedUrl) => { @@ -1876,9 +1846,9 @@ export class CoreFilepoolProvider { /** * Returns the local URL of a package directory. * - * @param {string} siteId The site ID. - * @param {string} url An URL to identify the package. - * @return {Promise} Resolved with the URL. + * @param siteId The site ID. + * @param url An URL to identify the package. + * @return Resolved with the URL. */ getPackageDirUrlByUrl(siteId: string, url: string): Promise { if (this.fileProvider.isAvailable()) { @@ -1898,10 +1868,10 @@ export class CoreFilepoolProvider { /** * Get a download promise. If the promise is not set, return undefined. * - * @param {string} siteId Site ID. - * @param {string} component The component of the package. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @return {Promise} Download promise or undefined. + * @param siteId Site ID. + * @param component The component of the package. + * @param componentId An ID to use in conjunction with the component. + * @return Download promise or undefined. */ getPackageDownloadPromise(siteId: string, component: string, componentId?: string | number): Promise { const packageId = this.getPackageId(component, componentId); @@ -1912,10 +1882,10 @@ export class CoreFilepoolProvider { /** * Get a package extra data. * - * @param {string} siteId Site ID. - * @param {string} component Package's component. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @return {Promise} Promise resolved with the extra data. + * @param siteId Site ID. + * @param component Package's component. + * @param componentId An ID to use in conjunction with the component. + * @return Promise resolved with the extra data. */ getPackageExtra(siteId: string, component: string, componentId?: string | number): Promise { return this.getPackageData(siteId, component, componentId).then((entry) => { @@ -1926,9 +1896,9 @@ export class CoreFilepoolProvider { /** * Get the ID of a package. * - * @param {string} component Package's component. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @return {string} Package ID. + * @param component Package's component. + * @param componentId An ID to use in conjunction with the component. + * @return Package ID. */ getPackageId(component: string, componentId?: string | number): string { return Md5.hashAsciiStr(component + '#' + this.fixComponentId(componentId)); @@ -1937,10 +1907,10 @@ export class CoreFilepoolProvider { /** * Get a package previous status. * - * @param {string} siteId Site ID. - * @param {string} component Package's component. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @return {Promise} Promise resolved with the status. + * @param siteId Site ID. + * @param component Package's component. + * @param componentId An ID to use in conjunction with the component. + * @return Promise resolved with the status. */ getPackagePreviousStatus(siteId: string, component: string, componentId?: string | number): Promise { return this.getPackageData(siteId, component, componentId).then((entry) => { @@ -1953,10 +1923,10 @@ export class CoreFilepoolProvider { /** * Get a package status. * - * @param {string} siteId Site ID. - * @param {string} component Package's component. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @return {Promise} Promise resolved with the status. + * @param siteId Site ID. + * @param component Package's component. + * @param componentId An ID to use in conjunction with the component. + * @return Promise resolved with the status. */ getPackageStatus(siteId: string, component: string, componentId?: string | number): Promise { return this.getPackageData(siteId, component, componentId).then((entry) => { @@ -1969,8 +1939,8 @@ export class CoreFilepoolProvider { /** * Return the array of arguments of the pluginfile url. * - * @param {string} url URL to get the args. - * @return {string[]} The args found, undefined if not a pluginfile. + * @param url URL to get the args. + * @return The args found, undefined if not a pluginfile. */ protected getPluginFileArgs(url: string): string[] { if (!this.urlUtils.isPluginFileUrl(url)) { @@ -1992,11 +1962,11 @@ export class CoreFilepoolProvider { /** * Get the deferred object for a file in the queue. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. - * @param {boolean} [create=true] True if it should create a new deferred if it doesn't exist. - * @param {Function} [onProgress] Function to call on progress. - * @return {any} Deferred. + * @param siteId The site ID. + * @param fileId The file ID. + * @param create True if it should create a new deferred if it doesn't exist. + * @param onProgress Function to call on progress. + * @return Deferred. */ protected getQueueDeferred(siteId: string, fileId: string, create: boolean = true, onProgress?: (event: any) => any): any { if (!this.queueDeferreds[siteId]) { @@ -2022,9 +1992,9 @@ export class CoreFilepoolProvider { /** * Get the on progress for a file in the queue. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. - * @return {Function} On progress function, undefined if not found. + * @param siteId The site ID. + * @param fileId The file ID. + * @return On progress function, undefined if not found. */ protected getQueueOnProgress(siteId: string, fileId: string): (event: any) => any { const deferred = this.getQueueDeferred(siteId, fileId, false); @@ -2036,11 +2006,11 @@ export class CoreFilepoolProvider { /** * Get the promise for a file in the queue. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. - * @param {boolean} [create=true] True if it should create a new promise if it doesn't exist. - * @param {Function} [onProgress] Function to call on progress. - * @return {Promise} Promise. + * @param siteId The site ID. + * @param fileId The file ID. + * @param create True if it should create a new promise if it doesn't exist. + * @param onProgress Function to call on progress. + * @return Promise. */ protected getQueuePromise(siteId: string, fileId: string, create: boolean = true, onProgress?: (event: any) => any) : Promise { @@ -2050,8 +2020,8 @@ export class CoreFilepoolProvider { /** * Get a revision number from a list of files (highest revision). * - * @param {any[]} files Package files. - * @return {number} Highest revision. + * @param files Package files. + * @return Highest revision. */ getRevisionFromFileList(files: any[]): number { let revision = 0; @@ -2071,8 +2041,8 @@ export class CoreFilepoolProvider { /** * Get the revision number from a file URL. * - * @param {string} url URL to get the revision number. - * @return {number} Revision number. + * @param url URL to get the revision number. + * @return Revision number. */ protected getRevisionFromUrl(url: string): number { const args = this.getPluginFileArgs(url); @@ -2097,18 +2067,18 @@ export class CoreFilepoolProvider { /** * Returns an absolute URL to use in IMG tags. * - * @param {string} siteId The site ID. - * @param {string} fileUrl The absolute URL to the file. - * @param {string} [mode=url] The type of URL to return. Accepts 'url' or 'src'. - * @param {string} component The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {number} [timemodified=0] The time this file was modified. - * @param {boolean} [checkSize=true] True if we shouldn't download files if their size is big, false otherwise. - * @param {boolean} [downloadUnknown] True to download file in WiFi if their size is unknown, false otherwise. - * Ignored if checkSize=false. - * @param {any} [options] Extra options (isexternalfile, repositorytype). - * @param {number} [revision] File revision. If not defined, it will be calculated using the URL. - * @return {Promise} Resolved with the URL to use. + * @param siteId The site ID. + * @param fileUrl The absolute URL to the file. + * @param mode The type of URL to return. Accepts 'url' or 'src'. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component. + * @param timemodified The time this file was modified. + * @param checkSize True if we shouldn't download files if their size is big, false otherwise. + * @param downloadUnknown True to download file in WiFi if their size is unknown, false otherwise. + * Ignored if checkSize=false. + * @param options Extra options (isexternalfile, repositorytype). + * @param revision File revision. If not defined, it will be calculated using the URL. + * @return Resolved with the URL to use. * @description * This will return a URL pointing to the content of the requested URL. * The URL returned is compatible to use with IMG tags. @@ -2122,8 +2092,8 @@ export class CoreFilepoolProvider { /** * Get time modified from a list of files. * - * @param {any[]} files List of files. - * @return {number} Time modified. + * @param files List of files. + * @return Time modified. */ getTimemodifiedFromFileList(files: any[]): number { let timemodified = 0; @@ -2140,18 +2110,18 @@ export class CoreFilepoolProvider { /** * Returns an absolute URL to access the file. * - * @param {string} siteId The site ID. - * @param {string} fileUrl The absolute URL to the file. - * @param {string} [mode=url] The type of URL to return. Accepts 'url' or 'src'. - * @param {string} component The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {number} [timemodified=0] The time this file was modified. - * @param {boolean} [checkSize=true] True if we shouldn't download files if their size is big, false otherwise. - * @param {boolean} [downloadUnknown] True to download file in WiFi if their size is unknown, false otherwise. - * Ignored if checkSize=false. - * @param {any} [options] Extra options (isexternalfile, repositorytype). - * @param {number} [revision] File revision. If not defined, it will be calculated using the URL. - * @return {Promise} Resolved with the URL to use. + * @param siteId The site ID. + * @param fileUrl The absolute URL to the file. + * @param mode The type of URL to return. Accepts 'url' or 'src'. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component. + * @param timemodified The time this file was modified. + * @param checkSize True if we shouldn't download files if their size is big, false otherwise. + * @param downloadUnknown True to download file in WiFi if their size is unknown, false otherwise. + * Ignored if checkSize=false. + * @param options Extra options (isexternalfile, repositorytype). + * @param revision File revision. If not defined, it will be calculated using the URL. + * @return Resolved with the URL to use. * @description * This will return a URL pointing to the content of the requested URL. * The URL returned is compatible to use with a local browser. @@ -2165,8 +2135,8 @@ export class CoreFilepoolProvider { /** * Guess the filename of a file from its URL. This is very weak and unreliable. * - * @param {string} fileUrl The file URL. - * @return {string} The filename treated so it doesn't have any special character. + * @param fileUrl The file URL. + * @return The filename treated so it doesn't have any special character. */ protected guessFilenameFromUrl(fileUrl: string): string { let filename = ''; @@ -2224,9 +2194,9 @@ export class CoreFilepoolProvider { /** * Check if the file is already in the pool. This does not check if the file is on the disk. * - * @param {string} siteId The site ID. - * @param {string} fileUrl The file URL. - * @return {Promise} Resolved with file object from DB on success, rejected otherwise. + * @param siteId The site ID. + * @param fileUrl The file URL. + * @return Resolved with file object from DB on success, rejected otherwise. */ protected hasFileInPool(siteId: string, fileId: string): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -2243,9 +2213,9 @@ export class CoreFilepoolProvider { /** * Check if the file is in the queue. * - * @param {string} siteId The site ID. - * @param {string} fileUrl The file URL. - * @return {Promise} Resolved with file object from DB on success, rejected otherwise. + * @param siteId The site ID. + * @param fileUrl The file URL. + * @return Resolved with file object from DB on success, rejected otherwise. */ protected hasFileInQueue(siteId: string, fileId: string): Promise { return this.appDB.getRecord(this.QUEUE_TABLE, { siteId: siteId, fileId: fileId }).then((entry) => { @@ -2262,10 +2232,10 @@ export class CoreFilepoolProvider { /** * Invalidate all the files in a site. * - * @param {string} siteId The site ID. - * @param {boolean} [onlyUnknown=true] True to only invalidate files from external repos or without revision/timemodified. - * It is advised to set it to true to reduce the performance and data usage of the app. - * @return {Promise} Resolved on success. + * @param siteId The site ID. + * @param onlyUnknown True to only invalidate files from external repos or without revision/timemodified. + * It is advised to set it to true to reduce the performance and data usage of the app. + * @return Resolved on success. */ invalidateAllFiles(siteId: string, onlyUnknown: boolean = true): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -2283,9 +2253,9 @@ export class CoreFilepoolProvider { /** * Invalidate a file by URL. * - * @param {string} siteId The site ID. - * @param {string} fileUrl The file URL. - * @return {Promise} Resolved on success. + * @param siteId The site ID. + * @param fileUrl The file URL. + * @return Resolved on success. * @description * Invalidates a file by marking it stale. It will not be added to the queue automatically, but the next time this file * is requested it will be added to the queue. @@ -2305,12 +2275,12 @@ export class CoreFilepoolProvider { /** * Invalidate all the matching files from a component. * - * @param {string} siteId The site ID. - * @param {string} component The component to invalidate. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {boolean} [onlyUnknown=true] True to only invalidate files from external repos or without revision/timemodified. - * It is advised to set it to true to reduce the performance and data usage of the app. - * @return {Promise} Resolved when done. + * @param siteId The site ID. + * @param component The component to invalidate. + * @param componentId An ID to use in conjunction with the component. + * @param onlyUnknown True to only invalidate files from external repos or without revision/timemodified. + * It is advised to set it to true to reduce the performance and data usage of the app. + * @return Resolved when done. */ invalidateFilesByComponent(siteId: string, component: string, componentId?: string | number, onlyUnknown: boolean = true) : Promise { @@ -2336,9 +2306,9 @@ export class CoreFilepoolProvider { /** * Check if a file is downloading. * - * @param {string} siteId The site ID. - * @param {string} fileUrl File URL. - * @param {Promise} Promise resolved if file is downloading, rejected otherwise. + * @param siteId The site ID. + * @param fileUrl File URL. + * @param Promise resolved if file is downloading, rejected otherwise. */ isFileDownloadingByUrl(siteId: string, fileUrl: string): Promise { return this.fixPluginfileURL(siteId, fileUrl).then((fileUrl) => { @@ -2351,10 +2321,10 @@ export class CoreFilepoolProvider { /** * Check if a file is outdated. * - * @param {CoreFilepoolFileEntry} entry Filepool entry. - * @param {number} [revision] File revision number. - * @param {number} [timemodified] The time this file was modified. - * @param {boolean} Whether the file is outdated. + * @param entry Filepool entry. + * @param revision File revision number. + * @param timemodified The time this file was modified. + * @param Whether the file is outdated. */ protected isFileOutdated(entry: CoreFilepoolFileEntry, revision?: number, timemodified?: number): boolean { return !!entry.stale || revision > entry.revision || timemodified > entry.timemodified; @@ -2363,8 +2333,8 @@ export class CoreFilepoolProvider { /** * Check if cannot determine if a file has been updated. * - * @param {CoreFilepoolFileEntry} entry Filepool entry. - * @return {boolean} Whether it cannot determine updates. + * @param entry Filepool entry. + * @return Whether it cannot determine updates. */ protected isFileUpdateUnknown(entry: CoreFilepoolFileEntry): boolean { return !!entry.isexternalfile || (entry.revision < 1 && !entry.timemodified); @@ -2373,8 +2343,8 @@ export class CoreFilepoolProvider { /** * Notify a file has been deleted. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. + * @param siteId The site ID. + * @param fileId The file ID. */ protected notifyFileDeleted(siteId: string, fileId: string): void { this.eventsProvider.trigger(this.getFileEventName(siteId, fileId), { action: 'deleted' }); @@ -2383,8 +2353,8 @@ export class CoreFilepoolProvider { /** * Notify a file has been downloaded. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. + * @param siteId The site ID. + * @param fileId The file ID. */ protected notifyFileDownloaded(siteId: string, fileId: string): void { this.eventsProvider.trigger(this.getFileEventName(siteId, fileId), { action: 'download', success: true }); @@ -2393,8 +2363,8 @@ export class CoreFilepoolProvider { /** * Notify error occurred while downloading a file. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. + * @param siteId The site ID. + * @param fileId The file ID. */ protected notifyFileDownloadError(siteId: string, fileId: string): void { this.eventsProvider.trigger(this.getFileEventName(siteId, fileId), { action: 'download', success: false }); @@ -2403,8 +2373,8 @@ export class CoreFilepoolProvider { /** * Notify a file starts being downloaded or added to queue. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. + * @param siteId The site ID. + * @param fileId The file ID. */ protected notifyFileDownloading(siteId: string, fileId: string): void { this.eventsProvider.trigger(this.getFileEventName(siteId, fileId), { action: 'downloading' }); @@ -2413,8 +2383,8 @@ export class CoreFilepoolProvider { /** * Notify a file has been outdated. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. + * @param siteId The site ID. + * @param fileId The file ID. */ protected notifyFileOutdated(siteId: string, fileId: string): void { this.eventsProvider.trigger(this.getFileEventName(siteId, fileId), { action: 'outdated' }); @@ -2423,15 +2393,15 @@ export class CoreFilepoolProvider { /** * Prefetches a list of files. * - * @param {string} siteId The site ID. - * @param {any[]} fileList List of files to download. - * @param {string} component The component to link the file to. - * @param {string|number} [componentId] An ID to identify the download. - * @param {string} [extra] Extra data to store for the package. - * @param {string} [dirPath] Name of the directory where to store the files (inside filepool dir). If not defined, store - * the files directly inside the filepool folder. - * @param {Function} [onProgress] Function to call on progress. - * @return {Promise} Promise resolved when all files are downloaded. + * @param siteId The site ID. + * @param fileList List of files to download. + * @param component The component to link the file to. + * @param componentId An ID to identify the download. + * @param extra Extra data to store for the package. + * @param dirPath Name of the directory where to store the files (inside filepool dir). If not defined, store + * the files directly inside the filepool folder. + * @param onProgress Function to call on progress. + * @return Promise resolved when all files are downloaded. */ prefetchPackage(siteId: string, fileList: any[], component: string, componentId?: string | number, extra?: string, dirPath?: string, onProgress?: (event: any) => any): Promise { @@ -2482,7 +2452,7 @@ export class CoreFilepoolProvider { /** * Process the most important queue item. * - * @return {Promise} Resolved on success. Rejected on failure. + * @return Resolved on success. Rejected on failure. */ protected processImportantQueueItem(): Promise { return this.appDB.getRecords(this.QUEUE_TABLE, undefined, 'priority DESC, added ASC', undefined, 0, 1).then((items) => { @@ -2502,8 +2472,8 @@ export class CoreFilepoolProvider { /** * Process a queue item. * - * @param {CoreFilepoolQueueEntry} item The object from the queue store. - * @return {Promise} Resolved on success. Rejected on failure. + * @param item The object from the queue store. + * @return Resolved on success. Rejected on failure. */ protected processQueueItem(item: CoreFilepoolQueueEntry): Promise { // Cast optional fields to undefined instead of null. @@ -2619,9 +2589,9 @@ export class CoreFilepoolProvider { /** * Remove a file from the queue. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. - * @return {Promise} Resolved on success. Rejected on failure. It is advised to silently ignore failures. + * @param siteId The site ID. + * @param fileId The file ID. + * @return Resolved on success. Rejected on failure. It is advised to silently ignore failures. */ protected removeFromQueue(siteId: string, fileId: string): Promise { return this.appDB.deleteRecords(this.QUEUE_TABLE, { siteId: siteId, fileId: fileId }); @@ -2630,9 +2600,9 @@ export class CoreFilepoolProvider { /** * Remove a file from the pool. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. - * @return {Promise} Resolved on success. + * @param siteId The site ID. + * @param fileId The file ID. + * @return Resolved on success. */ protected removeFileById(siteId: string, fileId: string): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -2667,10 +2637,10 @@ export class CoreFilepoolProvider { /** * Delete all the matching files from a component. * - * @param {string} siteId The site ID. - * @param {string} component The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @return {Promise} Resolved on success. + * @param siteId The site ID. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component. + * @return Resolved on success. */ removeFilesByComponent(siteId: string, component: string, componentId?: string | number): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -2685,9 +2655,9 @@ export class CoreFilepoolProvider { /** * Remove a file from the pool. * - * @param {string} siteId The site ID. - * @param {string} fileUrl The file URL. - * @return {Promise} Resolved on success, rejected on failure. + * @param siteId The site ID. + * @param fileUrl The file URL. + * @return Resolved on success, rejected on failure. */ removeFileByUrl(siteId: string, fileUrl: string): Promise { return this.fixPluginfileURL(siteId, fileUrl).then((fileUrl) => { @@ -2700,8 +2670,8 @@ export class CoreFilepoolProvider { /** * Removes the revision number from a file URL. * - * @param {string} url URL to remove the revision number. - * @return {string} URL without revision number. + * @param url URL to remove the revision number. + * @return URL without revision number. * @description * The revision is used to know if a file has changed. We remove it from the URL to prevent storing a file per revision. */ @@ -2718,10 +2688,10 @@ export class CoreFilepoolProvider { /** * Change the package status, setting it to the previous status. * - * @param {string} siteId Site ID. - * @param {string} component Package's component. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @return {Promise} Promise resolved when the status is changed. Resolve param: new status. + * @param siteId Site ID. + * @param component Package's component. + * @param componentId An ID to use in conjunction with the component. + * @return Promise resolved when the status is changed. Resolve param: new status. */ setPackagePreviousStatus(siteId: string, component: string, componentId?: string | number): Promise { componentId = this.fixComponentId(componentId); @@ -2754,9 +2724,9 @@ export class CoreFilepoolProvider { /** * Convenience function to check if a file should be downloaded before opening it. * - * @param {string} url File online URL. - * @param {number} size File size. - * @return {Promise} Promise resolved if should download before open, rejected otherwise. + * @param url File online URL. + * @param size File size. + * @return Promise resolved if should download before open, rejected otherwise. * @description * Convenience function to check if a file should be downloaded before opening it. * @@ -2787,12 +2757,12 @@ export class CoreFilepoolProvider { /** * Store package status. * - * @param {string} siteId Site ID. - * @param {string} status New package status. - * @param {string} component Package's component. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {string} [extra] Extra data to store for the package. If you want to store more than 1 value, use JSON.stringify. - * @return {Promise} Promise resolved when status is stored. + * @param siteId Site ID. + * @param status New package status. + * @param component Package's component. + * @param componentId An ID to use in conjunction with the component. + * @param extra Extra data to store for the package. If you want to store more than 1 value, use JSON.stringify. + * @return Promise resolved when status is stored. */ storePackageStatus(siteId: string, status: string, component: string, componentId?: string | number, extra?: string) : Promise { @@ -2859,13 +2829,13 @@ export class CoreFilepoolProvider { * Search for files in a CSS code and try to download them. Once downloaded, replace their URLs * and store the result in the CSS file. * - * @param {string} siteId Site ID. - * @param {string} fileUrl CSS file URL. - * @param {string} cssCode CSS code. - * @param {string} [component] The component to link the file to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {number} [revision] Revision to use in all files. If not defined, it will be calculated using the URL of each file. - * @return {Promise} Promise resolved with the CSS code. + * @param siteId Site ID. + * @param fileUrl CSS file URL. + * @param cssCode CSS code. + * @param component The component to link the file to. + * @param componentId An ID to use in conjunction with the component. + * @param revision Revision to use in all files. If not defined, it will be calculated using the URL of each file. + * @return Promise resolved with the CSS code. */ treatCSSCode(siteId: string, fileUrl: string, cssCode: string, component?: string, componentId?: string | number, revision?: number): Promise { @@ -2910,7 +2880,7 @@ export class CoreFilepoolProvider { /** * Remove extension from fileId in queue, used to migrate from previous file handling. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ treatExtensionInQueue(): Promise { this.logger.debug('Treat extensions in queue'); @@ -2938,10 +2908,10 @@ export class CoreFilepoolProvider { /** * Resolves or rejects a queue deferred and removes it from the list. * - * @param {string} siteId The site ID. - * @param {string} fileId The file ID. - * @param {boolean} resolve True if promise should be resolved, false if it should be rejected. - * @param {string} error String identifier for error message, if rejected. + * @param siteId The site ID. + * @param fileId The file ID. + * @param resolve True if promise should be resolved, false if it should be rejected. + * @param error String identifier for error message, if rejected. */ protected treatQueueDeferred(siteId: string, fileId: string, resolve: boolean, error?: string): void { if (this.queueDeferreds[siteId] && this.queueDeferreds[siteId][fileId]) { @@ -2957,10 +2927,10 @@ export class CoreFilepoolProvider { /** * Trigger mmCoreEventPackageStatusChanged with the right data. * - * @param {string} siteId Site ID. - * @param {string} status New package status. - * @param {string} component Package's component. - * @param {string|number} [componentId] An ID to use in conjunction with the component. + * @param siteId Site ID. + * @param status New package status. + * @param component Package's component. + * @param componentId An ID to use in conjunction with the component. */ protected triggerPackageStatusChanged(siteId: string, status: string, component: string, componentId?: string | number): void { const data = { @@ -2976,10 +2946,10 @@ export class CoreFilepoolProvider { * This function should be used if a package generates some new data during a download. Calling this function * right after generating the data in the download will prevent detecting this data as an update. * - * @param {string} siteId Site ID. - * @param {string} component Package's component. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @return {Promise} Promise resolved when status is stored. + * @param siteId Site ID. + * @param component Package's component. + * @param componentId An ID to use in conjunction with the component. + * @return Promise resolved when status is stored. */ updatePackageDownloadTime(siteId: string, component: string, componentId?: string | number): Promise { componentId = this.fixComponentId(componentId); diff --git a/src/providers/groups.ts b/src/providers/groups.ts index 35d0d2e11..f4bf56593 100644 --- a/src/providers/groups.ts +++ b/src/providers/groups.ts @@ -24,25 +24,21 @@ import { CoreSite, CoreSiteWSPreSets } from '@classes/site'; export interface CoreGroupInfo { /** * List of groups. - * @type {any[]} */ groups?: any[]; /** * Whether it's separate groups. - * @type {boolean} */ separateGroups?: boolean; /** * Whether it's visible groups. - * @type {boolean} */ visibleGroups?: boolean; /** * The group ID to use by default. If all participants is visible, 0 will be used. First group ID otherwise. - * @type {number} */ defaultGroupId?: number; } @@ -64,10 +60,10 @@ export class CoreGroupsProvider { /** * Check if group mode of an activity is enabled. * - * @param {number} cmId Course module ID. - * @param {string} [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). - * @return {Promise} Promise resolved with true if the activity has groups, resolved with false otherwise. + * @param cmId Course module ID. + * @param siteId Site ID. If not defined, current site. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved with true if the activity has groups, resolved with false otherwise. */ activityHasGroups(cmId: number, siteId?: string, ignoreCache?: boolean): Promise { return this.getActivityGroupMode(cmId, siteId, ignoreCache).then((groupmode) => { @@ -80,11 +76,11 @@ export class CoreGroupsProvider { /** * Get the groups allowed in an activity. * - * @param {number} cmId Course module ID. - * @param {number} [userId] User ID. If not defined, use current user. - * @param {string} [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). - * @return {Promise} Promise resolved when the groups are retrieved. + * @param cmId Course module ID. + * @param userId User ID. If not defined, use current user. + * @param siteId Site ID. If not defined, current site. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved when the groups are retrieved. */ getActivityAllowedGroups(cmId: number, userId?: number, siteId?: string, ignoreCache?: boolean): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -117,9 +113,9 @@ export class CoreGroupsProvider { /** * Get cache key for group mode WS calls. * - * @param {number} cmId Course module ID. - * @param {number} userId User ID. - * @return {string} Cache key. + * @param cmId Course module ID. + * @param userId User ID. + * @return Cache key. */ protected getActivityAllowedGroupsCacheKey(cmId: number, userId: number): string { return this.ROOT_CACHE_KEY + 'allowedgroups:' + cmId + ':' + userId; @@ -128,11 +124,11 @@ export class CoreGroupsProvider { /** * Get the groups allowed in an activity if they are allowed. * - * @param {number} cmId Course module ID. - * @param {number} [userId] User ID. If not defined, use current user. - * @param {string} [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). - * @return {Promise} Promise resolved when the groups are retrieved. If not allowed, empty array will be returned. + * @param cmId Course module ID. + * @param userId User ID. If not defined, use current user. + * @param siteId Site ID. If not defined, current site. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved when the groups are retrieved. If not allowed, empty array will be returned. */ getActivityAllowedGroupsIfEnabled(cmId: number, userId?: number, siteId?: string, ignoreCache?: boolean): Promise { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -153,12 +149,12 @@ export class CoreGroupsProvider { /** * Helper function to get activity group info (group mode and list of groups). * - * @param {number} cmId Course module ID. - * @param {boolean} [addAllParts] Deprecated. - * @param {number} [userId] User ID. If not defined, use current user. - * @param {string} [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). - * @return {Promise} Promise resolved with the group info. + * @param cmId Course module ID. + * @param addAllParts Deprecated. + * @param userId User ID. If not defined, use current user. + * @param siteId Site ID. If not defined, current site. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved with the group info. */ getActivityGroupInfo(cmId: number, addAllParts?: boolean, userId?: number, siteId?: string, ignoreCache?: boolean) : Promise { @@ -203,10 +199,10 @@ export class CoreGroupsProvider { /** * Get the group mode of an activity. * - * @param {number} cmId Course module ID. - * @param {string} [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). - * @return {Promise} Promise resolved when the group mode is retrieved. + * @param cmId Course module ID. + * @param siteId Site ID. If not defined, current site. + * @param ignoreCache True if it should ignore cached data (it will always fail in offline or server down). + * @return Promise resolved when the group mode is retrieved. */ getActivityGroupMode(cmId: number, siteId?: string, ignoreCache?: boolean): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -236,8 +232,8 @@ export class CoreGroupsProvider { /** * Get cache key for group mode WS calls. * - * @param {number} cmId Course module ID. - * @return {string} Cache key. + * @param cmId Course module ID. + * @return Cache key. */ protected getActivityGroupModeCacheKey(cmId: number): string { return this.ROOT_CACHE_KEY + 'groupmode:' + cmId; @@ -246,8 +242,8 @@ export class CoreGroupsProvider { /** * Get user groups in all the user enrolled courses. * - * @param {string} [siteId] Site to get the groups from. If not defined, use current site. - * @return {Promise} Promise resolved when the groups are retrieved. + * @param siteId Site to get the groups from. If not defined, use current site. + * @return Promise resolved when the groups are retrieved. */ getAllUserGroups(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -268,10 +264,10 @@ export class CoreGroupsProvider { /** * Get user groups in all the supplied courses. * - * @param {any[]} courses List of courses or course ids to get the groups from. - * @param {string} [siteId] Site to get the groups from. If not defined, use current site. - * @param {number} [userId] ID of the user. If not defined, use the userId related to siteId. - * @return {Promise} Promise resolved when the groups are retrieved. + * @param courses List of courses or course ids to get the groups from. + * @param siteId Site to get the groups from. If not defined, use current site. + * @param userId ID of the user. If not defined, use the userId related to siteId. + * @return Promise resolved when the groups are retrieved. */ getUserGroups(courses: any[], siteId?: string, userId?: number): Promise { // Get all courses one by one. @@ -289,10 +285,10 @@ export class CoreGroupsProvider { /** * Get user groups in a course. * - * @param {number} courseId ID of the course. 0 to get all enrolled courses groups (Moodle version > 3.6). - * @param {string} [siteId] Site to get the groups from. If not defined, use current site. - * @param {number} [userId] ID of the user. If not defined, use ID related to siteid. - * @return {Promise} Promise resolved when the groups are retrieved. + * @param courseId ID of the course. 0 to get all enrolled courses groups (Moodle version > 3.6). + * @param siteId Site to get the groups from. If not defined, use current site. + * @param userId ID of the user. If not defined, use ID related to siteid. + * @return Promise resolved when the groups are retrieved. */ getUserGroupsInCourse(courseId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -319,7 +315,7 @@ export class CoreGroupsProvider { /** * Get prefix cache key for user groups in course WS calls. * - * @return {string} Prefix Cache key. + * @return Prefix Cache key. */ protected getUserGroupsInCoursePrefixCacheKey(): string { return this.ROOT_CACHE_KEY + 'courseGroups:'; @@ -328,9 +324,9 @@ export class CoreGroupsProvider { /** * Get cache key for user groups in course WS calls. * - * @param {number} courseId Course ID. - * @param {number} userId User ID. - * @return {string} Cache key. + * @param courseId Course ID. + * @param userId User ID. + * @return Cache key. */ protected getUserGroupsInCourseCacheKey(courseId: number, userId: number): string { return this.getUserGroupsInCoursePrefixCacheKey() + courseId + ':' + userId; @@ -339,10 +335,10 @@ export class CoreGroupsProvider { /** * Invalidates activity allowed groups. * - * @param {number} cmId Course module ID. - * @param {number} [userId] User ID. If not defined, use current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param cmId Course module ID. + * @param userId User ID. If not defined, use current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateActivityAllowedGroups(cmId: number, userId?: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -355,9 +351,9 @@ export class CoreGroupsProvider { /** * Invalidates activity group mode. * - * @param {number} cmId Course module ID. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param cmId Course module ID. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateActivityGroupMode(cmId: number, siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -368,10 +364,10 @@ export class CoreGroupsProvider { /** * Invalidates all activity group info: mode and allowed groups. * - * @param {number} cmId Course module ID. - * @param {number} [userId] User ID. If not defined, use current user. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param cmId Course module ID. + * @param userId User ID. If not defined, use current user. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateActivityGroupInfo(cmId: number, userId?: number, siteId?: string): Promise { const promises = []; @@ -384,8 +380,8 @@ export class CoreGroupsProvider { /** * Invalidates user groups in all user enrolled courses. * - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved when the data is invalidated. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved when the data is invalidated. */ invalidateAllUserGroups(siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -400,10 +396,10 @@ export class CoreGroupsProvider { /** * Invalidates user groups in courses. * - * @param {any[]} courses List of courses or course ids. - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, use current user. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courses List of courses or course ids. + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, use current user. + * @return Promise resolved when the data is invalidated. */ invalidateUserGroups(courses: any[], siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -422,10 +418,10 @@ export class CoreGroupsProvider { /** * Invalidates user groups in course. * - * @param {number} courseId ID of the course. 0 to get all enrolled courses groups (Moodle version > 3.6). - * @param {string} [siteId] Site ID. If not defined, current site. - * @param {number} [userId] User ID. If not defined, use current user. - * @return {Promise} Promise resolved when the data is invalidated. + * @param courseId ID of the course. 0 to get all enrolled courses groups (Moodle version > 3.6). + * @param siteId Site ID. If not defined, current site. + * @param userId User ID. If not defined, use current user. + * @return Promise resolved when the data is invalidated. */ invalidateUserGroupsInCourse(courseId: number, siteId?: string, userId?: number): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -438,9 +434,9 @@ export class CoreGroupsProvider { /** * Validate a group ID. If the group is not visible by the user, it will return the first group ID. * - * @param {number} groupId Group ID to validate. - * @param {CoreGroupInfo} groupInfo Group info. - * @return {number} Group ID to use. + * @param groupId Group ID to validate. + * @param groupInfo Group info. + * @return Group ID to use. */ validateGroupId(groupId: number, groupInfo: CoreGroupInfo): number { if (groupId > 0 && groupInfo && groupInfo.groups && groupInfo.groups.length > 0) { diff --git a/src/providers/init.ts b/src/providers/init.ts index e06ce450d..e0a8d331d 100644 --- a/src/providers/init.ts +++ b/src/providers/init.ts @@ -23,26 +23,23 @@ import { CoreUtilsProvider } from './utils/utils'; export interface CoreInitHandler { /** * A name to identify the handler. - * @type {string} */ name: string; /** * Function to execute during the init process. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ load(): Promise; /** * The highest priority is executed first. You should use values lower than MAX_RECOMMENDED_PRIORITY. - * @type {number} */ priority?: number; /** * Set this to true when this process should be resolved before any following one. - * @type {boolean} */ blocking?: boolean; } @@ -107,7 +104,7 @@ export class CoreInitDelegate { /** * Instantly returns if the app is ready. * - * @return {boolean} Whether it's ready. + * @return Whether it's ready. */ isReady(): boolean { return this.readiness.resolved; @@ -116,8 +113,8 @@ export class CoreInitDelegate { /** * Convenience function to return a function that executes the process. * - * @param {CoreInitHandler} data The data of the process. - * @return {Promise} Promise of the process. + * @param data The data of the process. + * @return Promise of the process. */ protected prepareProcess(data: CoreInitHandler): Promise { let promise; @@ -138,7 +135,7 @@ export class CoreInitDelegate { /** * Notifies when the app is ready. This returns a promise that is resolved when the app is initialised. * - * @return {Promise} Resolved when the app is initialised. Never rejected. + * @return Resolved when the app is initialised. Never rejected. */ ready(): Promise { if (typeof this.readiness === 'undefined') { @@ -161,7 +158,7 @@ export class CoreInitDelegate { * * This delegate cannot be used by site plugins. * - * @param {CoreInitHandler} instance The instance of the handler. + * @param instance The instance of the handler. */ registerProcess(handler: CoreInitHandler): void { if (typeof handler.priority == 'undefined') { diff --git a/src/providers/lang.ts b/src/providers/lang.ts index 68463d4e3..acf8ec8ca 100644 --- a/src/providers/lang.ts +++ b/src/providers/lang.ts @@ -53,9 +53,9 @@ export class CoreLangProvider { /** * Add a set of site plugins strings for a certain language. * - * @param {string} lang The language where to add the strings. - * @param {any} strings Object with the strings to add. - * @param {string} [prefix] A prefix to add to all keys. + * @param lang The language where to add the strings. + * @param strings Object with the strings to add. + * @param prefix A prefix to add to all keys. */ addSitePluginsStrings(lang: string, strings: any, prefix?: string): void { lang = lang.replace(/_/g, '-'); // Use the app format instead of Moodle format. @@ -90,8 +90,8 @@ export class CoreLangProvider { * Capitalize a string (make the first letter uppercase). * We cannot use a function from text utils because it would cause a circular dependency. * - * @param {string} value String to capitalize. - * @return {string} Capitalized string. + * @param value String to capitalize. + * @return Capitalized string. */ protected capitalize(value: string): string { return value.charAt(0).toUpperCase() + value.slice(1); @@ -100,8 +100,8 @@ export class CoreLangProvider { /** * Change current language. * - * @param {string} language New language to use. - * @return {Promise} Promise resolved when the change is finished. + * @param language New language to use. + * @return Promise resolved when the change is finished. */ changeCurrentLanguage(language: string): Promise { const promises = []; @@ -191,7 +191,7 @@ export class CoreLangProvider { /** * Get all current custom strings. * - * @return {any} Custom strings. + * @return Custom strings. */ getAllCustomStrings(): any { return this.customStrings; @@ -200,7 +200,7 @@ export class CoreLangProvider { /** * Get all current site plugins strings. * - * @return {any} Site plugins strings. + * @return Site plugins strings. */ getAllSitePluginsStrings(): any { return this.sitePluginsStrings; @@ -209,7 +209,7 @@ export class CoreLangProvider { /** * Get current language. * - * @return {Promise} Promise resolved with the current language. + * @return Promise resolved with the current language. */ getCurrentLanguage(): Promise { @@ -263,7 +263,7 @@ export class CoreLangProvider { /** * Get the default language. * - * @return {string} Default language. + * @return Default language. */ getDefaultLanguage(): string { return this.defaultLanguage; @@ -272,7 +272,7 @@ export class CoreLangProvider { /** * Get the fallback language. * - * @return {string} Fallback language. + * @return Fallback language. */ getFallbackLanguage(): string { return this.fallbackLanguage; @@ -281,8 +281,8 @@ export class CoreLangProvider { /** * Get the full list of translations for a certain language. * - * @param {string} lang The language to check. - * @return {Promise} Promise resolved when done. + * @param lang The language to check. + * @return Promise resolved when done. */ getTranslationTable(lang: string): Promise { // Create a promise to convert the observable into a promise. @@ -300,7 +300,7 @@ export class CoreLangProvider { /** * Load certain custom strings. * - * @param {string} strings Custom strings to load (tool_mobile_customlangstrings). + * @param strings Custom strings to load (tool_mobile_customlangstrings). */ loadCustomStrings(strings: string): void { if (strings == this.customStringsRaw) { @@ -345,9 +345,9 @@ export class CoreLangProvider { /** * Load custom strings for a certain language that weren't loaded because the language wasn't active. * - * @param {any} langObject The object with the strings to load. - * @param {string} lang Language to load. - * @return {boolean} Whether the translation table was modified. + * @param langObject The object with the strings to load. + * @param lang Language to load. + * @return Whether the translation table was modified. */ loadLangStrings(langObject: any, lang: string): boolean { let langApplied = false; @@ -375,10 +375,10 @@ export class CoreLangProvider { /** * Load a string in a certain lang object and in the translate table if the lang is loaded. * - * @param {any} langObject The object where to store the lang. - * @param {string} lang Language code. - * @param {string} key String key. - * @param {string} value String value. + * @param langObject The object where to store the lang. + * @param lang Language code. + * @param key String key. + * @param value String value. */ loadString(langObject: any, lang: string, key: string, value: string): void { lang = lang.replace(/_/g, '-'); // Use the app format instead of Moodle format. @@ -407,7 +407,7 @@ export class CoreLangProvider { /** * Unload custom or site plugin strings, removing them from the translations table. * - * @param {any} strings Strings to unload. + * @param strings Strings to unload. */ protected unloadStrings(strings: any): void { // Iterate over all languages and strings. diff --git a/src/providers/local-notifications.ts b/src/providers/local-notifications.ts index ae9de1652..712f3eac8 100644 --- a/src/providers/local-notifications.ts +++ b/src/providers/local-notifications.ts @@ -163,10 +163,10 @@ export class CoreLocalNotificationsProvider { /** * Cancel a local notification. * - * @param {number} id Notification id. - * @param {string} component Component of the notification. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when the notification is cancelled. + * @param id Notification id. + * @param component Component of the notification. + * @param siteId Site ID. + * @return Promise resolved when the notification is cancelled. */ cancel(id: number, component: string, siteId: string): Promise { return this.getUniqueNotificationId(id, component, siteId).then((uniqueId) => { @@ -177,8 +177,8 @@ export class CoreLocalNotificationsProvider { /** * Cancel all the scheduled notifications belonging to a certain site. * - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when the notifications are cancelled. + * @param siteId Site ID. + * @return Promise resolved when the notifications are cancelled. */ cancelSiteNotifications(siteId: string): Promise { @@ -208,7 +208,7 @@ export class CoreLocalNotificationsProvider { /** * Check whether sound can be disabled for notifications. * - * @return {boolean} Whether sound can be disabled for notifications. + * @return Whether sound can be disabled for notifications. */ canDisableSound(): boolean { // Only allow disabling sound in Android 7 or lower. In iOS and Android 8+ it can easily be done with system settings. @@ -219,7 +219,7 @@ export class CoreLocalNotificationsProvider { /** * Create the default channel. It is used to change the name. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected createDefaultChannel(): Promise { if (!this.platform.is('android')) { @@ -238,9 +238,9 @@ export class CoreLocalNotificationsProvider { /** * Get a code to create unique notifications. If there's no code assigned, create a new one. * - * @param {string} table Table to search in local DB. - * @param {string} id ID of the element to get its code. - * @return {Promise} Promise resolved when the code is retrieved. + * @param table Table to search in local DB. + * @param id ID of the element to get its code. + * @return Promise resolved when the code is retrieved. */ protected getCode(table: string, id: string): Promise { const key = table + '#' + id; @@ -276,8 +276,8 @@ export class CoreLocalNotificationsProvider { * Get a notification component code to be used. * If it's the first time this component is used to send notifications, create a new code for it. * - * @param {string} component Component name. - * @return {Promise} Promise resolved when the component code is retrieved. + * @param component Component name. + * @return Promise resolved when the component code is retrieved. */ protected getComponentCode(component: string): Promise { return this.requestCode(this.COMPONENTS_TABLE, component); @@ -287,8 +287,8 @@ export class CoreLocalNotificationsProvider { * Get a site code to be used. * If it's the first time this site is used to send notifications, create a new code for it. * - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when the site code is retrieved. + * @param siteId Site ID. + * @return Promise resolved when the site code is retrieved. */ protected getSiteCode(siteId: string): Promise { return this.requestCode(this.SITES_TABLE, siteId); @@ -302,10 +302,10 @@ export class CoreLocalNotificationsProvider { * -There are less than 11 components. * -The notificationId passed as parameter is lower than 10000000. * - * @param {number} notificationId Notification ID. - * @param {string} component Component triggering the notification. - * @param {string} siteId Site ID. - * @return {Promise} Promise resolved when the notification ID is generated. + * @param notificationId Notification ID. + * @param component Component triggering the notification. + * @param siteId Site ID. + * @return Promise resolved when the notification ID is generated. */ protected getUniqueNotificationId(notificationId: number, component: string, siteId: string): Promise { if (!siteId || !component) { @@ -323,8 +323,8 @@ export class CoreLocalNotificationsProvider { /** * Handle an event triggered by the local notifications plugin. * - * @param {string} eventName Name of the event. - * @param {any} notification Notification. + * @param eventName Name of the event. + * @param notification Notification. */ protected handleEvent(eventName: string, notification: any): void { if (notification && notification.data) { @@ -337,7 +337,7 @@ export class CoreLocalNotificationsProvider { /** * Returns whether local notifications plugin is installed. * - * @return {boolean} Whether local notifications plugin is installed. + * @return Whether local notifications plugin is installed. */ isAvailable(): boolean { const win = window; @@ -349,8 +349,8 @@ export class CoreLocalNotificationsProvider { /** * Check if a notification has been triggered with the same trigger time. * - * @param {ILocalNotification} notification Notification to check. - * @return {Promise} Promise resolved with a boolean indicating if promise is triggered (true) or not. + * @param notification Notification to check. + * @return Promise resolved with a boolean indicating if promise is triggered (true) or not. */ isTriggered(notification: ILocalNotification): Promise { return this.appDB.getRecord(this.TRIGGERED_TABLE, { id: notification.id }).then((stored) => { @@ -369,7 +369,7 @@ export class CoreLocalNotificationsProvider { /** * Notify notification click to observers. Only the observers with the same component as the notification will be notified. * - * @param {any} data Data received by the notification. + * @param data Data received by the notification. */ notifyClick(data: any): void { this.notifyEvent('click', data); @@ -378,8 +378,8 @@ export class CoreLocalNotificationsProvider { /** * Notify a certain event to observers. Only the observers with the same component as the notification will be notified. * - * @param {string} eventName Name of the event to notify. - * @param {any} data Data received by the notification. + * @param eventName Name of the event to notify. + * @param data Data received by the notification. */ notifyEvent(eventName: string, data: any): void { // Execute the code in the Angular zone, so change detection doesn't stop working. @@ -434,9 +434,9 @@ export class CoreLocalNotificationsProvider { /** * Register an observer to be notified when a notification belonging to a certain component is clicked. * - * @param {string} component Component to listen notifications for. - * @param {Function} callback Function to call with the data received by the notification. - * @return {any} Object with an "off" property to stop listening for clicks. + * @param component Component to listen notifications for. + * @param callback Function to call with the data received by the notification. + * @return Object with an "off" property to stop listening for clicks. */ registerClick(component: string, callback: Function): any { return this.registerObserver('click', component, callback); @@ -445,10 +445,10 @@ export class CoreLocalNotificationsProvider { /** * Register an observer to be notified when a certain event is fired for a notification belonging to a certain component. * - * @param {string} eventName Name of the event to listen to. - * @param {string} component Component to listen notifications for. - * @param {Function} callback Function to call with the data received by the notification. - * @return {any} Object with an "off" property to stop listening for events. + * @param eventName Name of the event to listen to. + * @param component Component to listen notifications for. + * @param callback Function to call with the data received by the notification. + * @return Object with an "off" property to stop listening for events. */ registerObserver(eventName: string, component: string, callback: Function): any { this.logger.debug(`Register observer '${component}' for event '${eventName}'.`); @@ -474,8 +474,8 @@ export class CoreLocalNotificationsProvider { /** * Remove a notification from triggered store. * - * @param {number} id Notification ID. - * @return {Promise} Promise resolved when it is removed. + * @param id Notification ID. + * @return Promise resolved when it is removed. */ removeTriggered(id: number): Promise { return this.appDB.deleteRecords(this.TRIGGERED_TABLE, { id: id }); @@ -484,9 +484,9 @@ export class CoreLocalNotificationsProvider { /** * Request a unique code. The request will be added to the queue and the queue is going to be started if it's paused. * - * @param {string} table Table to search in local DB. - * @param {string} id ID of the element to get its code. - * @return {Promise} Promise resolved when the code is retrieved. + * @param table Table to search in local DB. + * @param id ID of the element to get its code. + * @return Promise resolved when the code is retrieved. */ protected requestCode(table: string, id: string): Promise { const deferred = this.utils.promiseDefer(), @@ -515,7 +515,7 @@ export class CoreLocalNotificationsProvider { /** * Reschedule all notifications that are already scheduled. * - * @return {Promise} Promise resolved when all notifications have been rescheduled. + * @return Promise resolved when all notifications have been rescheduled. */ rescheduleAll(): Promise { // Get all the scheduled notifications. @@ -536,12 +536,12 @@ export class CoreLocalNotificationsProvider { /** * Schedule a local notification. * - * @param {ILocalNotification} notification Notification to schedule. Its ID should be lower than 10000000 and it should - * be unique inside its component and site. - * @param {string} component Component triggering the notification. It is used to generate unique IDs. - * @param {string} siteId Site ID. - * @param {boolean} [alreadyUnique] Whether the ID is already unique. - * @return {Promise} Promise resolved when the notification is scheduled. + * @param notification Notification to schedule. Its ID should be lower than 10000000 and it should + * be unique inside its component and site. + * @param component Component triggering the notification. It is used to generate unique IDs. + * @param siteId Site ID. + * @param alreadyUnique Whether the ID is already unique. + * @return Promise resolved when the notification is scheduled. */ schedule(notification: ILocalNotification, component: string, siteId: string, alreadyUnique?: boolean): Promise { let promise; @@ -578,8 +578,8 @@ export class CoreLocalNotificationsProvider { /** * Helper function to schedule a notification object if it hasn't been triggered already. * - * @param {ILocalNotification} notification Notification to schedule. - * @return {Promise} Promise resolved when scheduled. + * @param notification Notification to schedule. + * @return Promise resolved when scheduled. */ protected scheduleNotification(notification: ILocalNotification): Promise { // Check if the notification has been triggered already. @@ -619,7 +619,7 @@ export class CoreLocalNotificationsProvider { * This function was used because local notifications weren't displayed when the app was in foreground in iOS10+, * but the issue was fixed in the plugin and this function is no longer used. * - * @param {ILocalNotification} notification Notification. + * @param notification Notification. */ showNotificationPopover(notification: ILocalNotification): void { @@ -711,8 +711,8 @@ export class CoreLocalNotificationsProvider { * Function to call when a notification is triggered. Stores the notification so it's not scheduled again unless the * time is changed. * - * @param {ILocalNotification} notification Triggered notification. - * @return {Promise} Promise resolved when stored, rejected otherwise. + * @param notification Triggered notification. + * @return Promise resolved when stored, rejected otherwise. */ trigger(notification: ILocalNotification): Promise { const entry = { @@ -726,9 +726,9 @@ export class CoreLocalNotificationsProvider { /** * Update a component name. * - * @param {string} oldName The old name. - * @param {string} newName The new name. - * @return {Promise} Promise resolved when done. + * @param oldName The old name. + * @param newName The new name. + * @return Promise resolved when done. */ updateComponentName(oldName: string, newName: string): Promise { const oldId = this.COMPONENTS_TABLE + '#' + oldName, diff --git a/src/providers/logger.ts b/src/providers/logger.ts index 85a74e4d3..f3d989b32 100644 --- a/src/providers/logger.ts +++ b/src/providers/logger.ts @@ -38,8 +38,8 @@ export class CoreLoggerProvider { /** * Get a logger instance for a certain class, service or component. * - * @param {string} className Name to use in the messages. - * @return {ant} Instance. + * @param className Name to use in the messages. + * @return Instance. */ getInstance(className: string): any { className = className || ''; @@ -57,9 +57,9 @@ export class CoreLoggerProvider { /** * Prepare a logging function, concatenating the timestamp and class name to all messages. * - * @param {Function} logFn Log function to use. - * @param {string} className Name to use in the messages. - * @return {Function} Prepared function. + * @param logFn Log function to use. + * @param className Name to use in the messages. + * @return Prepared function. */ private prepareLogFn(logFn: Function, className: string): Function { // Return our own function that will call the logging function with the treated message. diff --git a/src/providers/plugin-file-delegate.ts b/src/providers/plugin-file-delegate.ts index 6f1e3e902..8708e7810 100644 --- a/src/providers/plugin-file-delegate.ts +++ b/src/providers/plugin-file-delegate.ts @@ -21,29 +21,27 @@ import { CoreLoggerProvider } from './logger'; export interface CorePluginFileHandler { /** * A name to identify the handler. - * @type {string} */ name: string; /** * The "component" of the handler. It should match the "component" of pluginfile URLs. - * @type {string} */ component: string; /** * Return the RegExp to match the revision on pluginfile URLs. * - * @param {string[]} args Arguments of the pluginfile URL defining component and filearea at least. - * @return {RegExp} RegExp to match the revision on pluginfile URLs. + * @param args Arguments of the pluginfile URL defining component and filearea at least. + * @return RegExp to match the revision on pluginfile URLs. */ getComponentRevisionRegExp?(args: string[]): RegExp; /** * Should return the string to remove the revision on pluginfile url. * - * @param {string[]} args Arguments of the pluginfile URL defining component and filearea at least. - * @return {string} String to remove the revision on pluginfile url. + * @param args Arguments of the pluginfile URL defining component and filearea at least. + * @return String to remove the revision on pluginfile url. */ getComponentRevisionReplace?(args: string[]): string; } @@ -63,8 +61,8 @@ export class CorePluginFileDelegate { /** * Get the handler for a certain pluginfile url. * - * @param {string} component Component of the plugin. - * @return {CorePluginFileHandler} Handler. Undefined if no handler found for the plugin. + * @param component Component of the plugin. + * @return Handler. Undefined if no handler found for the plugin. */ protected getPluginHandler(component: string): CorePluginFileHandler { if (typeof this.handlers[component] != 'undefined') { @@ -75,8 +73,8 @@ export class CorePluginFileDelegate { /** * Get the RegExp of the component and filearea described in the URL. * - * @param {string[]} args Arguments of the pluginfile URL defining component and filearea at least. - * @return {RegExp} RegExp to match the revision or undefined if not found. + * @param args Arguments of the pluginfile URL defining component and filearea at least. + * @return RegExp to match the revision or undefined if not found. */ getComponentRevisionRegExp(args: string[]): RegExp { // Get handler based on component (args[1]). @@ -90,8 +88,8 @@ export class CorePluginFileDelegate { /** * Register a handler. * - * @param {CorePluginFileHandler} handler The handler to register. - * @return {boolean} True if registered successfully, false otherwise. + * @param handler The handler to register. + * @return True if registered successfully, false otherwise. */ registerHandler(handler: CorePluginFileHandler): boolean { if (typeof this.handlers[handler.component] !== 'undefined') { @@ -109,9 +107,9 @@ export class CorePluginFileDelegate { /** * Removes the revision number from a file URL. * - * @param {string} url URL to be replaced. - * @param {string[]} args Arguments of the pluginfile URL defining component and filearea at least. - * @return {string} Replaced URL without revision. + * @param url URL to be replaced. + * @param args Arguments of the pluginfile URL defining component and filearea at least. + * @return Replaced URL without revision. */ removeRevisionFromUrl(url: string, args: string[]): string { // Get handler based on component (args[1]). diff --git a/src/providers/sites-factory.ts b/src/providers/sites-factory.ts index dda512f8c..5bb68cd11 100644 --- a/src/providers/sites-factory.ts +++ b/src/providers/sites-factory.ts @@ -26,14 +26,14 @@ export class CoreSitesFactoryProvider { /** * Make a site object. * - * @param {string} id Site ID. - * @param {string} siteUrl Site URL. - * @param {string} [token] Site's WS token. - * @param {any} [info] Site info. - * @param {string} [privateToken] Private token. - * @param {any} [config] Site public config. - * @param {boolean} [loggedOut] Whether user is logged out. - * @return {CoreSite} Site instance. + * @param id Site ID. + * @param siteUrl Site URL. + * @param token Site's WS token. + * @param info Site info. + * @param privateToken Private token. + * @param config Site public config. + * @param loggedOut Whether user is logged out. + * @return Site instance. * @description * This returns a site object. */ @@ -45,7 +45,7 @@ export class CoreSitesFactoryProvider { /** * Gets the list of Site methods. * - * @return {string[]} List of methods. + * @return List of methods. */ getSiteMethods(): string[] { const methods = []; diff --git a/src/providers/sites.ts b/src/providers/sites.ts index 515d7117a..5eafef8d8 100644 --- a/src/providers/sites.ts +++ b/src/providers/sites.ts @@ -36,31 +36,26 @@ import { WP_PROVIDER } from '@app/app.module'; export interface CoreSiteCheckResponse { /** * Code to identify the authentication method to use. - * @type {number} */ code: number; /** * Site url to use (might have changed during the process). - * @type {string} */ siteUrl: string; /** * Service used. - * @type {string} */ service: string; /** * Code of the warning message to show to the user. - * @type {string} */ warning?: string; /** * Site public config (if available). - * @type {any} */ config?: any; } @@ -71,19 +66,16 @@ export interface CoreSiteCheckResponse { export interface CoreSiteUserTokenResponse { /** * User token. - * @type {string} */ token: string; /** * Site URL to use. - * @type {string} */ siteUrl: string; /** * User private token. - * @type {string} */ privateToken?: string; } @@ -94,37 +86,31 @@ export interface CoreSiteUserTokenResponse { export interface CoreSiteBasicInfo { /** * Site ID. - * @type {string} */ id: string; /** * Site URL. - * @type {string} */ siteUrl: string; /** * User's full name. - * @type {string} */ fullName: string; /** * Site's name. - * @type {string} */ siteName: string; /** * User's avatar. - * @type {string} */ avatar: string; /** * Badge to display in the site. - * @type {number} */ badge?: number; } @@ -135,22 +121,16 @@ export interface CoreSiteBasicInfo { export interface CoreSiteSchema { /** * Name of the schema. - * - * @type {string} */ name: string; /** * Latest version of the schema (integer greater than 0). - * - * @type {number} */ version: number; /** * Names of the tables of the site schema that can be cleared. - * - * @type {string[]} */ canBeCleared?: string[]; @@ -164,10 +144,10 @@ export interface CoreSiteSchema { * * Called when installing and upgrading the schema, after creating the defined tables. * - * @param {SQLiteDB} db Site database. - * @param {number} oldVersion Old version of the schema or 0 if not installed. - * @param {string} siteId Site Id to migrate. - * @return {Promise | void} Promise resolved when done. + * @param db Site database. + * @param oldVersion Old version of the schema or 0 if not installed. + * @param siteId Site Id to migrate. + * @return Promise resolved when done. */ migrate?(db: SQLiteDB, oldVersion: number, siteId: string): Promise | void; } @@ -338,8 +318,8 @@ export class CoreSitesProvider { /** * Get the demo data for a certain "name" if it is a demo site. * - * @param {string} name Name of the site to check. - * @return {any} Site data if it's a demo site, undefined otherwise. + * @param name Name of the site to check. + * @return Site data if it's a demo site, undefined otherwise. */ getDemoSiteData(name: string): any { const demoSites = CoreConfigConstants.demo_sites; @@ -352,9 +332,9 @@ export class CoreSitesProvider { * Check if a site is valid and if it has specifics settings for authentication (like force to log in using the browser). * It will test both protocols if the first one fails: http and https. * - * @param {string} siteUrl URL of the site to check. - * @param {string} [protocol=https://] Protocol to use first. - * @return {Promise} A promise resolved when the site is checked. + * @param siteUrl URL of the site to check. + * @param protocol Protocol to use first. + * @return A promise resolved when the site is checked. */ checkSite(siteUrl: string, protocol: string = 'https://'): Promise { // The formatURL function adds the protocol if is missing. @@ -395,9 +375,9 @@ export class CoreSitesProvider { /** * Helper function to check if a site is valid and if it has specifics settings for authentication. * - * @param {string} siteUrl URL of the site to check. - * @param {string} protocol Protocol to use. - * @return {Promise} A promise resolved when the site is checked. + * @param siteUrl URL of the site to check. + * @param protocol Protocol to use. + * @return A promise resolved when the site is checked. */ checkSiteWithProtocol(siteUrl: string, protocol: string): Promise { let publicConfig; @@ -515,8 +495,8 @@ export class CoreSitesProvider { /** * Check if a site exists. * - * @param {string} siteUrl URL of the site to check. - * @return {Promise} A promise to be resolved if the site exists. + * @param siteUrl URL of the site to check. + * @return A promise to be resolved if the site exists. */ siteExists(siteUrl: string): Promise { return this.http.post(siteUrl + '/login/token.php', {}).timeout(this.wsProvider.getRequestTimeout()).toPromise() @@ -537,12 +517,12 @@ export class CoreSitesProvider { /** * Gets a user token from the server. * - * @param {string} siteUrl The site url. - * @param {string} username User name. - * @param {string} password Password. - * @param {string} [service] Service to use. If not defined, it will be searched in memory. - * @param {boolean} [retry] Whether we are retrying with a prefixed URL. - * @return {Promise} A promise resolved when the token is retrieved. + * @param siteUrl The site url. + * @param username User name. + * @param password Password. + * @param service Service to use. If not defined, it will be searched in memory. + * @param retry Whether we are retrying with a prefixed URL. + * @return A promise resolved when the token is retrieved. */ getUserToken(siteUrl: string, username: string, password: string, service?: string, retry?: boolean) : Promise { @@ -603,11 +583,11 @@ export class CoreSitesProvider { /** * Add a new site to the site list and authenticate the user in this site. * - * @param {string} siteUrl The site url. - * @param {string} token User's token. - * @param {string} [privateToken=''] User's private token. - * @param {boolean} [login=true] Whether to login the user in the site. Defaults to true. - * @return {Promise} A promise resolved with siteId when the site is added and the user is authenticated. + * @param siteUrl The site url. + * @param token User's token. + * @param privateToken User's private token. + * @param login Whether to login the user in the site. Defaults to true. + * @return A promise resolved with siteId when the site is added and the user is authenticated. */ newSite(siteUrl: string, token: string, privateToken: string = '', login: boolean = true): Promise { if (typeof login != 'boolean') { @@ -683,10 +663,10 @@ export class CoreSitesProvider { /** * Having the result of isValidMoodleVersion, it treats the error message to be shown. * - * @param {number} result Result returned by isValidMoodleVersion function. - * @param {string} siteUrl The site url. - * @param {string} siteId If site is already added, it will invalidate the token. - * @return {Promise} A promise rejected with the error info. + * @param result Result returned by isValidMoodleVersion function. + * @param siteUrl The site url. + * @param siteId If site is already added, it will invalidate the token. + * @return A promise rejected with the error info. */ protected treatInvalidAppVersion(result: number, siteUrl: string, siteId?: string): Promise { let errorCode, @@ -742,9 +722,9 @@ export class CoreSitesProvider { /** * Create a site ID based on site URL and username. * - * @param {string} siteUrl The site url. - * @param {string} username Username. - * @return {string} Site ID. + * @param siteUrl The site url. + * @param username Username. + * @return Site ID. */ createSiteID(siteUrl: string, username: string): string { return Md5.hashAsciiStr(siteUrl + username); @@ -753,8 +733,8 @@ export class CoreSitesProvider { /** * Function for determine which service we should use (default or extended plugin). * - * @param {string} siteUrl The site URL. - * @return {string} The service shortname. + * @param siteUrl The site URL. + * @return The service shortname. */ determineService(siteUrl: string): string { // We need to try siteUrl in both https or http (due to loginhttps setting). @@ -778,8 +758,8 @@ export class CoreSitesProvider { /** * Check for the minimum required version. * - * @param {any} info Site info. - * @return {number} Either VALID_VERSION, LEGACY_APP_VERSION, WORKPLACE_APP, MOODLE_APP or INVALID_VERSION. + * @param info Site info. + * @return Either VALID_VERSION, LEGACY_APP_VERSION, WORKPLACE_APP, MOODLE_APP or INVALID_VERSION. */ protected isValidMoodleVersion(info: any): number { if (!info) { @@ -821,8 +801,8 @@ export class CoreSitesProvider { /** * Check if needs to be redirected to specific Workplace App or general Moodle App. * - * @param {any} info Site info. - * @return {number} Either VALID_VERSION, WORKPLACE_APP or MOODLE_APP. + * @param info Site info. + * @return Either VALID_VERSION, WORKPLACE_APP or MOODLE_APP. */ protected validateWorkplaceVersion(info: any): number { const isWorkplace = !!info.functions && info.functions.some((func) => { @@ -848,8 +828,8 @@ export class CoreSitesProvider { /** * Returns the release number from site release info. * - * @param {string} rawRelease Raw release info text. - * @return {string} Release number or empty. + * @param rawRelease Raw release info text. + * @return Release number or empty. */ getReleaseNumber(rawRelease: string): string { const matches = rawRelease.match(/^\d(\.\d(\.\d+)?)?/); @@ -863,8 +843,8 @@ export class CoreSitesProvider { /** * Check if site info is valid. If it's not, return error message. * - * @param {any} info Site info. - * @return {any} True if valid, object with error message to show and its params if not valid. + * @param info Site info. + * @return True if valid, object with error message to show and its params if not valid. */ protected validateSiteInfo(info: any): any { if (!info.firstname || !info.lastname) { @@ -879,13 +859,13 @@ export class CoreSitesProvider { /** * Saves a site in local DB. * - * @param {string} id Site ID. - * @param {string} siteUrl Site URL. - * @param {string} token User's token in the site. - * @param {any} info Site's info. - * @param {string} [privateToken=''] User's private token. - * @param {any} [config] Site config (from tool_mobile_get_config). - * @return {Promise} Promise resolved when done. + * @param id Site ID. + * @param siteUrl Site URL. + * @param token User's token in the site. + * @param info Site's info. + * @param privateToken User's private token. + * @param config Site config (from tool_mobile_get_config). + * @return Promise resolved when done. */ addSite(id: string, siteUrl: string, token: string, info: any, privateToken: string = '', config?: any): Promise { const entry = { @@ -904,10 +884,10 @@ export class CoreSitesProvider { /** * Login a user to a site from the list of sites. * - * @param {string} siteId ID of the site to load. - * @param {string} [pageName] Name of the page to go once authenticated if logged out. If not defined, site initial page. - * @param {any} [params] Params of the page to go once authenticated if logged out. - * @return {Promise} Promise resolved with true if site is loaded, resolved with false if cannot login. + * @param siteId ID of the site to load. + * @param pageName Name of the page to go once authenticated if logged out. If not defined, site initial page. + * @param params Params of the page to go once authenticated if logged out. + * @return Promise resolved with true if site is loaded, resolved with false if cannot login. */ loadSite(siteId: string, pageName?: string, params?: any): Promise { this.logger.debug(`Load site ${siteId}`); @@ -948,7 +928,7 @@ export class CoreSitesProvider { /** * Get current site. * - * @return {CoreSite} Current site. + * @return Current site. */ getCurrentSite(): CoreSite { return this.currentSite; @@ -957,7 +937,7 @@ export class CoreSitesProvider { /** * Get the site home ID of the current site. * - * @return {number} Current site home ID. + * @return Current site home ID. */ getCurrentSiteHomeId(): number { if (this.currentSite) { @@ -970,7 +950,7 @@ export class CoreSitesProvider { /** * Get current site ID. * - * @return {string} Current site ID. + * @return Current site ID. */ getCurrentSiteId(): string { if (this.currentSite) { @@ -983,7 +963,7 @@ export class CoreSitesProvider { /** * Get current site User ID. * - * @return {number} Current site User ID. + * @return Current site User ID. */ getCurrentSiteUserId(): number { if (this.currentSite) { @@ -996,7 +976,7 @@ export class CoreSitesProvider { /** * Check if the user is logged in a site. * - * @return {boolean} Whether the user is logged in a site. + * @return Whether the user is logged in a site. */ isLoggedIn(): boolean { return typeof this.currentSite != 'undefined' && typeof this.currentSite.token != 'undefined' && @@ -1006,8 +986,8 @@ export class CoreSitesProvider { /** * Delete a site from the sites list. * - * @param {string} siteId ID of the site to delete. - * @return {Promise} Promise to be resolved when the site is deleted. + * @param siteId ID of the site to delete. + * @return Promise to be resolved when the site is deleted. */ deleteSite(siteId: string): Promise { this.logger.debug(`Delete site ${siteId}`); @@ -1037,7 +1017,7 @@ export class CoreSitesProvider { /** * Check if there are sites stored. * - * @return {Promise} Promise resolved with true if there are sites and false if there aren't. + * @return Promise resolved with true if there are sites and false if there aren't. */ hasSites(): Promise { return this.appDB.countRecords(this.SITES_TABLE).then((count) => { @@ -1048,8 +1028,8 @@ export class CoreSitesProvider { /** * Returns a site object. * - * @param {string} [siteId] The site ID. If not defined, current site (if available). - * @return {Promise} Promise resolved with the site. + * @param siteId The site ID. If not defined, current site (if available). + * @return Promise resolved with the site. */ getSite(siteId?: string): Promise { if (!siteId) { @@ -1069,8 +1049,8 @@ export class CoreSitesProvider { /** * Create a site from an entry of the sites list DB. The new site is added to the list of "cached" sites: this.sites. * - * @param {any} entry Site list entry. - * @return {Promise} Promised resolved with the created site. + * @param entry Site list entry. + * @return Promised resolved with the created site. */ makeSiteFromSiteListEntry(entry: any): Promise { let site: CoreSite, @@ -1095,8 +1075,8 @@ export class CoreSitesProvider { /** * Returns if the site is the current one. * - * @param {string|CoreSite} [site] Site object or siteId to be compared. If not defined, use current site. - * @return {boolean} Whether site or siteId is the current one. + * @param site Site object or siteId to be compared. If not defined, use current site. + * @return Whether site or siteId is the current one. */ isCurrentSite(site: string | CoreSite): boolean { if (!site || !this.currentSite) { @@ -1111,8 +1091,8 @@ export class CoreSitesProvider { /** * Returns the database object of a site. * - * @param {string} [siteId] The site ID. If not defined, current site (if available). - * @return {Promise} Promise resolved with the database. + * @param siteId The site ID. If not defined, current site (if available). + * @return Promise resolved with the database. */ getSiteDb(siteId: string): Promise { return this.getSite(siteId).then((site) => { @@ -1123,8 +1103,8 @@ export class CoreSitesProvider { /** * Returns the site home ID of a site. * - * @param {number} [siteId] The site ID. If not defined, current site (if available). - * @return {Promise} Promise resolved with site home ID. + * @param siteId The site ID. If not defined, current site (if available). + * @return Promise resolved with site home ID. */ getSiteHomeId(siteId?: string): Promise { return this.getSite(siteId).then((site) => { @@ -1135,8 +1115,8 @@ export class CoreSitesProvider { /** * Get the list of sites stored. * - * @param {String[]} [ids] IDs of the sites to get. If not defined, return all sites. - * @return {Promise} Promise resolved when the sites are retrieved. + * @param ids IDs of the sites to get. If not defined, return all sites. + * @return Promise resolved when the sites are retrieved. */ getSites(ids?: string[]): Promise { return this.appDB.getAllRecords(this.SITES_TABLE).then((sites) => { @@ -1163,8 +1143,8 @@ export class CoreSitesProvider { /** * Get the list of sites stored, sorted by URL and full name. * - * @param {String[]} [ids] IDs of the sites to get. If not defined, return all sites. - * @return {Promise} Promise resolved when the sites are retrieved. + * @param ids IDs of the sites to get. If not defined, return all sites. + * @return Promise resolved when the sites are retrieved. */ getSortedSites(ids?: string[]): Promise { return this.getSites(ids).then((sites) => { @@ -1193,7 +1173,7 @@ export class CoreSitesProvider { /** * Get the list of IDs of sites stored and not logged out. * - * @return {Promise} Promise resolved when the sites IDs are retrieved. + * @return Promise resolved when the sites IDs are retrieved. */ getLoggedInSitesIds(): Promise { return this.appDB.getRecords(this.SITES_TABLE, {loggedOut : 0}).then((sites) => { @@ -1206,7 +1186,7 @@ export class CoreSitesProvider { /** * Get the list of IDs of sites stored. * - * @return {Promise} Promise resolved when the sites IDs are retrieved. + * @return Promise resolved when the sites IDs are retrieved. */ getSitesIds(): Promise { return this.appDB.getAllRecords(this.SITES_TABLE).then((sites) => { @@ -1219,8 +1199,8 @@ export class CoreSitesProvider { /** * Login the user in a site. * - * @param {string} siteid ID of the site the user is accessing. - * @return {Promise} Promise resolved when current site is stored. + * @param siteid ID of the site the user is accessing. + * @return Promise resolved when current site is stored. */ login(siteId: string): Promise { const entry = { @@ -1236,7 +1216,7 @@ export class CoreSitesProvider { /** * Logout the user. * - * @return {Promise} Promise resolved when the user is logged out. + * @return Promise resolved when the user is logged out. */ logout(): Promise { let siteId; @@ -1263,7 +1243,7 @@ export class CoreSitesProvider { /** * Restores the session to the previous one so the user doesn't has to login everytime the app is started. * - * @return {Promise} Promise resolved if a session is restored. + * @return Promise resolved if a session is restored. */ restoreSession(): Promise { if (this.sessionRestored) { @@ -1285,9 +1265,9 @@ export class CoreSitesProvider { /** * Mark or unmark a site as logged out so the user needs to authenticate again. * - * @param {string} siteId ID of the site. - * @param {boolean} loggedOut True to set the site as logged out, false otherwise. - * @return {Promise} Promise resolved when done. + * @param siteId ID of the site. + * @param loggedOut True to set the site as logged out, false otherwise. + * @return Promise resolved when done. */ setSiteLoggedOut(siteId: string, loggedOut: boolean): Promise { return this.getSite(siteId).then((site) => { @@ -1312,11 +1292,11 @@ export class CoreSitesProvider { /** * Updates a site's token. * - * @param {string} siteUrl Site's URL. - * @param {string} username Username. - * @param {string} token User's new token. - * @param {string} [privateToken=''] User's private token. - * @return {Promise} A promise resolved when the site is updated. + * @param siteUrl Site's URL. + * @param username Username. + * @param token User's new token. + * @param privateToken User's private token. + * @return A promise resolved when the site is updated. */ updateSiteToken(siteUrl: string, username: string, token: string, privateToken: string = ''): Promise { const siteId = this.createSiteID(siteUrl, username); @@ -1329,10 +1309,10 @@ export class CoreSitesProvider { /** * Updates a site's token using siteId. * - * @param {string} siteId Site Id. - * @param {string} token User's new token. - * @param {string} [privateToken=''] User's private token. - * @return {Promise} A promise resolved when the site is updated. + * @param siteId Site Id. + * @param token User's new token. + * @param privateToken User's private token. + * @return A promise resolved when the site is updated. */ updateSiteTokenBySiteId(siteId: string, token: string, privateToken: string = ''): Promise { return this.getSite(siteId).then((site) => { @@ -1353,8 +1333,8 @@ export class CoreSitesProvider { /** * Updates a site's info. * - * @param {string} siteid Site's ID. - * @return {Promise} A promise resolved when the site is updated. + * @param siteid Site's ID. + * @return A promise resolved when the site is updated. */ updateSiteInfo(siteId: string): Promise { return this.getSite(siteId).then((site) => { @@ -1394,9 +1374,9 @@ export class CoreSitesProvider { /** * Updates a site's info. * - * @param {string} siteUrl Site's URL. - * @param {string} username Username. - * @return {Promise} A promise to be resolved when the site is updated. + * @param siteUrl Site's URL. + * @param username Username. + * @return A promise to be resolved when the site is updated. */ updateSiteInfoByUrl(siteUrl: string, username: string): Promise { const siteId = this.createSiteID(siteUrl, username); @@ -1408,11 +1388,11 @@ export class CoreSitesProvider { * Get the site IDs a URL belongs to. * Someone can have more than one account in the same site, that's why this function returns an array of IDs. * - * @param {string} url URL to check. - * @param {boolean} [prioritize] True if it should prioritize current site. If the URL belongs to current site then it won't - * check any other site, it will only return current site. - * @param {string} [username] If set, it will return only the sites where the current user has this username. - * @return {Promise} Promise resolved with the site IDs (array). + * @param url URL to check. + * @param prioritize True if it should prioritize current site. If the URL belongs to current site then it won't + * check any other site, it will only return current site. + * @param username If set, it will return only the sites where the current user has this username. + * @return Promise resolved with the site IDs (array). */ getSiteIdsFromUrl(url: string, prioritize?: boolean, username?: string): Promise { // If prioritize is true, check current site first. @@ -1466,7 +1446,7 @@ export class CoreSitesProvider { /** * Get the site ID stored in DB as current site. * - * @return {Promise} Promise resolved with the site ID. + * @return Promise resolved with the site ID. */ getStoredCurrentSiteId(): Promise { return this.appDB.getRecord(this.CURRENT_SITE_TABLE, { id: 1 }).then((currentSite) => { @@ -1477,8 +1457,8 @@ export class CoreSitesProvider { /** * Get the public config of a certain site. * - * @param {string} siteUrl URL of the site. - * @return {Promise} Promise resolved with the public config. + * @param siteUrl URL of the site. + * @return Promise resolved with the public config. */ getSitePublicConfig(siteUrl: string): Promise { const temporarySite = this.sitesFactory.makeSite(undefined, siteUrl); @@ -1489,8 +1469,8 @@ export class CoreSitesProvider { /** * Get site config. * - * @param {any} site The site to get the config. - * @return {Promise} Promise resolved with config if available. + * @param site The site to get the config. + * @return Promise resolved with config if available. */ protected getSiteConfig(site: CoreSite): Promise { if (!site.wsAvailable('tool_mobile_get_config')) { @@ -1504,9 +1484,9 @@ export class CoreSitesProvider { /** * Check if a certain feature is disabled in a site. * - * @param {string} name Name of the feature to check. - * @param {string} [siteId] The site ID. If not defined, current site (if available). - * @return {Promise} Promise resolved with true if disabled. + * @param name Name of the feature to check. + * @param siteId The site ID. If not defined, current site (if available). + * @return Promise resolved with true if disabled. */ isFeatureDisabled(name: string, siteId?: string): Promise { return this.getSite(siteId).then((site) => { @@ -1517,7 +1497,7 @@ export class CoreSitesProvider { /** * Create a table in all the sites databases. * - * @param {SQLiteDBTamableSchema} table Table schema. + * @param table Table schema. */ createTableFromSchema(table: SQLiteDBTableSchema): void { this.createTablesFromSchema([table]); @@ -1526,7 +1506,7 @@ export class CoreSitesProvider { /** * Create several tables in all the sites databases. * - * @param {SQLiteDBTamableSchema[]} tables List of tables schema. + * @param tables List of tables schema. */ createTablesFromSchema(tables: SQLiteDBTableSchema[]): void { // Add the tables to the list of schemas. This list is to create all the tables in new sites. @@ -1541,9 +1521,9 @@ export class CoreSitesProvider { /** * Check if a WS is available in the current site, if any. * - * @param {string} method WS name. - * @param {boolean} [checkPrefix=true] When true also checks with the compatibility prefix. - * @return {boolean} Whether the WS is available. + * @param method WS name. + * @param checkPrefix When true also checks with the compatibility prefix. + * @return Whether the WS is available. */ wsAvailableInCurrentSite(method: string, checkPrefix: boolean = true): boolean { const site = this.getCurrentSite(); @@ -1554,8 +1534,8 @@ export class CoreSitesProvider { /** * Check if a site is a legacy site by its info. * - * @param {any} info The site info. - * @return {boolean} Whether it's a legacy Moodle. + * @param info The site info. + * @return Whether it's a legacy Moodle. */ isLegacyMoodleByInfo(info: any): boolean { return this.isValidMoodleVersion(info) == this.LEGACY_APP_VERSION; @@ -1571,8 +1551,8 @@ export class CoreSitesProvider { /** * Install and upgrade all the registered schemas and tables. * - * @param {CoreSite} site Site. - * @return {Promise} Promise resolved when done. + * @param site Site. + * @return Promise resolved when done. */ migrateSiteSchemas(site: CoreSite): Promise { const db = site.getDb(); @@ -1630,10 +1610,10 @@ export class CoreSitesProvider { /** * Check if a URL is the root URL of any of the stored sites. * - * @param {string} url URL to check. - * @param {string} [username] Username to check. - * @return {Promise<{site: CoreSite, siteIds: string[]}>} Promise resolved with site to use and the list of sites that have - * the URL. Site will be undefined if it isn't the root URL of any stored site. + * @param url URL to check. + * @param username Username to check. + * @return Promise resolved with site to use and the list of sites that have + * the URL. Site will be undefined if it isn't the root URL of any stored site. */ isStoredRootURL(url: string, username?: string): Promise<{site: CoreSite, siteIds: string[]}> { // Check if the site is stored. @@ -1664,7 +1644,7 @@ export class CoreSitesProvider { /** * Returns the Site Schema names that can be cleared on space storage. * - * @return {string[]} Name of the site schemas. + * @return Name of the site schemas. */ getSiteTableSchemasToClear(): string[] { let reset = []; diff --git a/src/providers/sync.ts b/src/providers/sync.ts index a248c2ad1..ec8f91653 100644 --- a/src/providers/sync.ts +++ b/src/providers/sync.ts @@ -70,10 +70,10 @@ export class CoreSyncProvider { /** * Block a component and ID so it cannot be synchronized. * - * @param {string} component Component name. - * @param {string | number} id Unique ID per component. - * @param {string} [operation] Operation name. If not defined, a default text is used. - * @param {string} [siteId] Site ID. If not defined, current site. + * @param component Component name. + * @param id Unique ID per component. + * @param operation Operation name. If not defined, a default text is used. + * @param siteId Site ID. If not defined, current site. */ blockOperation(component: string, id: string | number, operation?: string, siteId?: string): void { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -96,7 +96,7 @@ export class CoreSyncProvider { /** * Clear all blocks for a site or all sites. * - * @param {string} [siteId] If set, clear the blocked objects only for this site. Otherwise clear them for all sites. + * @param siteId If set, clear the blocked objects only for this site. Otherwise clear them for all sites. */ clearAllBlocks(siteId?: string): void { if (siteId) { @@ -109,9 +109,9 @@ export class CoreSyncProvider { /** * Clear all blocks for a certain component. * - * @param {string} component Component name. - * @param {string | number} id Unique ID per component. - * @param {string} [siteId] Site ID. If not defined, current site. + * @param component Component name. + * @param id Unique ID per component. + * @param siteId Site ID. If not defined, current site. */ clearBlocks(component: string, id: string | number, siteId?: string): void { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -124,10 +124,10 @@ export class CoreSyncProvider { /** * Returns a sync record. - * @param {string} component Component name. - * @param {string | number} id Unique ID per component. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Record if found or reject. + * @param component Component name. + * @param id Unique ID per component. + * @param siteId Site ID. If not defined, current site. + * @return Record if found or reject. */ getSyncRecord(component: string, id: string | number, siteId?: string): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -137,11 +137,11 @@ export class CoreSyncProvider { /** * Inserts or Updates info of a sync record. - * @param {string} component Component name. - * @param {string | number} id Unique ID per component. - * @param {any} data Data that updates the record. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise} Promise resolved with done. + * @param component Component name. + * @param id Unique ID per component. + * @param data Data that updates the record. + * @param siteId Site ID. If not defined, current site. + * @return Promise resolved with done. */ insertOrUpdateSyncRecord(component: string, id: string | number, data: any, siteId?: string): Promise { return this.sitesProvider.getSiteDb(siteId).then((db) => { @@ -155,9 +155,9 @@ export class CoreSyncProvider { /** * Convenience function to create unique identifiers for a component and id. * - * @param {string} component Component name. - * @param {string | number} id Unique ID per component. - * @return {string} Unique sync id. + * @param component Component name. + * @param id Unique ID per component. + * @return Unique sync id. */ protected getUniqueSyncBlockId(component: string, id: string | number): string { return component + '#' + id; @@ -167,10 +167,10 @@ export class CoreSyncProvider { * Check if a component is blocked. * One block can have different operations. Here we check how many operations are being blocking the object. * - * @param {string} component Component name. - * @param {string | number} id Unique ID per component. - * @param {string} [siteId] Site ID. If not defined, current site. - * @return {boolean} Whether it's blocked. + * @param component Component name. + * @param id Unique ID per component. + * @param siteId Site ID. If not defined, current site. + * @return Whether it's blocked. */ isBlocked(component: string, id: string | number, siteId?: string): boolean { siteId = siteId || this.sitesProvider.getCurrentSiteId(); @@ -190,10 +190,10 @@ export class CoreSyncProvider { /** * Unblock an operation on a component and ID. * - * @param {string} component Component name. - * @param {string | number} id Unique ID per component. - * @param {string} [operation] Operation name. If not defined, a default text is used. - * @param {string} [siteId] Site ID. If not defined, current site. + * @param component Component name. + * @param id Unique ID per component. + * @param operation Operation name. If not defined, a default text is used. + * @param siteId Site ID. If not defined, current site. */ unblockOperation(component: string, id: string | number, operation?: string, siteId?: string): void { operation = operation || '-'; diff --git a/src/providers/update-manager.ts b/src/providers/update-manager.ts index 37ed1c0e8..d8a27d5bf 100644 --- a/src/providers/update-manager.ts +++ b/src/providers/update-manager.ts @@ -32,19 +32,16 @@ import { SQLiteDB } from '@classes/sqlitedb'; export interface CoreUpdateManagerMigrateTable { /** * Current name of the store/table. - * @type {string} */ name: string; /** * New name of the table. If not defined, "name" will be used. - * @type {string} */ newName?: string; /** * An object to rename and convert some fields of the table/store. - * @type {object} */ fields?: { name: string, // Field name in the old app. @@ -77,8 +74,6 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { /** * Tables to migrate from app DB ('MoodleMobile'). Include all the core ones to decrease the dependencies. - * - * @type {CoreUpdateManagerMigrateTable[]} */ protected appDBTables: CoreUpdateManagerMigrateTable[] = [ { @@ -177,8 +172,6 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { /** * Tables to migrate from each site DB. Include all the core ones to decrease the dependencies. - * - * @type {CoreUpdateManagerMigrateTable[]} */ protected siteDBTables: CoreUpdateManagerMigrateTable[] = [ { @@ -331,7 +324,7 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { * Check if the app has been updated and performs the needed processes. * This function shouldn't be used outside of core. * - * @return {Promise} Promise resolved when the update process finishes. + * @return Promise resolved when the update process finishes. */ load(): Promise { const promises = [], @@ -379,7 +372,7 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { /** * Register several app tables to be migrated to the new schema. * - * @param {CoreUpdateManagerMigrateTable[]} tables The tables to migrate. + * @param tables The tables to migrate. */ registerAppTablesMigration(tables: CoreUpdateManagerMigrateTable[]): void { tables.forEach((table) => { @@ -390,7 +383,7 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { /** * Register an app table to be migrated to the new schema. * - * @param {CoreUpdateManagerMigrateTable} table The table to migrate. + * @param table The table to migrate. */ registerAppTableMigration(table: CoreUpdateManagerMigrateTable): void { this.appDBTables.push(table); @@ -399,7 +392,7 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { /** * Register several site tables to be migrated to the new schema. * - * @param {CoreUpdateManagerMigrateTable[]} tables The tables to migrate. + * @param tables The tables to migrate. */ registerSiteTablesMigration(tables: CoreUpdateManagerMigrateTable[]): void { tables.forEach((table) => { @@ -410,7 +403,7 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { /** * Register a site table to be migrated to the new schema. * - * @param {CoreUpdateManagerMigrateTable} table The table to migrate. + * @param table The table to migrate. */ registerSiteTableMigration(table: CoreUpdateManagerMigrateTable): void { this.siteDBTables.push(table); @@ -419,8 +412,8 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { /** * Register a migration of component name for local notifications. * - * @param {string} oldName The old name. - * @param {string} newName The new name. + * @param oldName The old name. + * @param newName The new name. */ registerLocalNotifComponentMigration(oldName: string, newName: string): void { this.localNotificationsComponentsMigrate[oldName] = newName; @@ -429,7 +422,7 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { /** * Migrate all DBs and tables from the old format to SQLite. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected migrateAllDBs(): Promise { if (!( window).ydn) { @@ -455,7 +448,7 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { /** * Migrate the app DB. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected migrateAppDB(): Promise { const oldDb = new ( window).ydn.db.Storage('MoodleMobile'), @@ -467,8 +460,8 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { /** * Migrate the DB of a certain site. * - * @param {string} siteId The site ID. - * @return {Promise} Promise resolved when done. + * @param siteId The site ID. + * @return Promise resolved when done. */ protected migrateSiteDB(siteId: string): Promise { // Get the site DB. @@ -482,10 +475,10 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { /** * Migrate all the tables of a certain DB to the SQLite DB. * - * @param {any} oldDb The old DB (created using ydn-db). - * @param {SQLiteDB} newDb The new DB. - * @param {CoreUpdateManagerMigrateTable[]} tables The tables to migrate. - * @return {Promise} Promise resolved when done. + * @param oldDb The old DB (created using ydn-db). + * @param newDb The new DB. + * @param tables The tables to migrate. + * @return Promise resolved when done. */ protected migrateDB(oldDb: any, newDb: SQLiteDB, tables: CoreUpdateManagerMigrateTable[]): Promise { if (!oldDb || !newDb) { @@ -557,7 +550,7 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { /** * Migrates files filling extensions. * - * @return {Promise} Promise resolved when the site migration is finished. + * @return Promise resolved when the site migration is finished. */ protected migrateFileExtensions(): Promise { return this.sitesProvider.getSitesIds().then((sites) => { @@ -574,7 +567,7 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { /** * Migrate local notifications components from the old nomenclature to the new one. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected migrateLocalNotificationsComponents(): Promise { if (!this.notifProvider.isAvailable()) { @@ -599,7 +592,7 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { * Calendar default notification time is configurable from version 3.2.1, and a new option "Default" is added. * All events that were configured to use the fixed default time should now be configured to use "Default" option. * - * @return {Promise} Promise resolved when the events are configured. + * @return Promise resolved when the events are configured. */ protected setCalendarDefaultNotifTime(): Promise { if (!this.notifProvider.isAvailable()) { @@ -643,7 +636,7 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { * In version 3.2.1 we want the site config to be stored in each site if available. * Since it can be slow, we'll only block retrieving the config of current site, the rest will be in background. * - * @return {Promise} Promise resolved when the config is loaded for the current site (if any). + * @return Promise resolved when the config is loaded for the current site (if any). */ protected setSitesConfig(): Promise { return this.sitesProvider.getSitesIds().then((siteIds) => { @@ -675,8 +668,8 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { /** * Store the config of a site. * - * @param {String} siteId Site ID. - * @return {Promise} Promise resolved when the config is loaded for the site. + * @param siteId Site ID. + * @return Promise resolved when the config is loaded for the site. */ protected setSiteConfig(siteId: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { @@ -698,7 +691,7 @@ export class CoreUpdateManagerProvider implements CoreInitHandler { /** * Logout from legacy sites. * - * @return {Promise} Promise resolved when done. + * @return Promise resolved when done. */ protected logoutLegacySites(): Promise { return this.sitesProvider.getSitesIds().then((siteIds) => { diff --git a/src/providers/urlschemes.ts b/src/providers/urlschemes.ts index 83b189c3a..74e0da4ee 100644 --- a/src/providers/urlschemes.ts +++ b/src/providers/urlschemes.ts @@ -35,43 +35,36 @@ import { CoreConstants } from '@core/constants'; export interface CoreCustomURLSchemesParams { /** * The site's URL. - * @type {string} */ siteUrl: string; /** * User's token. If set, user will be authenticated. - * @type {string} */ token?: string; /** * User's private token. - * @type {string} */ privateToken?: string; /** * Username. - * @type {string} */ username?: string; /** * URL to open once authenticated. - * @type {string} */ redirect?: any; /** * Name of the page to go once authenticated. - * @type {string} */ pageName?: string; /** * Params to pass to the page. - * @type {string} */ pageParams?: any; } @@ -96,8 +89,8 @@ export class CoreCustomURLSchemesProvider { /** * Handle an URL received by custom URL scheme. * - * @param {string} url URL to treat. - * @return {Promise} Promise resolved when done. + * @param url URL to treat. + * @return Promise resolved when done. */ handleCustomURL(url: string): Promise { if (!this.isCustomURL(url)) { @@ -307,8 +300,8 @@ export class CoreCustomURLSchemesProvider { * Get the data from a custom URL scheme. The structure of the URL is: * moodlemobile://username@domain.com?token=TOKEN&privatetoken=PRIVATETOKEN&redirect=http://domain.com/course/view.php?id=2 * - * @param {string} url URL to treat. - * @return {Promise} Promise resolved with the data. + * @param url URL to treat. + * @return Promise resolved with the data. */ protected getCustomURLData(url: string): Promise { const urlScheme = CoreConfigConstants.customurlscheme + '://'; @@ -369,8 +362,8 @@ export class CoreCustomURLSchemesProvider { /** * Get the data from a "link" custom URL scheme. This kind of URL is deprecated. * - * @param {string} url URL to treat. - * @return {Promise} Promise resolved with the data. + * @param url URL to treat. + * @return Promise resolved with the data. */ protected getCustomURLLinkData(url: string): Promise { const contentLinksScheme = CoreConfigConstants.customurlscheme + '://link='; @@ -433,8 +426,8 @@ export class CoreCustomURLSchemesProvider { /** * Get the data from a "token" custom URL scheme. This kind of URL is deprecated. * - * @param {string} url URL to treat. - * @return {Promise} Promise resolved with the data. + * @param url URL to treat. + * @return Promise resolved with the data. */ protected getCustomURLTokenData(url: string): Promise { const ssoScheme = CoreConfigConstants.customurlscheme + '://token='; @@ -479,8 +472,8 @@ export class CoreCustomURLSchemesProvider { /** * Check whether a URL is a custom URL scheme. * - * @param {string} url URL to check. - * @return {boolean} Whether it's a custom URL scheme. + * @param url URL to check. + * @return Whether it's a custom URL scheme. */ isCustomURL(url: string): boolean { if (!url) { @@ -493,8 +486,8 @@ export class CoreCustomURLSchemesProvider { /** * Check whether a URL is a custom URL scheme with the "link" param (deprecated). * - * @param {string} url URL to check. - * @return {boolean} Whether it's a custom URL scheme. + * @param url URL to check. + * @return Whether it's a custom URL scheme. */ isCustomURLLink(url: string): boolean { if (!url) { @@ -507,8 +500,8 @@ export class CoreCustomURLSchemesProvider { /** * Check whether a URL is a custom URL scheme with a "token" param (deprecated). * - * @param {string} url URL to check. - * @return {boolean} Whether it's a custom URL scheme. + * @param url URL to check. + * @return Whether it's a custom URL scheme. */ isCustomURLToken(url: string): boolean { if (!url) { diff --git a/src/providers/utils/dom.ts b/src/providers/utils/dom.ts index 8776024e7..fb91e5532 100644 --- a/src/providers/utils/dom.ts +++ b/src/providers/utils/dom.ts @@ -36,13 +36,11 @@ import { Subject } from 'rxjs'; export interface CoreAlert extends Alert { /** * Observable that will notify when the alert is dismissed. - * @type {Subject<{data: any, role: string}>} */ didDismiss: Subject<{data: any, role: string}>; /** * Observable that will notify when the alert will be dismissed. - * @type {Subject<{data: any, role: string}>} */ willDismiss: Subject<{data: any, role: string}>; } @@ -86,9 +84,9 @@ export class CoreDomUtilsProvider { * traverse the parents to achieve the same functionality. * Returns the closest ancestor of the current element (or the current element itself) which matches the selector. * - * @param {HTMLElement} element DOM Element. - * @param {string} selector Selector to search. - * @return {Element} Closest ancestor. + * @param element DOM Element. + * @param selector Selector to search. + * @return Closest ancestor. */ closest(element: HTMLElement, selector: string): Element { // Try to use closest if the browser supports it. @@ -125,13 +123,13 @@ export class CoreDomUtilsProvider { /** * If the download size is higher than a certain threshold shows a confirm dialog. * - * @param {any} size Object containing size to download and a boolean to indicate if its totally or partialy calculated. - * @param {string} [message] Code of the message to show. Default: 'core.course.confirmdownload'. - * @param {string} [unknownMessage] ID of the message to show if size is unknown. - * @param {number} [wifiThreshold] Threshold to show confirm in WiFi connection. Default: CoreWifiDownloadThreshold. - * @param {number} [limitedThreshold] Threshold to show confirm in limited connection. Default: CoreDownloadThreshold. - * @param {boolean} [alwaysConfirm] True to show a confirm even if the size isn't high, false otherwise. - * @return {Promise} Promise resolved when the user confirms or if no confirm needed. + * @param size Object containing size to download and a boolean to indicate if its totally or partialy calculated. + * @param message Code of the message to show. Default: 'core.course.confirmdownload'. + * @param unknownMessage ID of the message to show if size is unknown. + * @param wifiThreshold Threshold to show confirm in WiFi connection. Default: CoreWifiDownloadThreshold. + * @param limitedThreshold Threshold to show confirm in limited connection. Default: CoreDownloadThreshold. + * @param alwaysConfirm True to show a confirm even if the size isn't high, false otherwise. + * @return Promise resolved when the user confirms or if no confirm needed. */ confirmDownloadSize(size: any, message?: string, unknownMessage?: string, wifiThreshold?: number, limitedThreshold?: number, alwaysConfirm?: boolean): Promise { @@ -207,8 +205,8 @@ export class CoreDomUtilsProvider { /** * Convert some HTML as text into an HTMLElement. This HTML is put inside a div or a body. * - * @param {string} html Text to convert. - * @return {HTMLElement} Element. + * @param html Text to convert. + * @return Element. */ convertToElement(html: string): HTMLElement { // Add a div to hold the content, that's the element that will be returned. @@ -220,7 +218,7 @@ export class CoreDomUtilsProvider { /** * Create a "cancelled" error. These errors won't display an error message in showErrorModal functions. * - * @return {any} The error object. + * @return The error object. */ createCanceledError(): any { return {coreCanceled: true}; @@ -230,8 +228,8 @@ export class CoreDomUtilsProvider { * Given a list of changes for a component input detected by a KeyValueDiffers, create an object similar to the one * passed to the ngOnChanges functions. * - * @param {any} changes Changes detected by KeyValueDiffer. - * @return {{[name: string]: SimpleChange}} Changes in a format like ngOnChanges. + * @param changes Changes detected by KeyValueDiffer. + * @return Changes in a format like ngOnChanges. */ createChangesFromKeyValueDiff(changes: any): { [name: string]: SimpleChange } { const newChanges: { [name: string]: SimpleChange } = {}; @@ -255,8 +253,8 @@ export class CoreDomUtilsProvider { /** * Extract the downloadable URLs from an HTML code. * - * @param {string} html HTML code. - * @return {string[]} List of file urls. + * @param html HTML code. + * @return List of file urls. */ extractDownloadableFilesFromHtml(html: string): string[] { const urls = []; @@ -288,8 +286,8 @@ export class CoreDomUtilsProvider { /** * Extract the downloadable URLs from an HTML code and returns them in fake file objects. * - * @param {string} html HTML code. - * @return {any[]} List of fake file objects with file URLs. + * @param html HTML code. + * @return List of fake file objects with file URLs. */ extractDownloadableFilesFromHtmlAsFakeFileObjects(html: string): any[] { const urls = this.extractDownloadableFilesFromHtml(html); @@ -305,8 +303,8 @@ export class CoreDomUtilsProvider { /** * Search all the URLs in a CSS file content. * - * @param {string} code CSS code. - * @return {string[]} List of URLs. + * @param code CSS code. + * @return List of URLs. */ extractUrlsFromCSS(code: string): string[] { // First of all, search all the url(...) occurrences that don't include "data:". @@ -331,8 +329,8 @@ export class CoreDomUtilsProvider { /** * Fix syntax errors in HTML. * - * @param {string} html HTML text. - * @return {string} Fixed HTML text. + * @param html HTML text. + * @return Fixed HTML text. */ fixHtml(html: string): string { this.template.innerHTML = html; @@ -358,7 +356,7 @@ export class CoreDomUtilsProvider { /** * Focus an element and open keyboard. * - * @param {HTMLElement} el HTML element to focus. + * @param el HTML element to focus. */ focusElement(el: HTMLElement): void { if (el && el.focus) { @@ -375,8 +373,8 @@ export class CoreDomUtilsProvider { * If the size is already valid (like '500px' or '50%') it won't be modified. * Returned size will have a format like '500px'. * - * @param {any} size Size to format. - * @return {string} Formatted size. If size is not valid, returns an empty string. + * @param size Size to format. + * @return Formatted size. If size is not valid, returns an empty string. */ formatPixelsSize(size: any): string { if (typeof size == 'string' && (size.indexOf('px') > -1 || size.indexOf('%') > -1)) { @@ -395,9 +393,9 @@ export class CoreDomUtilsProvider { /** * Returns the contents of a certain selection in a DOM element. * - * @param {HTMLElement} element DOM element to search in. - * @param {string} selector Selector to search. - * @return {string} Selection contents. Undefined if not found. + * @param element DOM element to search in. + * @param selector Selector to search. + * @return Selection contents. Undefined if not found. */ getContentsOfElement(element: HTMLElement, selector: string): string { if (element) { @@ -411,8 +409,8 @@ export class CoreDomUtilsProvider { /** * Get the data from a form. It will only collect elements that have a name. * - * @param {HTMLFormElement} form The form to get the data from. - * @return {any} Object with the data. The keys are the names of the inputs. + * @param form The form to get the data from. + * @return Object with the data. The keys are the names of the inputs. */ getDataFromForm(form: HTMLFormElement): any { if (!form || !form.elements) { @@ -448,9 +446,9 @@ export class CoreDomUtilsProvider { /** * Returns the attribute value of a string element. Only the first element will be selected. * - * @param {string} html HTML element in string. - * @param {string} attribute Attribute to get. - * @return {string} Attribute value. + * @param html HTML element in string. + * @param attribute Attribute to get. + * @return Attribute value. */ getHTMLElementAttribute(html: string, attribute: string): string { return this.convertToElement(html).children[0].getAttribute('src'); @@ -459,12 +457,12 @@ export class CoreDomUtilsProvider { /** * Returns height of an element. * - * @param {any} element DOM element to measure. - * @param {boolean} [usePadding] Whether to use padding to calculate the measure. - * @param {boolean} [useMargin] Whether to use margin to calculate the measure. - * @param {boolean} [useBorder] Whether to use borders to calculate the measure. - * @param {boolean} [innerMeasure] If inner measure is needed: padding, margin or borders will be substracted. - * @return {number} Height in pixels. + * @param element DOM element to measure. + * @param usePadding Whether to use padding to calculate the measure. + * @param useMargin Whether to use margin to calculate the measure. + * @param useBorder Whether to use borders to calculate the measure. + * @param innerMeasure If inner measure is needed: padding, margin or borders will be substracted. + * @return Height in pixels. */ getElementHeight(element: any, usePadding?: boolean, useMargin?: boolean, useBorder?: boolean, innerMeasure?: boolean): number { @@ -474,13 +472,13 @@ export class CoreDomUtilsProvider { /** * Returns height or width of an element. * - * @param {any} element DOM element to measure. - * @param {boolean} [getWidth] Whether to get width or height. - * @param {boolean} [usePadding] Whether to use padding to calculate the measure. - * @param {boolean} [useMargin] Whether to use margin to calculate the measure. - * @param {boolean} [useBorder] Whether to use borders to calculate the measure. - * @param {boolean} [innerMeasure] If inner measure is needed: padding, margin or borders will be substracted. - * @return {number} Measure in pixels. + * @param element DOM element to measure. + * @param getWidth Whether to get width or height. + * @param usePadding Whether to use padding to calculate the measure. + * @param useMargin Whether to use margin to calculate the measure. + * @param useBorder Whether to use borders to calculate the measure. + * @param innerMeasure If inner measure is needed: padding, margin or borders will be substracted. + * @return Measure in pixels. */ getElementMeasure(element: any, getWidth?: boolean, usePadding?: boolean, useMargin?: boolean, useBorder?: boolean, innerMeasure?: boolean): number { @@ -531,9 +529,9 @@ export class CoreDomUtilsProvider { /** * Returns the computed style measure or 0 if not found or NaN. * - * @param {any} style Style from getComputedStyle. - * @param {string} measure Measure to get. - * @return {number} Result of the measure. + * @param style Style from getComputedStyle. + * @param measure Measure to get. + * @return Result of the measure. */ getComputedStyleMeasure(style: any, measure: string): number { return parseInt(style[measure], 10) || 0; @@ -542,7 +540,7 @@ export class CoreDomUtilsProvider { /** * Get the HTML code to render a connection warning icon. * - * @return {string} HTML Code. + * @return HTML Code. */ getConnectionWarningIconHtml(): string { return '
' + @@ -554,12 +552,12 @@ export class CoreDomUtilsProvider { /** * Returns width of an element. * - * @param {any} element DOM element to measure. - * @param {boolean} [usePadding] Whether to use padding to calculate the measure. - * @param {boolean} [useMargin] Whether to use margin to calculate the measure. - * @param {boolean} [useBorder] Whether to use borders to calculate the measure. - * @param {boolean} [innerMeasure] If inner measure is needed: padding, margin or borders will be substracted. - * @return {number} Width in pixels. + * @param element DOM element to measure. + * @param usePadding Whether to use padding to calculate the measure. + * @param useMargin Whether to use margin to calculate the measure. + * @param useBorder Whether to use borders to calculate the measure. + * @param innerMeasure If inner measure is needed: padding, margin or borders will be substracted. + * @return Width in pixels. */ getElementWidth(element: any, usePadding?: boolean, useMargin?: boolean, useBorder?: boolean, innerMeasure?: boolean): number { @@ -569,10 +567,10 @@ export class CoreDomUtilsProvider { /** * Retrieve the position of a element relative to another element. * - * @param {HTMLElement} container Element to search in. - * @param {string} [selector] Selector to find the element to gets the position. - * @param {string} [positionParentClass] Parent Class where to stop calculating the position. Default scroll-content. - * @return {number[]} positionLeft, positionTop of the element relative to. + * @param container Element to search in. + * @param selector Selector to find the element to gets the position. + * @param positionParentClass Parent Class where to stop calculating the position. Default scroll-content. + * @return positionLeft, positionTop of the element relative to. */ getElementXY(container: HTMLElement, selector?: string, positionParentClass?: string): number[] { let element: HTMLElement = (selector ? container.querySelector(selector) : container), @@ -617,8 +615,8 @@ export class CoreDomUtilsProvider { /** * Given an error message, return a suitable error title. * - * @param {string} message The error message. - * @return {any} Title. + * @param message The error message. + * @return Title. */ private getErrorTitle(message: string): any { if (message == this.translate.instant('core.networkerrormsg') || @@ -633,9 +631,9 @@ export class CoreDomUtilsProvider { /** * Get the error message from an error, including debug data if needed. * - * @param {any} error Message to show. - * @param {boolean} [needsTranslate] Whether the error needs to be translated. - * @return {string} Error message, null if no error should be displayed. + * @param error Message to show. + * @param needsTranslate Whether the error needs to be translated. + * @return Error message, null if no error should be displayed. */ getErrorMessage(error: any, needsTranslate?: boolean): string { let extraInfo = ''; @@ -693,8 +691,8 @@ export class CoreDomUtilsProvider { * Please use this function only if you cannot retrieve the instance using parent/child methods: ViewChild (or similar) * or Angular's injection. * - * @param {Element} element The root element of the component/directive. - * @return {any} The instance, undefined if not found. + * @param element The root element of the component/directive. + * @return The instance, undefined if not found. */ getInstanceByElement(element: Element): any { const id = element.getAttribute(this.INSTANCE_ID_ATTR_NAME); @@ -705,8 +703,8 @@ export class CoreDomUtilsProvider { /** * Wait an element to exists using the findFunction. * - * @param {Function} findFunction The function used to find the element. - * @return {Promise} Resolved if found, rejected if too many tries. + * @param findFunction The function used to find the element. + * @return Resolved if found, rejected if too many tries. */ waitElementToExist(findFunction: Function): Promise { const promiseInterval = { @@ -744,7 +742,7 @@ export class CoreDomUtilsProvider { /** * Handle bootstrap tooltips in a certain element. * - * @param {HTMLElement} element Element to check. + * @param element Element to check. */ handleBootstrapTooltips(element: HTMLElement): void { const els = Array.from(element.querySelectorAll('[data-toggle="tooltip"]')); @@ -783,9 +781,9 @@ export class CoreDomUtilsProvider { /** * Check if an element is outside of screen (viewport). * - * @param {HTMLElement} scrollEl The element that must be scrolled. - * @param {HTMLElement} element DOM element to check. - * @return {boolean} Whether the element is outside of the viewport. + * @param scrollEl The element that must be scrolled. + * @param element DOM element to check. + * @return Whether the element is outside of the viewport. */ isElementOutsideOfScreen(scrollEl: HTMLElement, element: HTMLElement): boolean { const elementRect = element.getBoundingClientRect(); @@ -808,7 +806,7 @@ export class CoreDomUtilsProvider { /** * Check if rich text editor is enabled. * - * @return {Promise} Promise resolved with boolean: true if enabled, false otherwise. + * @return Promise resolved with boolean: true if enabled, false otherwise. */ isRichTextEditorEnabled(): Promise { if (this.isRichTextEditorSupported()) { @@ -823,7 +821,7 @@ export class CoreDomUtilsProvider { /** * Check if rich text editor is supported in the platform. * - * @return {boolean} Whether it's supported. + * @return Whether it's supported. */ isRichTextEditorSupported(): boolean { return true; @@ -832,10 +830,10 @@ export class CoreDomUtilsProvider { /** * Move children from one HTMLElement to another. * - * @param {HTMLElement} oldParent The old parent. - * @param {HTMLElement} newParent The new parent. - * @param {boolean} [prepend] If true, adds the children to the beginning of the new parent. - * @return {Node[]} List of moved children. + * @param oldParent The old parent. + * @param newParent The new parent. + * @param prepend If true, adds the children to the beginning of the new parent. + * @return List of moved children. */ moveChildren(oldParent: HTMLElement, newParent: HTMLElement, prepend?: boolean): Node[] { const movedChildren: Node[] = []; @@ -854,8 +852,8 @@ export class CoreDomUtilsProvider { /** * Search and remove a certain element from inside another element. * - * @param {HTMLElement} element DOM element to search in. - * @param {string} selector Selector to search. + * @param element DOM element to search in. + * @param selector Selector to search. */ removeElement(element: HTMLElement, selector: string): void { if (element) { @@ -869,10 +867,10 @@ export class CoreDomUtilsProvider { /** * Search and remove a certain element from an HTML code. * - * @param {string} html HTML code to change. - * @param {string} selector Selector to search. - * @param {boolean} [removeAll] True if it should remove all matches found, false if it should only remove the first one. - * @return {string} HTML without the element. + * @param html HTML code to change. + * @param selector Selector to search. + * @param removeAll True if it should remove all matches found, false if it should only remove the first one. + * @return HTML without the element. */ removeElementFromHtml(html: string, selector: string, removeAll?: boolean): string { let selected; @@ -897,7 +895,7 @@ export class CoreDomUtilsProvider { /** * Remove a component/directive instance using the DOM Element. * - * @param {Element} element The root element of the component/directive. + * @param element The root element of the component/directive. */ removeInstanceByElement(element: Element): void { const id = element.getAttribute(this.INSTANCE_ID_ATTR_NAME); @@ -907,7 +905,7 @@ export class CoreDomUtilsProvider { /** * Remove a component/directive instance using the ID. * - * @param {string} id The ID to remove. + * @param id The ID to remove. */ removeInstanceById(id: string): void { delete this.instances[id]; @@ -916,8 +914,8 @@ export class CoreDomUtilsProvider { /** * Search for certain classes in an element contents and replace them with the specified new values. * - * @param {HTMLElement} element DOM element. - * @param {any} map Mapping of the classes to replace. Keys must be the value to replace, values must be + * @param element DOM element. + * @param map Mapping of the classes to replace. Keys must be the value to replace, values must be * the new class name. Example: {'correct': 'core-question-answer-correct'}. */ replaceClassesInElement(element: HTMLElement, map: any): void { @@ -934,10 +932,10 @@ export class CoreDomUtilsProvider { /** * Given an HTML, search all links and media and tries to restore original sources using the paths object. * - * @param {string} html HTML code. - * @param {object} paths Object linking URLs in the html code with the real URLs to use. - * @param {Function} [anchorFn] Function to call with each anchor. Optional. - * @return {string} Treated HTML code. + * @param html HTML code. + * @param paths Object linking URLs in the html code with the real URLs to use. + * @param anchorFn Function to call with each anchor. Optional. + * @return Treated HTML code. */ restoreSourcesInHtml(html: string, paths: object, anchorFn?: Function): string { let media, @@ -985,11 +983,11 @@ export class CoreDomUtilsProvider { * Scroll to somehere in the content. * Checks hidden property _scroll to avoid errors if view is not active. * - * @param {Content} content Content where to execute the function. - * @param {number} x The x-value to scroll to. - * @param {number} y The y-value to scroll to. - * @param {number} [duration] Duration of the scroll animation in milliseconds. Defaults to `300`. - * @returns {Promise} Returns a promise which is resolved when the scroll has completed. + * @param content Content where to execute the function. + * @param x The x-value to scroll to. + * @param y The y-value to scroll to. + * @param duration Duration of the scroll animation in milliseconds. Defaults to `300`. + * @return Returns a promise which is resolved when the scroll has completed. */ scrollTo(content: Content, x: number, y: number, duration?: number, done?: Function): Promise { return content && content._scroll && content.scrollTo(x, y, duration, done); @@ -999,9 +997,9 @@ export class CoreDomUtilsProvider { * Scroll to Bottom of the content. * Checks hidden property _scroll to avoid errors if view is not active. * - * @param {Content} content Content where to execute the function. - * @param {number} [duration] Duration of the scroll animation in milliseconds. Defaults to `300`. - * @returns {Promise} Returns a promise which is resolved when the scroll has completed. + * @param content Content where to execute the function. + * @param duration Duration of the scroll animation in milliseconds. Defaults to `300`. + * @return Returns a promise which is resolved when the scroll has completed. */ scrollToBottom(content: Content, duration?: number): Promise { return content && content._scroll && content.scrollToBottom(duration); @@ -1011,9 +1009,9 @@ export class CoreDomUtilsProvider { * Scroll to Top of the content. * Checks hidden property _scroll to avoid errors if view is not active. * - * @param {Content} content Content where to execute the function. - * @param {number} [duration] Duration of the scroll animation in milliseconds. Defaults to `300`. - * @returns {Promise} Returns a promise which is resolved when the scroll has completed. + * @param content Content where to execute the function. + * @param duration Duration of the scroll animation in milliseconds. Defaults to `300`. + * @return Returns a promise which is resolved when the scroll has completed. */ scrollToTop(content: Content, duration?: number): Promise { return content && content._scroll && content.scrollToTop(duration); @@ -1023,8 +1021,8 @@ export class CoreDomUtilsProvider { * Returns contentHeight of the content. * Checks hidden property _scroll to avoid errors if view is not active. * - * @param {Content} content Content where to execute the function. - * @return {number} Content contentHeight or 0. + * @param content Content where to execute the function. + * @return Content contentHeight or 0. */ getContentHeight(content: Content): number { return (content && content._scroll && content.contentHeight) || 0; @@ -1034,8 +1032,8 @@ export class CoreDomUtilsProvider { * Returns scrollHeight of the content. * Checks hidden property _scroll to avoid errors if view is not active. * - * @param {Content} content Content where to execute the function. - * @return {number} Content scrollHeight or 0. + * @param content Content where to execute the function. + * @return Content scrollHeight or 0. */ getScrollHeight(content: Content): number { return (content && content._scroll && content.scrollHeight) || 0; @@ -1045,8 +1043,8 @@ export class CoreDomUtilsProvider { * Returns scrollTop of the content. * Checks hidden property _scroll to avoid errors if view is not active. * - * @param {Content} content Content where to execute the function. - * @return {number} Content scrollTop or 0. + * @param content Content where to execute the function. + * @return Content scrollTop or 0. */ getScrollTop(content: Content): number { return (content && content._scroll && content.scrollTop) || 0; @@ -1055,10 +1053,10 @@ export class CoreDomUtilsProvider { /** * Scroll to a certain element. * - * @param {Content} content The content that must be scrolled. - * @param {HTMLElement} element The element to scroll to. - * @param {string} [scrollParentClass] Parent class where to stop calculating the position. Default scroll-content. - * @return {boolean} True if the element is found, false otherwise. + * @param content The content that must be scrolled. + * @param element The element to scroll to. + * @param scrollParentClass Parent class where to stop calculating the position. Default scroll-content. + * @return True if the element is found, false otherwise. */ scrollToElement(content: Content, element: HTMLElement, scrollParentClass?: string): boolean { const position = this.getElementXY(element, undefined, scrollParentClass); @@ -1074,10 +1072,10 @@ export class CoreDomUtilsProvider { /** * Scroll to a certain element using a selector to find it. * - * @param {Content} content The content that must be scrolled. - * @param {string} selector Selector to find the element to scroll to. - * @param {string} [scrollParentClass] Parent class where to stop calculating the position. Default scroll-content. - * @return {boolean} True if the element is found, false otherwise. + * @param content The content that must be scrolled. + * @param selector Selector to find the element to scroll to. + * @param scrollParentClass Parent class where to stop calculating the position. Default scroll-content. + * @return True if the element is found, false otherwise. */ scrollToElementBySelector(content: Content, selector: string, scrollParentClass?: string): boolean { const position = this.getElementXY(content.getScrollElement(), selector, scrollParentClass); @@ -1093,9 +1091,9 @@ export class CoreDomUtilsProvider { /** * Search for an input with error (core-input-error directive) and scrolls to it if found. * - * @param {Content} content The content that must be scrolled. + * @param content The content that must be scrolled. * @param [scrollParentClass] Parent class where to stop calculating the position. Default scroll-content. - * @return {boolean} True if the element is found, false otherwise. + * @return True if the element is found, false otherwise. */ scrollToInputError(content: Content, scrollParentClass?: string): boolean { if (!content) { @@ -1108,7 +1106,7 @@ export class CoreDomUtilsProvider { /** * Set whether debug messages should be displayed. * - * @param {boolean} value Whether to display or not. + * @param value Whether to display or not. */ setDebugDisplay(value: boolean): void { this.debugDisplay = value; @@ -1117,11 +1115,11 @@ export class CoreDomUtilsProvider { /** * Show an alert modal with a button to close it. * - * @param {string} title Title to show. - * @param {string} message Message to show. - * @param {string} [buttonText] Text of the button. - * @param {number} [autocloseTime] Number of milliseconds to wait to close the modal. If not defined, modal won't be closed. - * @return {Promise} Promise resolved with the alert modal. + * @param title Title to show. + * @param message Message to show. + * @param buttonText Text of the button. + * @param autocloseTime Number of milliseconds to wait to close the modal. If not defined, modal won't be closed. + * @return Promise resolved with the alert modal. */ showAlert(title: string, message: string, buttonText?: string, autocloseTime?: number): Promise { const hasHTMLTags = this.textUtils.hasHTMLTags(message); @@ -1187,11 +1185,11 @@ export class CoreDomUtilsProvider { /** * Show an alert modal with a button to close it, translating the values supplied. * - * @param {string} title Title to show. - * @param {string} message Message to show. - * @param {string} [buttonText] Text of the button. - * @param {number} [autocloseTime] Number of milliseconds to wait to close the modal. If not defined, modal won't be closed. - * @return {Promise} Promise resolved with the alert modal. + * @param title Title to show. + * @param message Message to show. + * @param buttonText Text of the button. + * @param autocloseTime Number of milliseconds to wait to close the modal. If not defined, modal won't be closed. + * @return Promise resolved with the alert modal. */ showAlertTranslated(title: string, message: string, buttonText?: string, autocloseTime?: number): Promise { title = title ? this.translate.instant(title) : title; @@ -1204,12 +1202,12 @@ export class CoreDomUtilsProvider { /** * Show a confirm modal. * - * @param {string} message Message to show in the modal body. - * @param {string} [title] Title of the modal. - * @param {string} [okText] Text of the OK button. - * @param {string} [cancelText] Text of the Cancel button. - * @param {any} [options] More options. See https://ionicframework.com/docs/v3/api/components/alert/AlertController/ - * @return {Promise} Promise resolved if the user confirms and rejected with a canceled error if he cancels. + * @param message Message to show in the modal body. + * @param title Title of the modal. + * @param okText Text of the OK button. + * @param cancelText Text of the Cancel button. + * @param options More options. See https://ionicframework.com/docs/v3/api/components/alert/AlertController/ + * @return Promise resolved if the user confirms and rejected with a canceled error if he cancels. */ showConfirm(message: string, title?: string, okText?: string, cancelText?: string, options?: any): Promise { return new Promise((resolve, reject): void => { @@ -1263,10 +1261,10 @@ export class CoreDomUtilsProvider { /** * Show an alert modal with an error message. * - * @param {any} error Message to show. - * @param {boolean} [needsTranslate] Whether the error needs to be translated. - * @param {number} [autocloseTime] Number of milliseconds to wait to close the modal. If not defined, modal won't be closed. - * @return {Promise} Promise resolved with the alert modal. + * @param error Message to show. + * @param needsTranslate Whether the error needs to be translated. + * @param autocloseTime Number of milliseconds to wait to close the modal. If not defined, modal won't be closed. + * @return Promise resolved with the alert modal. */ showErrorModal(error: any, needsTranslate?: boolean, autocloseTime?: number): Promise { const message = this.getErrorMessage(error, needsTranslate); @@ -1282,11 +1280,11 @@ export class CoreDomUtilsProvider { /** * Show an alert modal with an error message. It uses a default message if error is not a string. * - * @param {any} error Message to show. - * @param {any} [defaultError] Message to show if the error is not a string. - * @param {boolean} [needsTranslate] Whether the error needs to be translated. - * @param {number} [autocloseTime] Number of milliseconds to wait to close the modal. If not defined, modal won't be closed. - * @return {Promise} Promise resolved with the alert modal. + * @param error Message to show. + * @param defaultError Message to show if the error is not a string. + * @param needsTranslate Whether the error needs to be translated. + * @param autocloseTime Number of milliseconds to wait to close the modal. If not defined, modal won't be closed. + * @return Promise resolved with the alert modal. */ showErrorModalDefault(error: any, defaultError: any, needsTranslate?: boolean, autocloseTime?: number): Promise { if (error && error.coreCanceled) { @@ -1306,11 +1304,11 @@ export class CoreDomUtilsProvider { /** * Show an alert modal with the first warning error message. It uses a default message if error is not a string. * - * @param {any} warnings Warnings returned. - * @param {any} [defaultError] Message to show if the error is not a string. - * @param {boolean} [needsTranslate] Whether the error needs to be translated. - * @param {number} [autocloseTime] Number of milliseconds to wait to close the modal. If not defined, modal won't be closed. - * @return {Promise} Promise resolved with the alert modal. + * @param warnings Warnings returned. + * @param defaultError Message to show if the error is not a string. + * @param needsTranslate Whether the error needs to be translated. + * @param autocloseTime Number of milliseconds to wait to close the modal. If not defined, modal won't be closed. + * @return Promise resolved with the alert modal. */ showErrorModalFirstWarning(warnings: any, defaultError: any, needsTranslate?: boolean, autocloseTime?: number): Promise { const error = warnings && warnings.length && warnings[0].message; @@ -1321,9 +1319,9 @@ export class CoreDomUtilsProvider { /** * Displays a loading modal window. * - * @param {string} [text] The text of the modal window. Default: core.loading. - * @param {boolean} [needsTranslate] Whether the 'text' needs to be translated. - * @return {Loading} Loading modal instance. + * @param text The text of the modal window. Default: core.loading. + * @param needsTranslate Whether the 'text' needs to be translated. + * @return Loading modal instance. * @description * Usage: * let modal = domUtils.showModalLoading(myText); @@ -1371,11 +1369,11 @@ export class CoreDomUtilsProvider { /** * Show a prompt modal to input some data. * - * @param {string} message Modal message. - * @param {string} [title] Modal title. - * @param {string} [placeholder] Placeholder of the input element. By default, "Password". - * @param {string} [type] Type of the input element. By default, password. - * @return {Promise} Promise resolved with the input data if the user clicks OK, rejected if cancels. + * @param message Modal message. + * @param title Modal title. + * @param placeholder Placeholder of the input element. By default, "Password". + * @param type Type of the input element. By default, password. + * @return Promise resolved with the input data if the user clicks OK, rejected if cancels. */ showPrompt(message: string, title?: string, placeholder?: string, type: string = 'password'): Promise { return new Promise((resolve, reject): void => { @@ -1431,12 +1429,12 @@ export class CoreDomUtilsProvider { /** * Displays an autodimissable toast modal window. * - * @param {string} text The text of the toast. - * @param {boolean} [needsTranslate] Whether the 'text' needs to be translated. - * @param {number} [duration=2000] Duration in ms of the dimissable toast. - * @param {string} [cssClass=""] Class to add to the toast. - * @param {boolean} [dismissOnPageChange=true] Dismiss the Toast on page change. - * @return {Toast} Toast instance. + * @param text The text of the toast. + * @param needsTranslate Whether the 'text' needs to be translated. + * @param duration Duration in ms of the dimissable toast. + * @param cssClass Class to add to the toast. + * @param dismissOnPageChange Dismiss the Toast on page change. + * @return Toast instance. */ showToast(text: string, needsTranslate?: boolean, duration: number = 2000, cssClass: string = '', dismissOnPageChange: boolean = true): Toast { @@ -1461,9 +1459,9 @@ export class CoreDomUtilsProvider { /** * Stores a component/directive instance. * - * @param {Element} element The root element of the component/directive. - * @param {any} instance The instance to store. - * @return {string} ID to identify the instance. + * @param element The root element of the component/directive. + * @param instance The instance to store. + * @return ID to identify the instance. */ storeInstanceByElement(element: Element, instance: any): string { const id = String(this.lastInstanceId++); @@ -1477,8 +1475,8 @@ export class CoreDomUtilsProvider { /** * Check if an element supports input via keyboard. * - * @param {any} el HTML element to check. - * @return {boolean} Whether it supports input using keyboard. + * @param el HTML element to check. + * @return Whether it supports input using keyboard. */ supportsInputKeyboard(el: any): boolean { return el && !el.disabled && (el.tagName.toLowerCase() == 'textarea' || @@ -1488,8 +1486,8 @@ export class CoreDomUtilsProvider { /** * Converts HTML formatted text to DOM element(s). * - * @param {string} text HTML text. - * @return {HTMLCollection} Same text converted to HTMLCollection. + * @param text HTML text. + * @return Same text converted to HTMLCollection. */ toDom(text: string): HTMLCollection { const element = this.convertToElement(text); @@ -1500,7 +1498,7 @@ export class CoreDomUtilsProvider { /** * Treat anchors inside alert/modals. * - * @param {HTMLElement} container The HTMLElement that can contain anchors. + * @param container The HTMLElement that can contain anchors. */ treatAnchors(container: HTMLElement): void { const anchors = Array.from(container.querySelectorAll('a')); @@ -1536,10 +1534,10 @@ export class CoreDomUtilsProvider { /** * View an image in a new page or modal. * - * @param {string} image URL of the image. - * @param {string} title Title of the page or modal. - * @param {string} [component] Component to link the image to if needed. - * @param {string|number} [componentId] An ID to use in conjunction with the component. + * @param image URL of the image. + * @param title Title of the page or modal. + * @param component Component to link the image to if needed. + * @param componentId An ID to use in conjunction with the component. */ viewImage(image: string, title?: string, component?: string, componentId?: string | number): void { if (image) { @@ -1558,8 +1556,8 @@ export class CoreDomUtilsProvider { /** * Wait for images to load. * - * @param {HTMLElement} element The element to search in. - * @return {Promise} Promise resolved with a boolean: whether there was any image to load. + * @param element The element to search in. + * @return Promise resolved with a boolean: whether there was any image to load. */ waitForImages(element: HTMLElement): Promise { const imgs = Array.from(element.querySelectorAll('img')), @@ -1592,8 +1590,8 @@ export class CoreDomUtilsProvider { /** * Wrap an HTMLElement with another element. * - * @param {HTMLElement} el The element to wrap. - * @param {HTMLElement} wrapper Wrapper. + * @param el The element to wrap. + * @param wrapper Wrapper. */ wrapElement(el: HTMLElement, wrapper: HTMLElement): void { // Insert the wrapper before the element. diff --git a/src/providers/utils/iframe.ts b/src/providers/utils/iframe.ts index 2952c22b1..5ccbab10b 100644 --- a/src/providers/utils/iframe.ts +++ b/src/providers/utils/iframe.ts @@ -46,9 +46,9 @@ export class CoreIframeUtilsProvider { /** * Check if a frame uses an online URL but the app is offline. If it does, the iframe is hidden and a warning is shown. * - * @param {any} element The frame to check (iframe, embed, ...). - * @param {boolean} [isSubframe] Whether it's a frame inside another frame. - * @return {boolean} True if frame is online and the app is offline, false otherwise. + * @param element The frame to check (iframe, embed, ...). + * @param isSubframe Whether it's a frame inside another frame. + * @return True if frame is online and the app is offline, false otherwise. */ checkOnlineFrameInOffline(element: any, isSubframe?: boolean): boolean { const src = element.src || element.data; @@ -146,8 +146,8 @@ export class CoreIframeUtilsProvider { * Given an element, return the content window and document. * Please notice that the element should be an iframe, embed or similar. * - * @param {any} element Element to treat (iframe, embed, ...). - * @return {{ window: Window, document: Document }} Window and Document. + * @param element Element to treat (iframe, embed, ...). + * @return Window and Document. */ getContentWindowAndDocument(element: any): { window: Window, document: Document } { let contentWindow: Window = element.contentWindow, @@ -188,10 +188,10 @@ export class CoreIframeUtilsProvider { * Redefine the open method in the contentWindow of an element and the sub frames. * Please notice that the element should be an iframe, embed or similar. * - * @param {any} element Element to treat (iframe, embed, ...). - * @param {Window} contentWindow The window of the element contents. - * @param {Document} contentDocument The document of the element contents. - * @param {NavController} [navCtrl] NavController to use if a link can be opened in the app. + * @param element Element to treat (iframe, embed, ...). + * @param contentWindow The window of the element contents. + * @param contentDocument The document of the element contents. + * @param navCtrl NavController to use if a link can be opened in the app. */ redefineWindowOpen(element: any, contentWindow: Window, contentDocument: Document, navCtrl?: NavController): void { if (contentWindow) { @@ -264,9 +264,9 @@ export class CoreIframeUtilsProvider { * Intercept window.open in a frame and its subframes, shows an error modal instead. * Search links () and open them in browser or InAppBrowser if needed. * - * @param {any} element Element to treat (iframe, embed, ...). - * @param {boolean} [isSubframe] Whether it's a frame inside another frame. - * @param {NavController} [navCtrl] NavController to use if a link can be opened in the app. + * @param element Element to treat (iframe, embed, ...). + * @param isSubframe Whether it's a frame inside another frame. + * @param navCtrl NavController to use if a link can be opened in the app. */ treatFrame(element: any, isSubframe?: boolean, navCtrl?: NavController): void { if (element) { @@ -300,8 +300,8 @@ export class CoreIframeUtilsProvider { * Search links () in a frame and open them in browser or InAppBrowser if needed. * Only links that haven't been treated by the frame's Javascript will be treated. * - * @param {any} element Element to treat (iframe, embed, ...). - * @param {Document} contentDocument The document of the element contents. + * @param element Element to treat (iframe, embed, ...). + * @param contentDocument The document of the element contents. */ treatFrameLinks(element: any, contentDocument: Document): void { if (!contentDocument) { diff --git a/src/providers/utils/mimetype.ts b/src/providers/utils/mimetype.ts index cac90bcb0..0e6e82d63 100644 --- a/src/providers/utils/mimetype.ts +++ b/src/providers/utils/mimetype.ts @@ -49,8 +49,8 @@ export class CoreMimetypeUtilsProvider { /** * Check if a file extension can be embedded without using iframes. * - * @param {string} extension Extension. - * @return {boolean} Whether it can be embedded. + * @param extension Extension. + * @return Whether it can be embedded. */ canBeEmbedded(extension: string): boolean { return this.isExtensionInGroup(extension, ['web_image', 'web_video', 'web_audio']); @@ -59,8 +59,8 @@ export class CoreMimetypeUtilsProvider { /** * Clean a extension, removing the dot, hash, extra params... * - * @param {string} extension Extension to clean. - * @return {string} Clean extension. + * @param extension Extension to clean. + * @return Clean extension. */ cleanExtension(extension: string): string { if (!extension) { @@ -87,7 +87,7 @@ export class CoreMimetypeUtilsProvider { /** * Fill the mimetypes and extensions info for a certain group. * - * @param {string} group Group name. + * @param group Group name. */ protected fillGroupMimeInfo(group: string): void { const mimetypes = {}, // Use an object to prevent duplicates. @@ -111,9 +111,9 @@ export class CoreMimetypeUtilsProvider { /** * Get the extension of a mimetype. Returns undefined if not found. * - * @param {string} mimetype Mimetype. - * @param {string} [url] URL of the file. It will be used if there's more than one possible extension. - * @return {string} Extension. + * @param mimetype Mimetype. + * @param url URL of the file. It will be used if there's more than one possible extension. + * @return Extension. */ getExtension(mimetype: string, url?: string): string { mimetype = mimetype || ''; @@ -141,8 +141,8 @@ export class CoreMimetypeUtilsProvider { /** * Get the URL of the icon of an extension. * - * @param {string} extension Extension. - * @return {string} Icon URL. + * @param extension Extension. + * @return Icon URL. */ getExtensionIcon(extension: string): string { const icon = this.getExtensionIconName(extension) || 'unknown'; @@ -153,8 +153,8 @@ export class CoreMimetypeUtilsProvider { /** * Get the name of the icon of an extension. * - * @param {string} extension Extension. - * @return {string} Icon. Undefined if not found. + * @param extension Extension. + * @return Icon. Undefined if not found. */ getExtensionIconName(extension: string): string { if (this.extToMime[extension]) { @@ -172,8 +172,8 @@ export class CoreMimetypeUtilsProvider { /** * Get the "type" (string) of an extension, something like "image", "video" or "audio". * - * @param {string} extension Extension. - * @return {string} Type of the extension. + * @param extension Extension. + * @return Type of the extension. */ getExtensionType(extension: string): string { extension = this.cleanExtension(extension); @@ -186,8 +186,8 @@ export class CoreMimetypeUtilsProvider { /** * Get all the possible extensions of a mimetype. Returns empty array if not found. * - * @param {string} mimetype Mimetype. - * @return {string[]} Extensions. + * @param mimetype Mimetype. + * @return Extensions. */ getExtensions(mimetype: string): string[] { mimetype = mimetype || ''; @@ -199,8 +199,8 @@ export class CoreMimetypeUtilsProvider { /** * Get a file icon URL based on its file name. * - * @param {string} The name of the file. - * @return {string} The path to a file icon. + * @param The name of the file. + * @return The path to a file icon. */ getFileIcon(filename: string): string { const ext = this.getFileExtension(filename), @@ -212,7 +212,7 @@ export class CoreMimetypeUtilsProvider { /** * Get the folder icon URL. * - * @return {string} The path to a folder icon. + * @return The path to a folder icon. */ getFolderIcon(): string { return 'assets/img/files/folder-64.png'; @@ -221,8 +221,8 @@ export class CoreMimetypeUtilsProvider { /** * Given a type (audio, video, html, ...), return its file icon path. * - * @param {string} type The type to get the icon. - * @return {string} The icon path. + * @param type The type to get the icon. + * @return The icon path. */ getFileIconForType(type: string): string { return 'assets/img/files/' + type + '-64.png'; @@ -232,8 +232,8 @@ export class CoreMimetypeUtilsProvider { * Guess the extension of a file from its URL. * This is very weak and unreliable. * - * @param {string} fileUrl The file URL. - * @return {string} The lowercased extension without the dot, or undefined. + * @param fileUrl The file URL. + * @return The lowercased extension without the dot, or undefined. */ guessExtensionFromUrl(fileUrl: string): string { const split = fileUrl.split('.'); @@ -268,8 +268,8 @@ export class CoreMimetypeUtilsProvider { * Returns the file extension of a file. * When the file does not have an extension, it returns undefined. * - * @param {string} filename The file name. - * @return {string} The lowercased extension, or undefined. + * @param filename The file name. + * @return The lowercased extension, or undefined. */ getFileExtension(filename: string): string { const dot = filename.lastIndexOf('.'); @@ -293,9 +293,9 @@ export class CoreMimetypeUtilsProvider { /** * Get the mimetype/extension info belonging to a certain group. * - * @param {string} group Group name. - * @param {string} [field] The field to get. If not supplied, all the info will be returned. - * @return {any} Info for the group. + * @param group Group name. + * @param field The field to get. If not supplied, all the info will be returned. + * @return Info for the group. */ getGroupMimeInfo(group: string, field?: string): any { if (typeof this.groupsMimeInfo[group] == 'undefined') { @@ -312,8 +312,8 @@ export class CoreMimetypeUtilsProvider { /** * Get the mimetype of an extension. Returns undefined if not found. * - * @param {string} extension Extension. - * @return {string} Mimetype. + * @param extension Extension. + * @return Mimetype. */ getMimeType(extension: string): string { extension = this.cleanExtension(extension); @@ -327,9 +327,9 @@ export class CoreMimetypeUtilsProvider { * Obtains descriptions for file types (e.g. 'Microsoft Word document') from the language file. * Based on Moodle's get_mimetype_description. * - * @param {any} obj Instance of FileEntry OR object with 'filename' and 'mimetype' OR string with mimetype. - * @param {boolean} [capitalise] If true, capitalises first character of result. - * @return {string} Type description. + * @param obj Instance of FileEntry OR object with 'filename' and 'mimetype' OR string with mimetype. + * @param capitalise If true, capitalises first character of result. + * @return Type description. */ getMimetypeDescription(obj: any, capitalise?: boolean): string { const langPrefix = 'assets.mimetypes.'; @@ -408,8 +408,8 @@ export class CoreMimetypeUtilsProvider { /** * Get the "type" (string) of a mimetype, something like "image", "video" or "audio". * - * @param {string} mimetype Mimetype. - * @return {string} Type of the mimetype. + * @param mimetype Mimetype. + * @return Type of the mimetype. */ getMimetypeType(mimetype: string): string { mimetype = mimetype.split(';')[0]; // Remove codecs from the mimetype if any. @@ -430,8 +430,8 @@ export class CoreMimetypeUtilsProvider { /** * Get the icon of a mimetype. * - * @param {string} mimetype Mimetype. - * @return {string} Type of the mimetype. + * @param mimetype Mimetype. + * @return Type of the mimetype. */ getMimetypeIcon(mimetype: string): string { mimetype = mimetype.split(';')[0]; // Remove codecs from the mimetype if any. @@ -454,8 +454,8 @@ export class CoreMimetypeUtilsProvider { /** * Given a group name, return the translated name. * - * @param {string} name Group name. - * @return {string} Translated name. + * @param name Group name. + * @return Translated name. */ getTranslatedGroupName(name: string): string { const key = 'assets.mimetypes.group:' + name, @@ -468,9 +468,9 @@ export class CoreMimetypeUtilsProvider { * Check if an extension belongs to at least one of the groups. * Similar to Moodle's file_mimetype_in_typegroup, but using the extension instead of mimetype. * - * @param {string} extension Extension. - * @param {string[]} groups List of groups to check. - * @return {boolean} Whether the extension belongs to any of the groups. + * @param extension Extension. + * @param groups List of groups to check. + * @return Whether the extension belongs to any of the groups. */ isExtensionInGroup(extension: string, groups: string[]): boolean { extension = this.cleanExtension(extension); @@ -490,8 +490,8 @@ export class CoreMimetypeUtilsProvider { /** * Remove the extension from a path (if any). * - * @param {string} path Path. - * @return {string} Path without extension. + * @param path Path. + * @return Path without extension. */ removeExtension(path: string): string { const position = path.lastIndexOf('.'); diff --git a/src/providers/utils/text.ts b/src/providers/utils/text.ts index a21ba8838..a33025210 100644 --- a/src/providers/utils/text.ts +++ b/src/providers/utils/text.ts @@ -78,8 +78,8 @@ export class CoreTextUtilsProvider { /** * Given an address as a string, return a URL to open the address in maps. * - * @param {string} address The address. - * @return {SafeUrl} URL to view the address. + * @param address The address. + * @return URL to view the address. */ buildAddressURL(address: string): SafeUrl { return this.sanitizer.bypassSecurityTrustUrl((this.platform.is('android') ? 'geo:0,0?q=' : 'http://maps.google.com?q=') + @@ -89,8 +89,8 @@ export class CoreTextUtilsProvider { /** * Given a list of sentences, build a message with all of them wrapped in

. * - * @param {string[]} messages Messages to show. - * @return {string} Message with all the messages. + * @param messages Messages to show. + * @return Message with all the messages. */ buildMessage(messages: string[]): string { let result = ''; @@ -107,9 +107,9 @@ export class CoreTextUtilsProvider { /** * Convert size in bytes into human readable format * - * @param {number} bytes Number of bytes to convert. - * @param {number} [precision=2] Number of digits after the decimal separator. - * @return {string} Size in human readable format. + * @param bytes Number of bytes to convert. + * @param precision Number of digits after the decimal separator. + * @return Size in human readable format. */ bytesToSize(bytes: number, precision: number = 2): string { @@ -140,9 +140,9 @@ export class CoreTextUtilsProvider { /** * Clean HTML tags. * - * @param {string} text The text to be cleaned. - * @param {boolean} [singleLine] True if new lines should be removed (all the text in a single line). - * @return {string} Clean text. + * @param text The text to be cleaned. + * @param singleLine True if new lines should be removed (all the text in a single line). + * @return Clean text. */ cleanTags(text: string, singleLine?: boolean): string { if (typeof text != 'string') { @@ -167,9 +167,9 @@ export class CoreTextUtilsProvider { /** * Concatenate two paths, adding a slash between them if needed. * - * @param {string} leftPath Left path. - * @param {string} rightPath Right path. - * @return {string} Concatenated path. + * @param leftPath Left path. + * @param rightPath Right path. + * @return Concatenated path. */ concatenatePaths(leftPath: string, rightPath: string): string { if (!leftPath) { @@ -194,8 +194,8 @@ export class CoreTextUtilsProvider { * Convert some HTML as text into an HTMLElement. This HTML is put inside a div or a body. * This function is the same as in DomUtils, but we cannot use that one because of circular dependencies. * - * @param {string} html Text to convert. - * @return {HTMLElement} Element. + * @param html Text to convert. + * @return Element. */ protected convertToElement(html: string): HTMLElement { // Add a div to hold the content, that's the element that will be returned. @@ -207,8 +207,8 @@ export class CoreTextUtilsProvider { /** * Count words in a text. * - * @param {string} text Text to count. - * @return {number} Number of words. + * @param text Text to count. + * @return Number of words. */ countWords(text: string): number { if (!text || typeof text != 'string') { @@ -240,8 +240,8 @@ export class CoreTextUtilsProvider { /** * Decode an escaped HTML text. This implementation is based on PHP's htmlspecialchars_decode. * - * @param {string|number} text Text to decode. - * @return {string} Decoded text. + * @param text Text to decode. + * @return Decoded text. */ decodeHTML(text: string | number): string { if (typeof text == 'undefined' || text === null || (typeof text == 'number' && isNaN(text))) { @@ -262,8 +262,8 @@ export class CoreTextUtilsProvider { /** * Decode HTML entities in a text. Equivalent to PHP html_entity_decode. * - * @param {string} text Text to decode. - * @return {string} Decoded text. + * @param text Text to decode. + * @return Decoded text. */ decodeHTMLEntities(text: string): string { if (text) { @@ -277,8 +277,8 @@ export class CoreTextUtilsProvider { /** * Same as Javascript's decodeURI, but if an exception is thrown it will return the original URI. * - * @param {string} uri URI to decode. - * @return {string} Decoded URI, or original URI if an exception is thrown. + * @param uri URI to decode. + * @return Decoded URI, or original URI if an exception is thrown. */ decodeURI(uri: string): string { try { @@ -293,8 +293,8 @@ export class CoreTextUtilsProvider { /** * Same as Javascript's decodeURIComponent, but if an exception is thrown it will return the original URI. * - * @param {string} uri URI to decode. - * @return {string} Decoded URI, or original URI if an exception is thrown. + * @param uri URI to decode. + * @return Decoded URI, or original URI if an exception is thrown. */ decodeURIComponent(uri: string): string { try { @@ -309,8 +309,8 @@ export class CoreTextUtilsProvider { /** * Escapes some characters in a string to be used as a regular expression. * - * @param {string} text Text to escape. - * @return {string} Escaped text. + * @param text Text to escape. + * @return Escaped text. */ escapeForRegex(text: string): string { if (!text || typeof text != 'string') { @@ -323,8 +323,8 @@ export class CoreTextUtilsProvider { /** * Escape an HTML text. This implementation is based on PHP's htmlspecialchars. * - * @param {string|number} text Text to escape. - * @return {string} Escaped text. + * @param text Text to escape. + * @return Escaped text. */ escapeHTML(text: string | number): string { if (typeof text == 'undefined' || text === null || (typeof text == 'number' && isNaN(text))) { @@ -344,11 +344,11 @@ export class CoreTextUtilsProvider { /** * Shows a text on a new page. * - * @param {string} title Title of the new state. - * @param {string} text Content of the text to be expanded. - * @param {string} [component] Component to link the embedded files to. - * @param {string|number} [componentId] An ID to use in conjunction with the component. - * @param {any[]} [files] List of files to display along with the text. + * @param title Title of the new state. + * @param text Content of the text to be expanded. + * @param component Component to link the embedded files to. + * @param componentId An ID to use in conjunction with the component. + * @param files List of files to display along with the text. */ expandText(title: string, text: string, component?: string, componentId?: string | number, files?: any[]): void { if (text.length > 0) { @@ -371,8 +371,8 @@ export class CoreTextUtilsProvider { /** * Formats a text, in HTML replacing new lines by correct html new lines. * - * @param {string} text Text to format. - * @return {string} Formatted text. + * @param text Text to format. + * @return Formatted text. */ formatHtmlLines(text: string): string { const hasHTMLTags = this.hasHTMLTags(text); @@ -392,12 +392,12 @@ export class CoreTextUtilsProvider { /** * Formats a text, treating multilang tags and cleaning HTML if needed. * - * @param {string} text Text to format. - * @param {boolean} [clean] Whether HTML tags should be removed. - * @param {boolean} [singleLine] Whether new lines should be removed. Only valid if clean is true. - * @param {number} [shortenLength] Number of characters to shorten the text. - * @param {number} [highlight] Text to highlight. - * @return {Promise} Promise resolved with the formatted text. + * @param text Text to format. + * @param clean Whether HTML tags should be removed. + * @param singleLine Whether new lines should be removed. Only valid if clean is true. + * @param shortenLength Number of characters to shorten the text. + * @param highlight Text to highlight. + * @return Promise resolved with the formatted text. */ formatText(text: string, clean?: boolean, singleLine?: boolean, shortenLength?: number, highlight?: string): Promise { return this.treatMultilangTags(text).then((formatted) => { @@ -418,8 +418,8 @@ export class CoreTextUtilsProvider { /** * Get the error message from an error object. * - * @param {any} error Error object. - * @return {string} Error message, undefined if not found. + * @param error Error object. + * @return Error message, undefined if not found. */ getErrorMessageFromError(error: any): string { if (typeof error == 'string') { @@ -432,8 +432,8 @@ export class CoreTextUtilsProvider { /** * Get the pluginfile URL to replace @@PLUGINFILE@@ wildcards. * - * @param {any[]} files Files to extract the URL from. They need to have the URL in a 'url' or 'fileurl' attribute. - * @return {string} Pluginfile URL, undefined if no files found. + * @param files Files to extract the URL from. They need to have the URL in a 'url' or 'fileurl' attribute. + * @return Pluginfile URL, undefined if no files found. */ getTextPluginfileUrl(files: any[]): string { if (files && files.length) { @@ -449,8 +449,8 @@ export class CoreTextUtilsProvider { /** * Check if a text contains HTML tags. * - * @param {string} text Text to check. - * @return {boolean} Whether it has HTML tags. + * @param text Text to check. + * @return Whether it has HTML tags. */ hasHTMLTags(text: string): boolean { return /<[a-z][\s\S]*>/i.test(text); @@ -459,9 +459,9 @@ export class CoreTextUtilsProvider { /** * Highlight all occurrences of a certain text inside another text. It will add some HTML code to highlight it. * - * @param {string} text Full text. - * @param {string} searchText Text to search and highlight. - * @return {string} Highlighted text. + * @param text Full text. + * @param searchText Text to search and highlight. + * @return Highlighted text. */ highlightText(text: string, searchText: string): string { if (!text || typeof text != 'string') { @@ -478,8 +478,8 @@ export class CoreTextUtilsProvider { /** * Check if HTML content is blank. * - * @param {string} content HTML content. - * @return {boolean} True if the string does not contain actual content: text, images, etc. + * @param content HTML content. + * @return True if the string does not contain actual content: text, images, etc. */ htmlIsBlank(content: string): boolean { if (!content) { @@ -496,8 +496,8 @@ export class CoreTextUtilsProvider { * Check if a text contains Unicode long chars. * Using as threshold Hex value D800 * - * @param {string} text Text to check. - * @return {boolean} True if has Unicode chars, false otherwise. + * @param text Text to check. + * @return True if has Unicode chars, false otherwise. */ hasUnicode(text: string): boolean { for (let x = 0; x < text.length; x++) { @@ -512,8 +512,8 @@ export class CoreTextUtilsProvider { /** * Check if an object has any long Unicode char. * - * @param {object} data Object to be checked. - * @return {boolean} If the data has any long Unicode char on it. + * @param data Object to be checked. + * @return If the data has any long Unicode char on it. */ hasUnicodeData(data: object): boolean { for (const el in data) { @@ -532,10 +532,10 @@ export class CoreTextUtilsProvider { /** * Same as Javascript's JSON.parse, but it will handle errors. * - * @param {string} json JSON text. - * @param {any} [defaultValue] Default value t oreturn if the parse fails. Defaults to the original value. - * @param {Function} [logErrorFn] An error to call with the exception to log the error. If not supplied, no error. - * @return {any} JSON parsed as object or what it gets. + * @param json JSON text. + * @param defaultValue Default value t oreturn if the parse fails. Defaults to the original value. + * @param logErrorFn An error to call with the exception to log the error. If not supplied, no error. + * @return JSON parsed as object or what it gets. */ parseJSON(json: string, defaultValue?: any, logErrorFn?: Function): any { try { @@ -554,8 +554,8 @@ export class CoreTextUtilsProvider { /** * Remove ending slash from a path or URL. * - * @param {string} text Text to treat. - * @return {string} Treated text. + * @param text Text to treat. + * @return Treated text. */ removeEndingSlash(text: string): string { if (!text) { @@ -572,8 +572,8 @@ export class CoreTextUtilsProvider { /** * Replace all characters that cause problems with files in Android and iOS. * - * @param {string} text Text to treat. - * @return {string} Treated text. + * @param text Text to treat. + * @return Treated text. */ removeSpecialCharactersForFiles(text: string): string { if (!text || typeof text != 'string') { @@ -586,9 +586,9 @@ export class CoreTextUtilsProvider { /** * Replace all the new lines on a certain text. * - * @param {string} text The text to be treated. - * @param {string} newValue Text to use instead of new lines. - * @return {string} Treated text. + * @param text The text to be treated. + * @param newValue Text to use instead of new lines. + * @return Treated text. */ replaceNewLines(text: string, newValue: string): string { if (!text || typeof text != 'string') { @@ -601,9 +601,9 @@ export class CoreTextUtilsProvider { /** * Replace @@PLUGINFILE@@ wildcards with the real URL in a text. * - * @param {string} Text to treat. - * @param {any[]} files Files to extract the pluginfile URL from. They need to have the URL in a url or fileurl attribute. - * @return {string} Treated text. + * @param Text to treat. + * @param files Files to extract the pluginfile URL from. They need to have the URL in a url or fileurl attribute. + * @return Treated text. */ replacePluginfileUrls(text: string, files: any[]): string { if (text && typeof text == 'string') { @@ -619,9 +619,9 @@ export class CoreTextUtilsProvider { /** * Replace pluginfile URLs with @@PLUGINFILE@@ wildcards. * - * @param {string} text Text to treat. - * @param {any[]} files Files to extract the pluginfile URL from. They need to have the URL in a url or fileurl attribute. - * @return {string} Treated text. + * @param text Text to treat. + * @param files Files to extract the pluginfile URL from. They need to have the URL in a url or fileurl attribute. + * @return Treated text. */ restorePluginfileUrls(text: string, files: any[]): string { if (text && typeof text == 'string') { @@ -640,9 +640,9 @@ export class CoreTextUtilsProvider { * 7.toFixed(2) -> 7.00 * roundToDecimals(7, 2) -> 7 * - * @param {number} num Number to round. - * @param {number} [decimals=2] Number of decimals. By default, 2. - * @return {number} Rounded number. + * @param num Number to round. + * @param decimals Number of decimals. By default, 2. + * @return Rounded number. */ roundToDecimals(num: number, decimals: number = 2): number { const multiplier = Math.pow(10, decimals); @@ -656,8 +656,8 @@ export class CoreTextUtilsProvider { * Returns text with HTML characters (like "<", ">", etc.) properly quoted. * Based on Moodle's s() function. * - * @param {string} text Text to treat. - * @return {string} Treated text. + * @param text Text to treat. + * @return Treated text. */ s(text: string): string { if (!text) { @@ -670,9 +670,9 @@ export class CoreTextUtilsProvider { /** * Shortens a text to length and adds an ellipsis. * - * @param {string} text The text to be shortened. - * @param {number} length The desired length. - * @return {string} Shortened text. + * @param text The text to be shortened. + * @param length The desired length. + * @return Shortened text. */ shortenText(text: string, length: number): string { if (text.length > length) { @@ -693,8 +693,8 @@ export class CoreTextUtilsProvider { * Strip Unicode long char of a given text. * Using as threshold Hex value D800 * - * @param {string} text Text to check. - * @return {string} Without the Unicode chars. + * @param text Text to check. + * @return Without the Unicode chars. */ stripUnicode(text: string): string { let stripped = ''; @@ -710,8 +710,8 @@ export class CoreTextUtilsProvider { /** * Treat the list of disabled features, replacing old nomenclature with the new one. * - * @param {string} features List of disabled features. - * @return {string} Treated list. + * @param features List of disabled features. + * @return Treated list. */ treatDisabledFeatures(features: string): string { if (!features) { @@ -730,8 +730,8 @@ export class CoreTextUtilsProvider { /** * Treat the multilang tags from a HTML code, leaving only the current language. * - * @param {string} text The text to be treated. - * @return {Promise} Promise resolved with the formatted text. + * @param text The text to be treated. + * @return Promise resolved with the formatted text. */ treatMultilangTags(text: string): Promise { if (!text || typeof text != 'string') { @@ -766,8 +766,8 @@ export class CoreTextUtilsProvider { /** * If a number has only 1 digit, add a leading zero to it. * - * @param {string|number} num Number to convert. - * @return {string} Number with leading zeros. + * @param num Number to convert. + * @return Number with leading zeros. */ twoDigits(num: string | number): string { if (num < 10) { @@ -780,8 +780,8 @@ export class CoreTextUtilsProvider { /** * Make a string's first character uppercase. * - * @param {string} text Text to treat. - * @return {string} Treated text. + * @param text Text to treat. + * @return Treated text. */ ucFirst(text: string): string { return text.charAt(0).toUpperCase() + text.slice(1); @@ -791,9 +791,9 @@ export class CoreTextUtilsProvider { * Unserialize Array from PHP. * Taken from: https://github.com/kvz/locutus/blob/master/src/php/var/unserialize.js * - * @param {string} data String to unserialize. - * @param {Function} [logErrorFn] An error to call with the exception to log the error. If not supplied, no error. - * @return {any} Unserialized data. + * @param data String to unserialize. + * @param logErrorFn An error to call with the exception to log the error. If not supplied, no error. + * @return Unserialized data. */ unserialize (data: string, logErrorFn?: Function): any { // Discuss at: http://locutus.io/php/unserialize/ diff --git a/src/providers/utils/time.ts b/src/providers/utils/time.ts index 9be16dd58..a35317c34 100644 --- a/src/providers/utils/time.ts +++ b/src/providers/utils/time.ts @@ -72,8 +72,8 @@ export class CoreTimeUtilsProvider { /** * Convert a PHP format to a Moment format. * - * @param {string} format PHP format. - * @return {string} Converted format. + * @param format PHP format. + * @return Converted format. */ convertPHPToMoment(format: string): string { if (typeof format != 'string') { @@ -121,8 +121,8 @@ export class CoreTimeUtilsProvider { /** * Fix format to use in an ion-datetime. * - * @param {string} format Format to use. - * @return {string} Fixed format. + * @param format Format to use. + * @return Fixed format. */ fixFormatForDatetime(format: string): string { if (!format) { @@ -144,8 +144,8 @@ export class CoreTimeUtilsProvider { /** * Returns hours, minutes and seconds in a human readable format * - * @param {number} seconds A number of seconds - * @return {string} Seconds in a human readable format. + * @param seconds A number of seconds + * @return Seconds in a human readable format. */ formatTime(seconds: number): string { let totalSecs, @@ -218,9 +218,9 @@ export class CoreTimeUtilsProvider { /** * Returns hours, minutes and seconds in a human readable format. * - * @param {number} duration Duration in seconds - * @param {number} [precision] Number of elements to have in precission. 0 or undefined to full precission. - * @return {string} Duration in a human readable format. + * @param duration Duration in seconds + * @param precision Number of elements to have in precission. 0 or undefined to full precission. + * @return Duration in a human readable format. */ formatDuration(duration: number, precision?: number): string { precision = precision || 5; @@ -255,7 +255,7 @@ export class CoreTimeUtilsProvider { /** * Return the current timestamp in a "readable" format: YYYYMMDDHHmmSS. * - * @return {string} The readable timestamp. + * @return The readable timestamp. */ readableTimestamp(): string { return moment(Date.now()).format('YYYYMMDDHHmmSS'); @@ -264,7 +264,7 @@ export class CoreTimeUtilsProvider { /** * Return the current timestamp (UNIX format, seconds). * - * @return {number} The current timestamp in seconds. + * @return The current timestamp in seconds. */ timestamp(): number { return Math.round(Date.now() / 1000); @@ -273,12 +273,12 @@ export class CoreTimeUtilsProvider { /** * Convert a timestamp into a readable date. * - * @param {number} timestamp Timestamp in milliseconds. - * @param {string} [format] The format to use (lang key). Defaults to core.strftimedaydatetime. - * @param {boolean} [convert=true] If true (default), convert the format from PHP to Moment. Set it to false for Moment formats. - * @param {boolean} [fixDay=true] If true (default) then the leading zero from %d is removed. - * @param {boolean} [fixHour=true] If true (default) then the leading zero from %I is removed. - * @return {string} Readable date. + * @param timestamp Timestamp in milliseconds. + * @param format The format to use (lang key). Defaults to core.strftimedaydatetime. + * @param convert If true (default), convert the format from PHP to Moment. Set it to false for Moment formats. + * @param fixDay If true (default) then the leading zero from %d is removed. + * @param fixHour If true (default) then the leading zero from %I is removed. + * @return Readable date. */ userDate(timestamp: number, format?: string, convert: boolean = true, fixDay: boolean = true, fixHour: boolean = true): string { format = this.translate.instant(format ? format : 'core.strftimedaydatetime'); @@ -302,8 +302,8 @@ export class CoreTimeUtilsProvider { /** * Convert a timestamp to the format to set to a datetime input. * - * @param {number} [timestamp] Timestamp to convert (in ms). If not provided, current time. - * @return {string} Formatted time. + * @param timestamp Timestamp to convert (in ms). If not provided, current time. + * @return Formatted time. */ toDatetimeFormat(timestamp?: number): string { timestamp = timestamp || Date.now(); @@ -314,8 +314,8 @@ export class CoreTimeUtilsProvider { /** * Convert a text into user timezone timestamp. * - * @param {number} date To convert to timestamp. - * @return {number} Converted timestamp. + * @param date To convert to timestamp. + * @return Converted timestamp. */ convertToTimestamp(date: string): number { if (typeof date == 'string' && date.slice(-1) == 'Z') { @@ -329,8 +329,8 @@ export class CoreTimeUtilsProvider { * Return the localized ISO format (i.e DDMMYY) from the localized moment format. Useful for translations. * DO NOT USE this function for ion-datetime format. Moment escapes characters with [], but ion-datetime doesn't support it. * - * @param {any} localizedFormat Format to use. - * @return {string} Localized ISO format + * @param localizedFormat Format to use. + * @return Localized ISO format */ getLocalizedDateFormat(localizedFormat: any): string { return moment.localeData().longDateFormat(localizedFormat); @@ -342,8 +342,8 @@ export class CoreTimeUtilsProvider { * The calculation is performed relative to the user's midnight timestamp * for today to ensure that timezones are preserved. * - * @param {number} [timestamp] The timestamp to calculate from. If not defined, return today's midnight. - * @return {number} The midnight value of the user's timestamp. + * @param timestamp The timestamp to calculate from. If not defined, return today's midnight. + * @return The midnight value of the user's timestamp. */ getMidnightForTimestamp(timestamp?: number): number { if (timestamp) { diff --git a/src/providers/utils/url.ts b/src/providers/utils/url.ts index a7b47de34..7edd7174f 100644 --- a/src/providers/utils/url.ts +++ b/src/providers/utils/url.ts @@ -27,8 +27,8 @@ export class CoreUrlUtilsProvider { /** * Add or remove 'www' from a URL. The url needs to have http or https protocol. * - * @param {string} url URL to modify. - * @return {string} Modified URL. + * @param url URL to modify. + * @return Modified URL. */ addOrRemoveWWW(url: string): string { if (url) { @@ -47,9 +47,9 @@ export class CoreUrlUtilsProvider { /** * Given a URL and a text, return an HTML link. * - * @param {string} url URL. - * @param {string} text Text of the link. - * @return {string} Link. + * @param url URL. + * @param text Text of the link. + * @return Link. */ buildLink(url: string, text: string): string { return '' + text + ''; @@ -58,8 +58,8 @@ export class CoreUrlUtilsProvider { /** * Extracts the parameters from a URL and stores them in an object. * - * @param {string} url URL to treat. - * @return {any} Object with the params. + * @param url URL to treat. + * @return Object with the params. */ extractUrlParams(url: string): any { const regex = /[?&]+([^=&]+)=?([^&]*)?/gi, @@ -104,10 +104,10 @@ export class CoreUrlUtilsProvider { * For download remote files from Moodle we need to use the special /webservice/pluginfile passing * the ws token as a get parameter. * - * @param {string} url The url to be fixed. - * @param {string} token Token to use. - * @param {string} siteUrl The URL of the site the URL belongs to. - * @return {string} Fixed URL. + * @param url The url to be fixed. + * @param token Token to use. + * @param siteUrl The URL of the site the URL belongs to. + * @return Fixed URL. */ fixPluginfileURL(url: string, token: string, siteUrl: string): string { if (!url) { @@ -146,8 +146,8 @@ export class CoreUrlUtilsProvider { /** * Formats a URL, trim, lowercase, etc... * - * @param {string} url The url to be formatted. - * @return {string} Fromatted url. + * @param url The url to be formatted. + * @return Fromatted url. */ formatURL(url: string): string { url = url.trim(); @@ -171,9 +171,9 @@ export class CoreUrlUtilsProvider { /** * Returns the URL to the documentation of the app, based on Moodle version and current language. * - * @param {string} [release] Moodle release. - * @param {string} [page=Mobile_app] Docs page to go to. - * @return {Promise} Promise resolved with the Moodle docs URL. + * @param release Moodle release. + * @param page Docs page to go to. + * @return Promise resolved with the Moodle docs URL. */ getDocsUrl(release?: string, page: string = 'Mobile_app'): Promise { let docsUrl = 'https://docs.moodle.org/en/' + page; @@ -199,8 +199,8 @@ export class CoreUrlUtilsProvider { * Example: * http://mysite.com/a/course.html?id=1 -> course.html * - * @param {string} url URL to treat. - * @return {string} Last file without params. + * @param url URL to treat. + * @return Last file without params. */ getLastFileWithoutParams(url: string): string { let filename = url.substr(url.lastIndexOf('/') + 1); @@ -215,8 +215,8 @@ export class CoreUrlUtilsProvider { * Get the protocol from a URL. * E.g. http://www.google.com returns 'http'. * - * @param {string} url URL to treat. - * @return {string} Protocol, undefined if no protocol found. + * @param url URL to treat. + * @return Protocol, undefined if no protocol found. */ getUrlProtocol(url: string): string { if (!url) { @@ -233,8 +233,8 @@ export class CoreUrlUtilsProvider { * Get the scheme from a URL. Please notice that, if a URL has protocol, it will return the protocol. * E.g. javascript:doSomething() returns 'javascript'. * - * @param {string} url URL to treat. - * @return {string} Scheme, undefined if no scheme found. + * @param url URL to treat. + * @return Scheme, undefined if no scheme found. */ getUrlScheme(url: string): string { if (!url) { @@ -250,8 +250,8 @@ export class CoreUrlUtilsProvider { /* * Gets a username from a URL like: user@mysite.com. * - * @param {string} url URL to treat. - * @return {string} Username. Undefined if no username found. + * @param url URL to treat. + * @return Username. Undefined if no username found. */ getUsernameFromUrl(url: string): string { if (url.indexOf('@') > -1) { @@ -269,8 +269,8 @@ export class CoreUrlUtilsProvider { /** * Returns if a URL has any protocol (not a relative URL). * - * @param {string} url The url to test against the pattern. - * @return {boolean} Whether the url is absolute. + * @param url The url to test against the pattern. + * @return Whether the url is absolute. */ isAbsoluteURL(url: string): boolean { return /^[^:]{2,}:\/\//i.test(url) || /^(tel:|mailto:|geo:)/.test(url); @@ -279,8 +279,8 @@ export class CoreUrlUtilsProvider { /** * Returns if a URL is downloadable: plugin file OR theme/image.php OR gravatar. * - * @param {string} url The URL to test. - * @return {boolean} Whether the URL is downloadable. + * @param url The URL to test. + * @return Whether the URL is downloadable. */ isDownloadableUrl(url: string): boolean { return this.isPluginFileUrl(url) || this.isThemeImageUrl(url) || this.isGravatarUrl(url); @@ -289,8 +289,8 @@ export class CoreUrlUtilsProvider { /** * Returns if a URL is a gravatar URL. * - * @param {string} url The URL to test. - * @return {boolean} Whether the URL is a gravatar URL. + * @param url The URL to test. + * @return Whether the URL is a gravatar URL. */ isGravatarUrl(url: string): boolean { return url && url.indexOf('gravatar.com/avatar') !== -1; @@ -299,8 +299,8 @@ export class CoreUrlUtilsProvider { /** * Check if a URL uses http or https protocol. * - * @param {string} url The url to test. - * @return {boolean} Whether the url uses http or https protocol. + * @param url The url to test. + * @return Whether the url uses http or https protocol. */ isHttpURL(url: string): boolean { return /^https?\:\/\/.+/i.test(url); @@ -309,8 +309,8 @@ export class CoreUrlUtilsProvider { /** * Returns if a URL is a pluginfile URL. * - * @param {string} url The URL to test. - * @return {boolean} Whether the URL is a pluginfile URL. + * @param url The URL to test. + * @return Whether the URL is a pluginfile URL. */ isPluginFileUrl(url: string): boolean { return url && url.indexOf('/pluginfile.php') !== -1; @@ -319,8 +319,8 @@ export class CoreUrlUtilsProvider { /** * Returns if a URL is a theme image URL. * - * @param {string} url The URL to test. - * @return {boolean} Whether the URL is a theme image URL. + * @param url The URL to test. + * @return Whether the URL is a theme image URL. */ isThemeImageUrl(url: string): boolean { return url && url.indexOf('/theme/image.php') !== -1; @@ -329,8 +329,8 @@ export class CoreUrlUtilsProvider { /** * Remove protocol and www from a URL. * - * @param {string} url URL to treat. - * @return {string} Treated URL. + * @param url URL to treat. + * @return Treated URL. */ removeProtocolAndWWW(url: string): string { // Remove protocol. @@ -344,8 +344,8 @@ export class CoreUrlUtilsProvider { /** * Remove the parameters from a URL, returning the URL without them. * - * @param {string} url URL to treat. - * @return {string} URL without params. + * @param url URL to treat. + * @return URL without params. */ removeUrlParams(url: string): string { const matches = url.match(/^[^\?]+/); diff --git a/src/providers/utils/utils.ts b/src/providers/utils/utils.ts index bc73ce6ca..5b9d3b70f 100644 --- a/src/providers/utils/utils.ts +++ b/src/providers/utils/utils.ts @@ -34,21 +34,20 @@ import { CoreWSProvider, CoreWSError } from '../ws'; export interface PromiseDefer { /** * The promise. - * @type {Promise} */ promise?: Promise; /** * Function to resolve the promise. * - * @param {any} [value] The resolve value. + * @param value The resolve value. */ resolve?: (value?: any) => void; // Function to resolve the promise. /** * Function to reject the promise. * - * @param {any} [reason] The reject param. + * @param reason The reject param. */ reject?: (reason?: any) => void; } @@ -74,9 +73,9 @@ export class CoreUtilsProvider { /** * Given an error, add an extra warning to the error message and return the new error message. * - * @param {any} error Error object or message. - * @param {any} [defaultError] Message to show if the error is not a string. - * @return {string} New error message. + * @param error Error object or message. + * @param defaultError Message to show if the error is not a string. + * @return New error message. */ addDataNotDownloadedError(error: any, defaultError?: string): string { let errorMessage = error; @@ -100,8 +99,8 @@ export class CoreUtilsProvider { /** * Similar to Promise.all, but if a promise fails this function's promise won't be rejected until ALL promises have finished. * - * @param {Promise[]} promises Promises. - * @return {Promise} Promise resolved if all promises are resolved and rejected if at least 1 promise fails. + * @param promises Promises. + * @return Promise resolved if all promises are resolved and rejected if at least 1 promise fails. */ allPromises(promises: Promise[]): Promise { if (!promises || !promises.length) { @@ -138,10 +137,10 @@ export class CoreUtilsProvider { * Converts an array of objects to an object, using a property of each entry as the key. * E.g. [{id: 10, name: 'A'}, {id: 11, name: 'B'}] => {10: {id: 10, name: 'A'}, 11: {id: 11, name: 'B'}} * - * @param {any[]} array The array to convert. - * @param {string} propertyName The name of the property to use as the key. - * @param {any} [result] Object where to put the properties. If not defined, a new object will be created. - * @return {any} The object. + * @param array The array to convert. + * @param propertyName The name of the property to use as the key. + * @param result Object where to put the properties. If not defined, a new object will be created. + * @return The object. */ arrayToObject(array: any[], propertyName: string, result?: any): any { result = result || {}; @@ -157,12 +156,12 @@ export class CoreUtilsProvider { * Also, this will only check if itemA's properties are in itemB with same value. This function will still * return true if itemB has more properties than itemA. * - * @param {any} itemA First object. - * @param {any} itemB Second object. - * @param {number} [maxLevels=0] Number of levels to reach if 2 objects are compared. - * @param {number} [level=0] Current deep level (when comparing objects). - * @param {boolean} [undefinedIsNull=true] True if undefined is equal to null. Defaults to true. - * @return {boolean} Whether both items are equal. + * @param itemA First object. + * @param itemB Second object. + * @param maxLevels Number of levels to reach if 2 objects are compared. + * @param level Current deep level (when comparing objects). + * @param undefinedIsNull True if undefined is equal to null. Defaults to true. + * @return Whether both items are equal. */ basicLeftCompare(itemA: any, itemB: any, maxLevels: number = 0, level: number = 0, undefinedIsNull: boolean = true): boolean { if (typeof itemA == 'function' || typeof itemB == 'function') { @@ -215,8 +214,8 @@ export class CoreUtilsProvider { /** * Check if a URL has a redirect. * - * @param {string} url The URL to check. - * @return {Promise} Promise resolved with boolean_ whether there is a redirect. + * @param url The URL to check. + * @return Promise resolved with boolean_ whether there is a redirect. */ checkRedirect(url: string): Promise { if (window.fetch) { @@ -253,7 +252,7 @@ export class CoreUtilsProvider { /** * Close the InAppBrowser window. * - * @param {boolean} [closeAll] Desktop only. True to close all secondary windows, false to close only the "current" one. + * @param closeAll Desktop only. True to close all secondary windows, false to close only the "current" one. */ closeInAppBrowser(closeAll?: boolean): void { if (this.iabInstance) { @@ -267,9 +266,9 @@ export class CoreUtilsProvider { /** * Clone a variable. It should be an object, array or primitive type. * - * @param {any} source The variable to clone. - * @param {number} [level=0] Depth we are right now inside a cloned object. It's used to prevent reaching max call stack size. - * @return {any} Cloned variable. + * @param source The variable to clone. + * @param level Depth we are right now inside a cloned object. It's used to prevent reaching max call stack size. + * @return Cloned variable. */ clone(source: any, level: number = 0): any { if (level >= 20) { @@ -310,9 +309,9 @@ export class CoreUtilsProvider { /** * Copy properties from one object to another. * - * @param {any} from Object to copy the properties from. - * @param {any} to Object where to store the properties. - * @param {boolean} [clone=true] Whether the properties should be cloned (so they are different instances). + * @param from Object to copy the properties from. + * @param to Object where to store the properties. + * @param clone Whether the properties should be cloned (so they are different instances). */ copyProperties(from: any, to: any, clone: boolean = true): void { for (const name in from) { @@ -327,8 +326,8 @@ export class CoreUtilsProvider { /** * Copies a text to clipboard and shows a toast message. * - * @param {string} text Text to be copied - * @return {Promise} Promise resolved when text is copied. + * @param text Text to be copied + * @return Promise resolved when text is copied. */ copyToClipboard(text: string): Promise { return this.clipboard.copy(text).then(() => { @@ -342,9 +341,9 @@ export class CoreUtilsProvider { /** * Create a "fake" WS error for local errors. * - * @param {string} message The message to include in the error. - * @param {boolean} [needsTranslate] If the message needs to be translated. - * @return {CoreWSError} Fake WS error. + * @param message The message to include in the error. + * @param needsTranslate If the message needs to be translated. + * @return Fake WS error. */ createFakeWSError(message: string, needsTranslate?: boolean): CoreWSError { return this.wsProvider.createFakeWSError(message, needsTranslate); @@ -353,7 +352,7 @@ export class CoreUtilsProvider { /** * Empties an array without losing its reference. * - * @param {any[]} array Array to empty. + * @param array Array to empty. */ emptyArray(array: any[]): void { array.length = 0; // Empty array without losing its reference. @@ -362,7 +361,7 @@ export class CoreUtilsProvider { /** * Removes all properties from an object without losing its reference. * - * @param {object} object Object to remove the properties. + * @param object Object to remove the properties. */ emptyObject(object: object): void { for (const key in object) { @@ -375,12 +374,12 @@ export class CoreUtilsProvider { /** * Execute promises one depending on the previous. * - * @param {any[]} orderedPromisesData Data to be executed including the following values: - * - func: Function to be executed. - * - context: Context to pass to the function. This allows using "this" inside the function. - * - params: Array of data to be sent to the function. - * - blocking: Boolean. If promise should block the following. - * @return {Promise} Promise resolved when all promises are resolved. + * @param orderedPromisesData Data to be executed including the following values: + * - func: Function to be executed. + * - context: Context to pass to the function. This allows using "this" inside the function. + * - params: Array of data to be sent to the function. + * - blocking: Boolean. If promise should block the following. + * @return Promise resolved when all promises are resolved. */ executeOrderedPromises(orderedPromisesData: any[]): Promise { const promises = []; @@ -422,9 +421,9 @@ export class CoreUtilsProvider { * It supports 2 notations: dot notation and square brackets. * E.g.: {a: {b: 1, c: 2}, d: 3} -> {'a.b': 1, 'a.c': 2, d: 3} * - * @param {object} obj Object to flatten. - * @param {boolean} [useDotNotation] Whether to use dot notation '.' or square brackets '['. - * @return {object} Flattened object. + * @param obj Object to flatten. + * @param useDotNotation Whether to use dot notation '.' or square brackets '['. + * @return Flattened object. */ flattenObject(obj: object, useDotNotation?: boolean): object { const toReturn = {}; @@ -456,9 +455,9 @@ export class CoreUtilsProvider { /** * Given an array of strings, return only the ones that match a regular expression. * - * @param {string[]} array Array to filter. - * @param {RegExp} regex RegExp to apply to each string. - * @return {string[]} Filtered array. + * @param array Array to filter. + * @param regex RegExp to apply to each string. + * @return Filtered array. */ filterByRegexp(array: string[], regex: RegExp): string[] { if (!array || !array.length) { @@ -475,13 +474,13 @@ export class CoreUtilsProvider { /** * Filter the list of site IDs based on a isEnabled function. * - * @param {string[]} siteIds Site IDs to filter. - * @param {Function} isEnabledFn Function to call for each site. Must return true or a promise resolved with true if enabled. + * @param siteIds Site IDs to filter. + * @param isEnabledFn Function to call for each site. Must return true or a promise resolved with true if enabled. * It receives a siteId param and all the params sent to this function after 'checkAll'. - * @param {boolean} [checkAll] True if it should check all the sites, false if it should check only 1 and treat them all - * depending on this result. - * @param {any} ...args All the params sent after checkAll will be passed to isEnabledFn. - * @return {Promise} Promise resolved with the list of enabled sites. + * @param checkAll True if it should check all the sites, false if it should check only 1 and treat them all + * depending on this result. + * @param ...args All the params sent after checkAll will be passed to isEnabledFn. + * @return Promise resolved with the list of enabled sites. */ filterEnabledSites(siteIds: string[], isEnabledFn: Function, checkAll?: boolean, ...args: any[]): Promise { const promises = [], @@ -514,8 +513,8 @@ export class CoreUtilsProvider { * Given a float, prints it nicely. Localized floats must not be used in calculations! * Based on Moodle's format_float. * - * @param {any} float The float to print. - * @return {string} Locale float. + * @param float The float to print. + * @return Locale float. */ formatFloat(float: any): string { if (typeof float == 'undefined' || float === null || typeof float == 'boolean') { @@ -535,12 +534,12 @@ export class CoreUtilsProvider { * List has to be sorted by depth to allow this function to work correctly. Errors can be thrown if a child node is * processed before a parent node. * - * @param {any[]} list List to format. - * @param {string} [parentFieldName=parent] Name of the parent field to match with children. - * @param {string} [idFieldName=id] Name of the children field to match with parent. - * @param {number} [rootParentId=0] The id of the root. - * @param {number} [maxDepth=5] Max Depth to convert to tree. Children found will be in the last level of depth. - * @return {any[]} Array with the formatted tree, children will be on each node under children field. + * @param list List to format. + * @param parentFieldName Name of the parent field to match with children. + * @param idFieldName Name of the children field to match with parent. + * @param rootParentId The id of the root. + * @param maxDepth Max Depth to convert to tree. Children found will be in the last level of depth. + * @return Array with the formatted tree, children will be on each node under children field. */ formatTree(list: any[], parentFieldName: string = 'parent', idFieldName: string = 'id', rootParentId: number = 0, maxDepth: number = 5): any[] { @@ -592,8 +591,8 @@ export class CoreUtilsProvider { /** * Get country name based on country code. * - * @param {string} code Country code (AF, ES, US, ...). - * @return {string} Country name. If the country is not found, return the country code. + * @param code Country code (AF, ES, US, ...). + * @return Country name. If the country is not found, return the country code. */ getCountryName(code: string): string { const countryKey = 'assets.countries.' + code, @@ -605,7 +604,7 @@ export class CoreUtilsProvider { /** * Get list of countries with their code and translated name. * - * @return {Promise} Promise resolved with the list of countries. + * @return Promise resolved with the list of countries. */ getCountryList(): Promise { // Get the keys of the countries. @@ -627,7 +626,7 @@ export class CoreUtilsProvider { /** * Get the list of language keys of the countries. * - * @return {Promise} Promise resolved with the countries list. Rejected if not translated. + * @return Promise resolved with the countries list. Rejected if not translated. */ protected getCountryKeysList(): Promise { // It's possible that the current language isn't translated, so try with default language first. @@ -649,8 +648,8 @@ export class CoreUtilsProvider { /** * Get the list of language keys of the countries, based on the translation table for a certain language. * - * @param {string} lang Language to check. - * @return {Promise} Promise resolved with the countries list. Rejected if not translated. + * @param lang Language to check. + * @return Promise resolved with the countries list. Rejected if not translated. */ protected getCountryKeysListForLanguage(lang: string): Promise { // Get the translation table for the language. @@ -678,8 +677,8 @@ export class CoreUtilsProvider { * perform a HEAD request to get it. It's done in this order because pluginfile.php can return wrong mimetypes. * This function is in here instead of MimetypeUtils to prevent circular dependencies. * - * @param {string} url The URL of the file. - * @return {Promise} Promise resolved with the mimetype. + * @param url The URL of the file. + * @return Promise resolved with the mimetype. */ getMimeTypeFromUrl(url: string): Promise { // First check if it can be guessed from the URL. @@ -699,8 +698,8 @@ export class CoreUtilsProvider { /** * Get a unique ID for a certain name. * - * @param {string} name The name to get the ID for. - * @return {number} Unique ID. + * @param name The name to get the ID for. + * @return Unique ID. */ getUniqueId(name: string): number { if (!this.uniqueIds[name]) { @@ -713,8 +712,8 @@ export class CoreUtilsProvider { /** * Given a list of files, check if there are repeated names. * - * @param {any[]} files List of files. - * @return {string|boolean} String with error message if repeated, false if no repeated. + * @param files List of files. + * @return String with error message if repeated, false if no repeated. */ hasRepeatedFilenames(files: any[]): string | boolean { if (!files || !files.length) { @@ -739,9 +738,9 @@ export class CoreUtilsProvider { /** * Gets the index of the first string that matches a regular expression. * - * @param {string[]} array Array to search. - * @param {RegExp} regex RegExp to apply to each string. - * @return {number} Index of the first string that matches the RegExp. -1 if not found. + * @param array Array to search. + * @param regex RegExp to apply to each string. + * @return Index of the first string that matches the RegExp. -1 if not found. */ indexOfRegexp(array: string[], regex: RegExp): number { if (!array || !array.length) { @@ -763,8 +762,8 @@ export class CoreUtilsProvider { /** * Return true if the param is false (bool), 0 (number) or "0" (string). * - * @param {any} value Value to check. - * @return {boolean} Whether the value is false, 0 or "0". + * @param value Value to check. + * @return Whether the value is false, 0 or "0". */ isFalseOrZero(value: any): boolean { return typeof value != 'undefined' && (value === false || value === 'false' || parseInt(value, 10) === 0); @@ -773,8 +772,8 @@ export class CoreUtilsProvider { /** * Return true if the param is true (bool), 1 (number) or "1" (string). * - * @param {any} value Value to check. - * @return {boolean} Whether the value is true, 1 or "1". + * @param value Value to check. + * @return Whether the value is true, 1 or "1". */ isTrueOrOne(value: any): boolean { return typeof value != 'undefined' && (value === true || value === 'true' || parseInt(value, 10) === 1); @@ -783,8 +782,8 @@ export class CoreUtilsProvider { /** * Given an error returned by a WS call, check if the error is generated by the app or it has been returned by the WebSwervice. * - * @param {any} error Error to check. - * @return {boolean} Whether the error was returned by the WebService. + * @param error Error to check. + * @return Whether the error was returned by the WebService. */ isWebServiceError(error: any): boolean { return error && (typeof error.warningcode != 'undefined' || (typeof error.errorcode != 'undefined' && @@ -798,11 +797,11 @@ export class CoreUtilsProvider { * Given a list (e.g. a,b,c,d,e) this function returns an array of 1->a, 2->b, 3->c etc. * Taken from make_menu_from_list on moodlelib.php (not the same but similar). * - * @param {string} list The string to explode into array bits - * @param {string} [defaultLabel] Element that will become default option, if not defined, it won't be added. - * @param {string} [separator] The separator used within the list string. Default ','. - * @param {any} [defaultValue] Element that will become default option value. Default 0. - * @return {any[]} The now assembled array + * @param list The string to explode into array bits + * @param defaultLabel Element that will become default option, if not defined, it won't be added. + * @param separator The separator used within the list string. Default ','. + * @param defaultValue Element that will become default option value. Default 0. + * @return The now assembled array */ makeMenuFromList(list: string, defaultLabel?: string, separator: string = ',', defaultValue?: any): any[] { // Split and format the list. @@ -826,10 +825,10 @@ export class CoreUtilsProvider { /** * Merge two arrays, removing duplicate values. * - * @param {any[]} array1 The first array. - * @param {any[]} array2 The second array. + * @param array1 The first array. + * @param array2 The second array. * @param [key] Key of the property that must be unique. If not specified, the whole entry. - * @return {any[]} Merged array. + * @return Merged array. */ mergeArraysWithoutDuplicates(array1: any[], array2: any[], key?: string): any[] { return this.uniqueArray(array1.concat(array2), key); @@ -838,8 +837,8 @@ export class CoreUtilsProvider { /** * Open a file using platform specific method. * - * @param {string} path The local path of the file to be open. - * @return {Promise} Promise resolved when done. + * @param path The local path of the file to be open. + * @return Promise resolved when done. */ openFile(path: string): Promise { const extension = this.mimetypeUtils.getFileExtension(path), @@ -871,9 +870,9 @@ export class CoreUtilsProvider { * Open a URL using InAppBrowser. * Do not use for files, refer to {@link openFile}. * - * @param {string} url The URL to open. - * @param {any} [options] Override default options passed to InAppBrowser. - * @return {InAppBrowserObject} The opened window. + * @param url The URL to open. + * @param options Override default options passed to InAppBrowser. + * @return The opened window. */ openInApp(url: string, options?: any): InAppBrowserObject { if (!url) { @@ -943,7 +942,7 @@ export class CoreUtilsProvider { * Open a URL using a browser. * Do not use for files, refer to {@link openFile}. * - * @param {string} url The URL to open. + * @param url The URL to open. */ openInBrowser(url: string): void { if (this.appProvider.isDesktop()) { @@ -962,8 +961,8 @@ export class CoreUtilsProvider { * Open an online file using platform specific method. * Specially useful for audio and video since they can be streamed. * - * @param {string} url The URL of the file. - * @return {Promise} Promise resolved when opened. + * @param url The URL of the file. + * @return Promise resolved when opened. */ openOnlineFile(url: string): Promise { if (this.platform.is('android')) { @@ -1000,8 +999,8 @@ export class CoreUtilsProvider { /** * Converts an object into an array, losing the keys. * - * @param {object} obj Object to convert. - * @return {any[]} Array with the values of the object but losing the keys. + * @param obj Object to convert. + * @return Array with the values of the object but losing the keys. */ objectToArray(obj: object): any[] { return Object.keys(obj).map((key) => { @@ -1014,12 +1013,12 @@ export class CoreUtilsProvider { * the key and value of the original object. * For example, it can convert {size: 2} into [{name: 'size', value: 2}]. * - * @param {object} obj Object to convert. - * @param {string} keyName Name of the properties where to store the keys. - * @param {string} valueName Name of the properties where to store the values. - * @param {boolean} [sortByKey] True to sort keys alphabetically, false otherwise. Has priority over sortByValue. - * @param {boolean} [sortByValue] True to sort values alphabetically, false otherwise. - * @return {any[]} Array of objects with the name & value of each property. + * @param obj Object to convert. + * @param keyName Name of the properties where to store the keys. + * @param valueName Name of the properties where to store the values. + * @param sortByKey True to sort keys alphabetically, false otherwise. Has priority over sortByValue. + * @param sortByValue True to sort values alphabetically, false otherwise. + * @return Array of objects with the name & value of each property. */ objectToArrayOfObjects(obj: object, keyName: string, valueName: string, sortByKey?: boolean, sortByValue?: boolean): any[] { // Get the entries from an object or primitive value. @@ -1075,11 +1074,11 @@ export class CoreUtilsProvider { * Converts an array of objects into an object with key and value. The opposite of objectToArrayOfObjects. * For example, it can convert [{name: 'size', value: 2}] into {size: 2}. * - * @param {object[]} objects List of objects to convert. - * @param {string} keyName Name of the properties where the keys are stored. - * @param {string} valueName Name of the properties where the values are stored. - * @param {string} [keyPrefix] Key prefix if neededs to delete it. - * @return {object} Object. + * @param objects List of objects to convert. + * @param keyName Name of the properties where the keys are stored. + * @param valueName Name of the properties where the values are stored. + * @param keyPrefix Key prefix if neededs to delete it. + * @return Object. */ objectToKeyValueMap(objects: object[], keyName: string, valueName: string, keyPrefix?: string): object { if (!objects) { @@ -1099,9 +1098,9 @@ export class CoreUtilsProvider { /** * Convert an object to a format of GET param. E.g.: {a: 1, b: 2} -> a=1&b=2 * - * @param {any} object Object to convert. - * @param {boolean} [removeEmpty=true] Whether to remove params whose value is null/undefined. - * @return {string} GET params. + * @param object Object to convert. + * @param removeEmpty Whether to remove params whose value is null/undefined. + * @return GET params. */ objectToGetParams(object: any, removeEmpty: boolean = true): string { // First of all, flatten the object so all properties are in the first level. @@ -1130,9 +1129,9 @@ export class CoreUtilsProvider { /** * Add a prefix to all the keys in an object. * - * @param {any} data Object. - * @param {string} prefix Prefix to add. - * @return {any} Prefixed object. + * @param data Object. + * @param prefix Prefix to add. + * @return Prefixed object. */ prefixKeys(data: any, prefix: string): any { const newObj = {}, @@ -1148,7 +1147,7 @@ export class CoreUtilsProvider { /** * Similar to AngularJS $q.defer(). * - * @return {PromiseDefer} The deferred promise. + * @return The deferred promise. */ promiseDefer(): PromiseDefer { const deferred: PromiseDefer = {}; @@ -1163,8 +1162,8 @@ export class CoreUtilsProvider { /** * Given a promise, returns true if it's rejected or false if it's resolved. * - * @param {Promise} promise Promise to check - * @return {Promise} Promise resolved with boolean: true if the promise is rejected or false if it's resolved. + * @param promise Promise to check + * @return Promise resolved with boolean: true if the promise is rejected or false if it's resolved. */ promiseFails(promise: Promise): Promise { return promise.then(() => { @@ -1177,8 +1176,8 @@ export class CoreUtilsProvider { /** * Given a promise, returns true if it's resolved or false if it's rejected. * - * @param {Promise} promise Promise to check - * @return {Promise} Promise resolved with boolean: true if the promise it's resolved or false if it's rejected. + * @param promise Promise to check + * @return Promise resolved with boolean: true if the promise it's resolved or false if it's rejected. */ promiseWorks(promise: Promise): Promise { return promise.then(() => { @@ -1193,10 +1192,10 @@ export class CoreUtilsProvider { * Missing values are replaced by '', and the values are compared with ===. * Booleans and numbers are cast to string before comparing. * - * @param {any} obj1 The first object or array. - * @param {any} obj2 The second object or array. - * @param {string} key Key to check. - * @return {boolean} Whether the two objects/arrays have the same value (or lack of one) for a given key. + * @param obj1 The first object or array. + * @param obj2 The second object or array. + * @param key Key to check. + * @return Whether the two objects/arrays have the same value (or lack of one) for a given key. */ sameAtKeyMissingIsBlank(obj1: any, obj2: any, key: string): boolean { let value1 = typeof obj1[key] != 'undefined' ? obj1[key] : '', @@ -1216,8 +1215,8 @@ export class CoreUtilsProvider { * Stringify an object, sorting the properties. It doesn't sort arrays, only object properties. E.g.: * {b: 2, a: 1} -> '{"a":1,"b":2}' * - * @param {object} obj Object to stringify. - * @return {string} Stringified object. + * @param obj Object to stringify. + * @return Stringified object. */ sortAndStringify(obj: object): string { return JSON.stringify(this.sortProperties(obj)); @@ -1226,8 +1225,8 @@ export class CoreUtilsProvider { /** * Given an object, sort its properties and the properties of all the nested objects. * - * @param {object} obj The object to sort. If it isn't an object, the original value will be returned. - * @return {object} Sorted object. + * @param obj The object to sort. If it isn't an object, the original value will be returned. + * @return Sorted object. */ sortProperties(obj: object): object { if (typeof obj == 'object' && !Array.isArray(obj)) { @@ -1246,8 +1245,8 @@ export class CoreUtilsProvider { /** * Given an object, sort its values. Values need to be primitive values, it cannot have subobjects. * - * @param {object} obj The object to sort. If it isn't an object, the original value will be returned. - * @return {object} Sorted object. + * @param obj The object to sort. If it isn't an object, the original value will be returned. + * @return Sorted object. */ sortValues(obj: object): object { if (typeof obj == 'object' && !Array.isArray(obj)) { @@ -1263,8 +1262,8 @@ export class CoreUtilsProvider { /** * Sum the filesizes from a list of files checking if the size will be partial or totally calculated. * - * @param {any[]} files List of files to sum its filesize. - * @return {{size: number, total: boolean}} File size and a boolean to indicate if it is the total size or only partial. + * @param files List of files to sum its filesize. + * @return File size and a boolean to indicate if it is the total size or only partial. */ sumFileSizes(files: any[]): { size: number, total: boolean } { const result = { @@ -1288,9 +1287,9 @@ export class CoreUtilsProvider { * Set a timeout to a Promise. If the time passes before the Promise is resolved or rejected, it will be automatically * rejected. * - * @param {Promise} promise The promise to timeout. - * @param {number} time Number of milliseconds of the timeout. - * @return {Promise} Promise with the timeout. + * @param promise The promise to timeout. + * @param time Number of milliseconds of the timeout. + * @return Promise with the timeout. */ timeoutPromise(promise: Promise, time: number): Promise { return new Promise((resolve, reject): void => { @@ -1309,9 +1308,9 @@ export class CoreUtilsProvider { * Do NOT try to do any math operations before this conversion on any user submitted floats! * Based on Moodle's unformat_float function. * - * @param {any} localeFloat Locale aware float representation. - * @param {boolean} [strict] If true, then check the input and return false if it is not a valid number. - * @return {any} False if bad format, empty string if empty value or the parsed float if not. + * @param localeFloat Locale aware float representation. + * @param strict If true, then check the input and return false if it is not a valid number. + * @return False if bad format, empty string if empty value or the parsed float if not. */ unformatFloat(localeFloat: any, strict?: boolean): any { // Bad format on input type number. @@ -1348,9 +1347,9 @@ export class CoreUtilsProvider { /** * Return an array without duplicate values. * - * @param {any[]} array The array to treat. + * @param array The array to treat. * @param [key] Key of the property that must be unique. If not specified, the whole entry. - * @return {any[]} Array without duplicate values. + * @return Array without duplicate values. */ uniqueArray(array: any[], key?: string): any[] { const filtered = [], diff --git a/src/providers/ws.ts b/src/providers/ws.ts index 636b00e0b..1d891cfa3 100644 --- a/src/providers/ws.ts +++ b/src/providers/ws.ts @@ -32,31 +32,26 @@ import { CoreInterceptor } from '@classes/interceptor'; export interface CoreWSPreSets { /** * The site URL. - * @type {string} */ siteUrl: string; /** * The Webservice token. - * @type {string} */ wsToken: string; /** * Defaults to true. Set to false when the expected response is null. - * @type {boolean} */ responseExpected?: boolean; /** * Defaults to 'object'. Use it when you expect a type that's not an object|array. - * @type {string} */ typeExpected?: string; /** * Defaults to false. Clean multibyte Unicode chars from data. - * @type {string} */ cleanUnicode?: boolean; } @@ -67,25 +62,21 @@ export interface CoreWSPreSets { export interface CoreWSAjaxPreSets { /** * The site URL. - * @type {string} */ siteUrl: string; /** * Defaults to true. Set to false when the expected response is null. - * @type {boolean} */ responseExpected?: boolean; /** * Whether to use the no-login endpoint instead of the normal one. Use it for requests that don't require authentication. - * @type {boolean} */ noLogin?: boolean; /** * Whether to send the parameters via GET. Only if noLogin is true. - * @type {boolean} */ useGet?: boolean; } @@ -96,19 +87,16 @@ export interface CoreWSAjaxPreSets { export interface CoreWSError { /** * The error message. - * @type {string} */ message: string; /** * Name of the exception. Undefined for local errors (fake WS errors). - * @type {string} */ exception?: string; /** * The error code. Undefined for local errors (fake WS errors). - * @type {string} */ errorcode?: string; } @@ -119,13 +107,11 @@ export interface CoreWSError { export interface CoreWSFileUploadOptions extends FileUploadOptions { /** * The file area where to put the file. By default, 'draft'. - * @type {string} */ fileArea?: string; /** * Item ID of the area where to put the file. By default, 0. - * @type {number} */ itemId?: number; } @@ -151,12 +137,12 @@ export class CoreWSProvider { /** * Adds the call data to an special queue to be processed when retrying. * - * @param {string} method The WebService method to be called. - * @param {string} siteUrl Complete site url to perform the call. - * @param {any} ajaxData Arguments to pass to the method. - * @param {CoreWSPreSets} preSets Extra settings and information. - * @return {Promise} Deferred promise resolved with the response data in success and rejected with the error message - * if it fails. + * @param method The WebService method to be called. + * @param siteUrl Complete site url to perform the call. + * @param ajaxData Arguments to pass to the method. + * @param preSets Extra settings and information. + * @return Deferred promise resolved with the response data in success and rejected with the error message + * if it fails. */ protected addToRetryQueue(method: string, siteUrl: string, ajaxData: any, preSets: CoreWSPreSets): Promise { const call: any = { @@ -180,10 +166,10 @@ export class CoreWSProvider { /** * A wrapper function for a moodle WebService call. * - * @param {string} method The WebService method to be called. - * @param {any} data Arguments to pass to the method. It's recommended to call convertValuesToString before passing the data. - * @param {CoreWSPreSets} preSets Extra settings and information. - * @return {Promise} Promise resolved with the response data in success and rejected if it fails. + * @param method The WebService method to be called. + * @param data Arguments to pass to the method. It's recommended to call convertValuesToString before passing the data. + * @param preSets Extra settings and information. + * @return Promise resolved with the response data in success and rejected if it fails. */ call(method: string, data: any, preSets: CoreWSPreSets): Promise { @@ -218,13 +204,13 @@ export class CoreWSProvider { /** * Call a Moodle WS using the AJAX API. Please use it if the WS layer is not an option. * - * @param {string} method The WebService method to be called. - * @param {any} data Arguments to pass to the method. - * @param {CoreWSAjaxPreSets} preSets Extra settings and information. Only some - * @return {Promise} Promise resolved with the response data in success and rejected with an object containing: - * - error: Error message. - * - errorcode: Error code returned by the site (if any). - * - available: 0 if unknown, 1 if available, -1 if not available. + * @param method The WebService method to be called. + * @param data Arguments to pass to the method. + * @param preSets Extra settings and information. Only some + * @return Promise resolved with the response data in success and rejected with an object containing: + * - error: Error message. + * - errorcode: Error code returned by the site (if any). + * - available: 0 if unknown, 1 if available, -1 if not available. */ callAjax(method: string, data: any, preSets: CoreWSAjaxPreSets): Promise { let promise; @@ -306,9 +292,9 @@ export class CoreWSProvider { * Converts an objects values to strings where appropriate. * Arrays (associative or otherwise) will be maintained, null values will be removed. * - * @param {object} data The data that needs all the non-object values set to strings. - * @param {boolean} [stripUnicode] If Unicode long chars need to be stripped. - * @return {object} The cleaned object or null if some strings becomes empty after stripping Unicode. + * @param data The data that needs all the non-object values set to strings. + * @param stripUnicode If Unicode long chars need to be stripped. + * @return The cleaned object or null if some strings becomes empty after stripping Unicode. */ convertValuesToString(data: any, stripUnicode?: boolean): any { const result: any = Array.isArray(data) ? [] : {}; @@ -362,9 +348,9 @@ export class CoreWSProvider { /** * Create a "fake" WS error for local errors. * - * @param {string} message The message to include in the error. - * @param {boolean} [needsTranslate] If the message needs to be translated. - * @return {CoreWSError} Fake WS error. + * @param message The message to include in the error. + * @param needsTranslate If the message needs to be translated. + * @return Fake WS error. */ createFakeWSError(message: string, needsTranslate?: boolean): CoreWSError { if (needsTranslate) { @@ -379,11 +365,11 @@ export class CoreWSProvider { /** * Downloads a file from Moodle using Cordova File API. * - * @param {string} url Download url. - * @param {string} path Local path to store the file. - * @param {boolean} [addExtension] True if extension need to be added to the final path. - * @param {Function} [onProgress] Function to call on progress. - * @return {Promise} Promise resolved with the downloaded file. + * @param url Download url. + * @param path Local path to store the file. + * @param addExtension True if extension need to be added to the final path. + * @param onProgress Function to call on progress. + * @return Promise resolved with the downloaded file. */ downloadFile(url: string, path: string, addExtension?: boolean, onProgress?: (event: ProgressEvent) => any): Promise { this.logger.debug('Downloading file', url, path, addExtension); @@ -455,9 +441,9 @@ export class CoreWSProvider { /** * Get a promise from the cache. * - * @param {string} method Method of the HTTP request. - * @param {string} url Base URL of the HTTP request. - * @param {any} [params] Params of the HTTP request. + * @param method Method of the HTTP request. + * @param url Base URL of the HTTP request. + * @param params Params of the HTTP request. */ protected getPromiseHttp(method: string, url: string, params?: any): any { const queueItemId = this.getQueueItemId(method, url, params); @@ -471,9 +457,9 @@ export class CoreWSProvider { /** * Perform a HEAD request to get the mimetype of a remote file. * - * @param {string} url File URL. - * @param {boolean} [ignoreCache] True to ignore cache, false otherwise. - * @return {Promise} Promise resolved with the mimetype or '' if failure. + * @param url File URL. + * @param ignoreCache True to ignore cache, false otherwise. + * @return Promise resolved with the mimetype or '' if failure. */ getRemoteFileMimeType(url: string, ignoreCache?: boolean): Promise { if (this.mimeTypeCache[url] && !ignoreCache) { @@ -498,8 +484,8 @@ export class CoreWSProvider { /** * Perform a HEAD request to get the size of a remote file. * - * @param {string} url File URL. - * @return {Promise} Promise resolved with the size or -1 if failure. + * @param url File URL. + * @return Promise resolved with the size or -1 if failure. */ getRemoteFileSize(url: string): Promise { return this.performHead(url).then((data) => { @@ -519,7 +505,7 @@ export class CoreWSProvider { /** * Get a request timeout based on the network connection. * - * @return {number} Timeout in ms. + * @return Timeout in ms. */ getRequestTimeout(): number { return this.appProvider.isNetworkAccessLimited() ? CoreConstants.WS_TIMEOUT : CoreConstants.WS_TIMEOUT_WIFI; @@ -528,10 +514,10 @@ export class CoreWSProvider { /** * Get the unique queue item id of the cache for a HTTP request. * - * @param {string} method Method of the HTTP request. - * @param {string} url Base URL of the HTTP request. - * @param {object} [params] Params of the HTTP request. - * @return {string} Queue item ID. + * @param method Method of the HTTP request. + * @param url Base URL of the HTTP request. + * @param params Params of the HTTP request. + * @return Queue item ID. */ protected getQueueItemId(method: string, url: string, params?: any): string { if (params) { @@ -544,8 +530,8 @@ export class CoreWSProvider { /** * Perform a HEAD request and save the promise while waiting to be resolved. * - * @param {string} url URL to perform the request. - * @return {Promise} Promise resolved with the response. + * @param url URL to perform the request. + * @return Promise resolved with the response. */ performHead(url: string): Promise { let promise = this.getPromiseHttp('head', url); @@ -561,11 +547,11 @@ export class CoreWSProvider { /** * Perform the post call and save the promise while waiting to be resolved. * - * @param {string} method The WebService method to be called. - * @param {string} siteUrl Complete site url to perform the call. - * @param {any} ajaxData Arguments to pass to the method. - * @param {CoreWSPreSets} preSets Extra settings and information. - * @return {Promise} Promise resolved with the response data in success and rejected with CoreWSError if it fails. + * @param method The WebService method to be called. + * @param siteUrl Complete site url to perform the call. + * @param ajaxData Arguments to pass to the method. + * @param preSets Extra settings and information. + * @return Promise resolved with the response data in success and rejected with CoreWSError if it fails. */ performPost(method: string, siteUrl: string, ajaxData: any, preSets: CoreWSPreSets): Promise { const options = {}; @@ -687,11 +673,11 @@ export class CoreWSProvider { /** * Save promise on the cache. * - * @param {Promise} promise Promise to be saved. - * @param {string} method Method of the HTTP request. - * @param {string} url Base URL of the HTTP request. - * @param {any} [params] Params of the HTTP request. - * @return {Promise} The promise saved. + * @param promise Promise to be saved. + * @param method Method of the HTTP request. + * @param url Base URL of the HTTP request. + * @param params Params of the HTTP request. + * @return The promise saved. */ protected setPromiseHttp(promise: Promise, method: string, url: string, params?: any): Promise { const queueItemId = this.getQueueItemId(method, url, params); @@ -716,11 +702,11 @@ export class CoreWSProvider { * A wrapper function for a synchronous Moodle WebService call. * Warning: This function should only be used if synchronous is a must. It's recommended to use call. * - * @param {string} method The WebService method to be called. - * @param {any} data Arguments to pass to the method. - * @param {CoreWSPreSets} preSets Extra settings and information. - * @return {Promise} Promise resolved with the response data in success and rejected with the error message if it fails. - * @return {any} Request response. If the request fails, returns an object with 'error'=true and 'message' properties. + * @param method The WebService method to be called. + * @param data Arguments to pass to the method. + * @param preSets Extra settings and information. + * @return Promise resolved with the response data in success and rejected with the error message if it fails. + * @return Request response. If the request fails, returns an object with 'error'=true and 'message' properties. */ syncCall(method: string, data: any, preSets: CoreWSPreSets): any { const errorResponse = { @@ -809,11 +795,11 @@ export class CoreWSProvider { /* * Uploads a file. * - * @param {string} filePath File path. - * @param {CoreWSFileUploadOptions} options File upload options. - * @param {CoreWSPreSets} preSets Must contain siteUrl and wsToken. - * @param {Function} [onProgress] Function to call on progress. - * @return {Promise} Promise resolved when uploaded. + * @param filePath File path. + * @param options File upload options. + * @param preSets Must contain siteUrl and wsToken. + * @param onProgress Function to call on progress. + * @return Promise resolved when uploaded. */ uploadFile(filePath: string, options: CoreWSFileUploadOptions, preSets: CoreWSPreSets, onProgress?: (event: ProgressEvent) => any): Promise { From 31c5990593ba2aa0f4bf585669354c880372b2f4 Mon Sep 17 00:00:00 2001 From: Albert Gasset Date: Fri, 13 Sep 2019 12:06:09 +0200 Subject: [PATCH 3/3] MOBILE-3147 doc: Fix typos --- src/addon/messages/pages/conversation-info/conversation-info.ts | 2 +- .../messages/pages/group-conversations/group-conversations.ts | 2 +- src/components/infinite-loading/infinite-loading.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/addon/messages/pages/conversation-info/conversation-info.ts b/src/addon/messages/pages/conversation-info/conversation-info.ts index f28253463..eb8046fc1 100644 --- a/src/addon/messages/pages/conversation-info/conversation-info.ts +++ b/src/addon/messages/pages/conversation-info/conversation-info.ts @@ -69,7 +69,7 @@ export class AddonMessagesConversationInfoPage implements OnInit { /** * Get conversation members. * - * @param [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 resolved when done. */ protected fetchMembers(loadingMore?: boolean): Promise { diff --git a/src/addon/messages/pages/group-conversations/group-conversations.ts b/src/addon/messages/pages/group-conversations/group-conversations.ts index de862bc39..e35485724 100644 --- a/src/addon/messages/pages/group-conversations/group-conversations.ts +++ b/src/addon/messages/pages/group-conversations/group-conversations.ts @@ -345,7 +345,7 @@ export class AddonMessagesGroupConversationsPage implements OnInit, OnDestroy { * Fetch data for a certain option. * * @param option The option to fetch data for. - * @param [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. * @param getCounts Whether to get counts data. * @return Promise resolved when done. */ diff --git a/src/components/infinite-loading/infinite-loading.ts b/src/components/infinite-loading/infinite-loading.ts index 5c5a3ff18..5d19ac215 100644 --- a/src/components/infinite-loading/infinite-loading.ts +++ b/src/components/infinite-loading/infinite-loading.ts @@ -48,7 +48,7 @@ export class CoreInfiniteLoadingComponent implements OnChanges { /** * Detect changes on input properties. * - * @param } changes Changes. + * @param changes Changes. */ ngOnChanges(changes: {[name: string]: SimpleChange}): void { if (changes.enabled && this.enabled && this.position == 'bottom') {