diff --git a/.vscode/moodle.code-snippets b/.vscode/moodle.code-snippets index 9429495bb45..d68e02b608f 100644 --- a/.vscode/moodle.code-snippets +++ b/.vscode/moodle.code-snippets @@ -110,4 +110,13 @@ ], "description": "[Moodle] Create a Pure Singleton" }, + "Innherit doc": { + "prefix": "inheritdoc", + "body": [ + "/**", + " * @inheritdoc", + " */" + ], + "description": "Add @inheritdoc documentation block" + } } diff --git a/angular.json b/angular.json index ec4ff0695c5..bdbf83a9533 100644 --- a/angular.json +++ b/angular.json @@ -156,6 +156,7 @@ } }, "cli": { + "analytics": false, "defaultCollection": "@ionic/angular-toolkit" }, "schematics": { diff --git a/config.xml b/config.xml index b85d51b42d6..796a5978ac8 100644 --- a/config.xml +++ b/config.xml @@ -18,6 +18,7 @@ + diff --git a/package.json b/package.json index c36d6ce0b41..97997b5e189 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "ionic:serve:before": "gulp", "ionic:serve": "cross-env-shell ./scripts/serve.sh", "ionic:build:before": "gulp", - "postinstall": "patch-package", + "postinstall": "patch-package && cd cordova-plugin-moodleapp && npm install", "lang:update-langpacks": "./scripts/update_langpacks.sh", "lang:detect-langpacks": "./scripts/update_langpacks.sh detect", "lang:create-langindex": "./scripts/create_langindex.sh" diff --git a/scripts/cordova-hooks/before_plugin_add.sh b/scripts/cordova-hooks/before_plugin_add.sh new file mode 100755 index 00000000000..3139de83d86 --- /dev/null +++ b/scripts/cordova-hooks/before_plugin_add.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +if [[ $CORDOVA_PLUGINS == *cordova-plugin-moodleapp* ]]; then + echo "Building cordova-plugin-moodleapp" + + cd cordova-plugin-moodleapp + npm run prod +fi diff --git a/scripts/update_lang_functions.sh b/scripts/update_lang_functions.sh index f54107c14c8..5ae2e83ab67 100755 --- a/scripts/update_lang_functions.sh +++ b/scripts/update_lang_functions.sh @@ -22,7 +22,7 @@ function copy_lang { lang=$1 index_keys=$(jq -r 'to_entries[] | "\"\(.key)\","' langindex.json) - index_keys=$(echo "$index_keys" | sed 's/,*$//') + index_keys=${index_keys:0:-1} hyphenlang=${lang/_/-} langfilepath=$LANG_PATH/$hyphenlang.json diff --git a/src/addons/mod/quiz/services/handlers/prefetch.ts b/src/addons/mod/quiz/services/handlers/prefetch.ts index 52b48195ddc..1849d3b09bb 100644 --- a/src/addons/mod/quiz/services/handlers/prefetch.ts +++ b/src/addons/mod/quiz/services/handlers/prefetch.ts @@ -447,7 +447,7 @@ export class AddonModQuizPrefetchHandlerService extends CoreCourseActivityPrefet if (attempt.state == AddonModQuizProvider.ATTEMPT_IN_PROGRESS) { // Get data for each page. promises = promises.concat(pages.map(async (page) => { - if (isSequential && attempt.currentpage && page < attempt.currentpage) { + if (isSequential && typeof attempt.currentpage === 'number' && page < attempt.currentpage) { // Sequential quiz, cannot get pages before the current one. return; } diff --git a/src/core/classes/errors/errors.ts b/src/core/classes/errors/errors.ts index 3c4f6877ab4..776faf713de 100644 --- a/src/core/classes/errors/errors.ts +++ b/src/core/classes/errors/errors.ts @@ -24,7 +24,7 @@ import { CoreCaptureError } from './captureerror'; import { CoreNetworkError } from './network-error'; import { CoreSiteError } from './siteerror'; import { CoreLoginError } from './loginerror'; -import { CoreErrorWithOptions } from './errorwithtitle'; +import { CoreErrorWithOptions } from './errorwithoptions'; import { CoreHttpError } from './httperror'; export const CORE_ERRORS_CLASSES: Type[] = [ diff --git a/src/core/classes/errors/errorwithtitle.ts b/src/core/classes/errors/errorwithoptions.ts similarity index 100% rename from src/core/classes/errors/errorwithtitle.ts rename to src/core/classes/errors/errorwithoptions.ts diff --git a/src/core/components/iframe/core-iframe.html b/src/core/components/iframe/core-iframe.html index bf492145503..51a88f9ff67 100644 --- a/src/core/components/iframe/core-iframe.html +++ b/src/core/components/iframe/core-iframe.html @@ -7,8 +7,7 @@ - - + diff --git a/src/core/features/course/pages/course-summary/course-summary.page.ts b/src/core/features/course/pages/course-summary/course-summary.page.ts index deffdadcd03..fcae410d8ef 100644 --- a/src/core/features/course/pages/course-summary/course-summary.page.ts +++ b/src/core/features/course/pages/course-summary/course-summary.page.ts @@ -144,7 +144,7 @@ export class CoreCourseSummaryPage implements OnInit, OnDestroy { // Don't allow guest access if it requires a password if not supported. this.guestAccessPasswordRequired = info.passwordrequired; - return info.status === true && (!info.passwordrequired || CoreCourses.isValidateGuestAccessPasswordAvailable()); + return info.status && (!info.passwordrequired || CoreCourses.isValidateGuestAccessPasswordAvailable()); } /** @@ -193,7 +193,7 @@ export class CoreCourseSummaryPage implements OnInit, OnDestroy { const enrolmentMethods = await CoreCourses.getCourseEnrolmentMethods(this.courseId); enrolmentMethods.forEach((method) => { - if (!method.status) { + if (!CoreUtils.isTrueOrOne(method.status)) { return; } diff --git a/src/core/features/course/services/course-helper.ts b/src/core/features/course/services/course-helper.ts index 87ab3c580cb..7c02eb06f34 100644 --- a/src/core/features/course/services/course-helper.ts +++ b/src/core/features/course/services/course-helper.ts @@ -634,8 +634,7 @@ export class CoreCourseHelperProvider { // Don't allow guest access if it requires a password and it's available. return { - guestAccess: info.status === true && - (!info.passwordrequired || CoreCourses.isValidateGuestAccessPasswordAvailable()), + guestAccess: info.status && (!info.passwordrequired || CoreCourses.isValidateGuestAccessPasswordAvailable()), passwordRequired: info.passwordrequired, }; } catch { diff --git a/src/core/features/course/tests/behat/basic_usage.feature b/src/core/features/course/tests/behat/basic_usage.feature index f6d12bcb930..a815c12af83 100755 --- a/src/core/features/course/tests/behat/basic_usage.feature +++ b/src/core/features/course/tests/behat/basic_usage.feature @@ -98,8 +98,8 @@ Feature: Test basic usage of one course in app And I should find "Test scorm name" in the app And I should find "Test workshop name" in the app - When I set "page-core-course-index .core-course-thumb" styles to "--course-color" "lightblue" - And I set "page-core-course-index .core-course-thumb" styles to "--course-color-tint" "white" + When I set "page-core-course-index .core-course-thumb" styles to "background" "lightblue" + And I set "page-core-course-index .core-course-thumb img" styles to "display" "none" Then the UI should match the snapshot When I press "Choice course 1" in the app diff --git a/src/core/features/course/tests/behat/snapshots/test-basic-usage-of-one-course-in-app-view-course-contents_46.png b/src/core/features/course/tests/behat/snapshots/test-basic-usage-of-one-course-in-app-view-course-contents_46.png index 11540a01ace..5a5952a5633 100644 Binary files a/src/core/features/course/tests/behat/snapshots/test-basic-usage-of-one-course-in-app-view-course-contents_46.png and b/src/core/features/course/tests/behat/snapshots/test-basic-usage-of-one-course-in-app-view-course-contents_46.png differ diff --git a/src/core/features/courses/services/courses.ts b/src/core/features/courses/services/courses.ts index f65faaf9623..c45c69da658 100644 --- a/src/core/features/courses/services/courses.ts +++ b/src/core/features/courses/services/courses.ts @@ -1827,7 +1827,6 @@ export type CoreCourseEnrolmentInfo = { courseid: number; // Id of course. type: string; // Type of enrolment plugin. name: string; // Name of enrolment plugin. - status: boolean | string; // Available status of enrolment plugin. True if successful, else error message or false. }; /** @@ -1835,6 +1834,7 @@ export type CoreCourseEnrolmentInfo = { */ export type CoreCourseEnrolmentMethod = CoreCourseEnrolmentInfo & { wsfunction?: string; // Webservice function to get more information. + status: string; // Status of enrolment plugin. True if successful, else error message or false. }; /** @@ -1877,6 +1877,7 @@ export type CoreCourseGetRecentCoursesOptions = CoreSitesCommonWSOptions & { */ export type CoreCourseEnrolmentGuestMethod = CoreCourseEnrolmentInfo & { passwordrequired: boolean; // Is a password required? + status: boolean; // Is the enrolment enabled? }; /** diff --git a/src/core/features/courses/services/handlers/course-link.ts b/src/core/features/courses/services/handlers/course-link.ts index 0a5af6e2aed..c1c3d8b5900 100644 --- a/src/core/features/courses/services/handlers/course-link.ts +++ b/src/core/features/courses/services/handlers/course-link.ts @@ -241,7 +241,7 @@ export class CoreCoursesCourseLinkHandlerService extends CoreContentLinksHandler let isSelfEnrolEnabled = false; let instances = 0; methods.forEach((method) => { - if (method.type == 'self' && method.status) { + if (method.type == 'self' && CoreUtils.isTrueOrOne(method.status)) { isSelfEnrolEnabled = true; instances++; } diff --git a/src/core/features/login/pages/sites/sites.ts b/src/core/features/login/pages/sites/sites.ts index 4a75649b263..3187873640b 100644 --- a/src/core/features/login/pages/sites/sites.ts +++ b/src/core/features/login/pages/sites/sites.ts @@ -47,6 +47,8 @@ export class CoreLoginSitesPage implements OnInit { async ngOnInit(): Promise { if (CoreNavigator.getRouteBooleanParam('openAddSite')) { this.add(); + + return; } this.accountsList = await CoreLoginHelper.getAccountsList(); diff --git a/src/core/services/sites.ts b/src/core/services/sites.ts index f2e7b64bc96..c0e0dd441b5 100644 --- a/src/core/services/sites.ts +++ b/src/core/services/sites.ts @@ -51,7 +51,7 @@ import { CoreRedirectPayload } from './navigator'; import { CoreSitesFactory } from './sites-factory'; import { CoreText } from '@singletons/text'; import { CoreLoginHelper } from '@features/login/services/login-helper'; -import { CoreErrorWithOptions } from '@classes/errors/errorwithtitle'; +import { CoreErrorWithOptions } from '@classes/errors/errorwithoptions'; import { CoreAjaxError } from '@classes/errors/ajaxerror'; import { CoreAjaxWSError } from '@classes/errors/ajaxwserror'; import { CoreSitePlugins } from '@features/siteplugins/services/siteplugins'; diff --git a/src/core/services/utils/utils.ts b/src/core/services/utils/utils.ts index 35ae3d50373..4c10f5c40a0 100644 --- a/src/core/services/utils/utils.ts +++ b/src/core/services/utils/utils.ts @@ -35,7 +35,7 @@ import { CoreWindow } from '@singletons/window'; import { CoreColors } from '@singletons/colors'; import { CorePromisedValue } from '@classes/promised-value'; import { CorePlatform } from '@services/platform'; -import { CoreErrorWithOptions } from '@classes/errors/errorwithtitle'; +import { CoreErrorWithOptions } from '@classes/errors/errorwithoptions'; import { CoreFilepool } from '@services/filepool'; import { CoreSites } from '@services/sites'; import { CoreCancellablePromise } from '@classes/cancellable-promise';