Skip to content

Commit 6e409e2

Browse files
authored
Merge branch 'main' into patch-1
2 parents e862674 + df90e1b commit 6e409e2

File tree

29 files changed

+502
-99
lines changed

29 files changed

+502
-99
lines changed

data/migratedPages.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ Debugging_network_requests_in_the_Moodle_App:
173173
- filePath: "/general/app/development/network-debug.md"
174174
slug: "/general/app/development/network-debug"
175175
Deprecation:
176-
- filePath: "/general/development/policies/deprecation.md"
176+
- filePath: "/general/development/policies/deprecation/index.md"
177177
slug: "/general/development/policies/deprecation"
178178
Designing_usable_forms:
179179
- filePath: "/general/development/policies/designing-usable-forms.md"
@@ -1291,8 +1291,8 @@ Moodle_App_4.0.1_release_notes:
12911291
- filePath: "/general/app_releases/v4/v4.0.1.md"
12921292
slug: "/general/app_releases/v4/v4.0.1"
12931293
Moodle_App_Accessibility:
1294-
- filePath: "/general/app/accessibility.md"
1295-
slug: "/general/app/accessibility"
1294+
- filePath: "/general/app/development/accessibility.md"
1295+
slug: "/general/app/development/accessibility"
12961296
Moodle_App_Coding_Style:
12971297
- filePath: "/general/development/policies/codingstyle-moodleapp.md"
12981298
slug: "/general/development/policies/codingstyle-moodleapp"

data/moodle-contributors.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ Baxter
115115
Bayler
116116
Beedell
117117
Belgium
118+
Bellen
118119
Bence
119120
Benjamin
120121
Bennett
@@ -168,6 +169,7 @@ Cameron
168169
Campbell
169170
Candilio
170171
Carlos
172+
Carrera
171173
Carrick
172174
Carrier
173175
Carrillo
@@ -971,6 +973,7 @@ Shamiso.Jaravaza
971973
Shane
972974
Sharp
973975
Shashikant
976+
Shehata
974977
Sheremeta
975978
Shintaro
976979
Shwab
@@ -1381,6 +1384,7 @@ papillon326
13811384
papita
13821385
patrickslee
13831386
pau.ferrer-ocana
1387+
pedrojordao
13841388
petcheverry
13851389
peterbulmer
13861390
phoenixfr

data/versions.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,6 @@
510510
},
511511
{
512512
"name": "3.9.24",
513-
"releaseNoteUrl": false,
514513
"releaseDate": "9 October 2023",
515514
"version": 2020061524
516515
}

general/app/development/development-guide.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ The `core.module.ts` file defines a module that imports all the core providers a
105105

106106
The `shared.module.ts` file defines a [Shared Module](https://angular.io/guide/module-types#shared-ngmodules) that exposes core declarables (components, directives and pipes). When other modules use any of these, it's preferable to import this module instead of individual declarable modules separately.
107107

108-
There is also a `constants.ts` file with global read-only values.
108+
There is also a `constants.ts` file which should follow the conventions for [constants files](#constants-files).
109109

110110
#### core/initializers/
111111

@@ -196,6 +196,7 @@ In addition to these files, feature folders may contain the following:
196196
- `components/` — Same as [core/components/](#corecomponents) (with the *core-{feature-name}-* namespace).
197197
- `directives/` and `pipes/` — Same as [core/directives/ and core/pipes/](#coredirectives-and-corepipes).
198198
- `lang.json` — See [Language files](#language-files).
199+
- `constants.ts` — See [Constants files](#constants-files).
199200
- `services/` — Same as [core/services/](#coreservices).
200201
- `pages/` — Page folders have the same structure as [core/components/](#corecomponents), but in addition they can declare modules if a page component is to be used in more than one module. Also, page components will declare their selectors starting with `page-`.
201202

@@ -253,12 +254,20 @@ If a folder contains more than one type of TypeScript file, the type of file sho
253254

254255
### Language files
255256

256-
All feature and addon folders can contain a lang.json file, as well as the `core/` folder. The JSON file contains all translatable string keys with the current english text. During compilation, those files will be merged into one single file on `assets/lang/en.json` that will contain the cooked string keys (every key of those files will be prepended with the module prefix).
257+
All feature and addon folders can contain a `lang.json` file, as well as the `core/` folder. The JSON file contains all translatable string keys with the current english text. During compilation, those files will be merged into one single file on `assets/lang/en.json` that will contain the cooked string keys (every key of those files will be prepended with the module prefix).
257258

258259
An automatic process will create the rest of the language files on the `assets/lang/` folder based on the Moodle translation platform: [AMOS](https://lang.moodle.org/).
259260

260261
In order to match existing Moodle language strings with the app strings the app contains a file on the scripts folder called `langindex.json`. This file contains an indexed array with the cooked string keys of the app, the value of every item is the module (file name) where to find the string in AMOS. If the value contains a slash '/' the text before the slash will correspond to the module (file name) and the text after will correspond to the string key on that file. If it does not contain a slash, the string key will be the last part of the cooked string key (splitting using dots .).
261262

263+
### Constants files
264+
265+
All exported constants should be declared within a `constants.ts` file. The term "constant" in TypeScript can be somewhat misleading, given that it is often used with the `const` keyword. What we mean with "constants" is simple read-only values. Most of the time, these will be primitive values (string, number, boolean, etc.) or simple objects.
266+
267+
This may seem cumbersome at first, but it's very important in order to optimize [Code Splitting](https://webpack.js.org/guides/code-splitting/). Which can seriously impact performance. Given the size of the codebase, including a file in a bundle that doesn't need it can result in a cascade effect that bloats chunk sizes significantly. And constants are usually used outside of a module (for example, using route segments or unique identifiers).
268+
269+
Additionally, because it's very likely that the content of these files ends up in the initial bundle of the application, they should seldom import anything (possibly with the exception of other constants).
270+
262271
### Test files
263272

264273
Tests are found anywhere inside the `src/` folder, and they will be run as long as they end with *.test.ts*. As a general rule, they are placed in a folder next to the module responsible for the code being tested. And they mirror the folder structure.

general/app/development/link-handling/app-links.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ tags:
1010

1111
When a user presses a link in the Moodle app, the behaviour changes depending on whether the URL is supported by the app or not:
1212

13-
- If the URL belongs to the same site and it's supported by the app, then the app will try to open the corresponding page inside the app. For example if the user presses a link to an assignment, then the assignment will be opened inside the app if possible.
14-
- If it's a URL pointing to an external site or it's a URL not supported by the app then it will be opened in a browser. For example admin settings aren't supported by the app, so clicking a link to an admin settings page will open the page in browser.
13+
- If the URL belongs to the same site and it's supported by the app, then the app will try to open the corresponding page. For example if the user presses a link to an assignment, then the assignment will be opened inside the app rather than opening a browser.
14+
- If it's a URL pointing to an external site or it's a URL not supported by the app, then it will be opened in an external browser. This can also be configured to [open in an embedded browser](#opening-links-in-an-embedded-browser). For example admin settings aren't supported by the app, so clicking a link to an admin settings page will open the page in an external browser.
15+
- If it's a URL pointing to a local file it will be opened with an external app in Android, and an embedded viewer in iOS. For example opening a PDF within a SCORM package would open a PDF reader in Android or and embedded PDF viewer in iOS.
16+
- If the link is inside an iframe (and is not pointing to a local file), it will be opened within the same iframe. This behaviour can be changed by setting the link's `target` attribute to anything other than `_self`, in which case the URL will be opened in an external browser. For example, clicking a link with a `target="_blank"` attribute would open the URL in an external browser.
1517

1618
## Extending the list of supported URLs
1719

general/app/development/plugins-development-guide/index.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,17 @@ In the previous section, we learned about some of the existing options for handl
597597
- Any other value — Your block will immediately call the method specified in `mobile.php` and it will use the template to render the block.
598598
- `fallback` (optional) — This option allows you to specify a block to use in the app instead of your block. For example, you can make the app display the "My overview" block instead of your block in the app by setting `'fallback' => 'myoverview'`. The fallback will only be used if you don't specify a `method` and the `type` is different to `'title'` or `'prerendered'`. Supported from the 3.9.0 version of the app.
599599

600+
### Options only for CoreEnrolDelegate
601+
602+
- `enrolmentAction` (optional): The type of action done by the enrolment plugin. Defaults to 'browser'. Possible values:
603+
- `browser` — When the user clicks to enrol, open a browser to perform the enrol in the browser. It doesn't require any JavaScript to work in the app.
604+
- `self` — The user can self enrol in the app. Requires implementing the 'enrol' function in your JavaScript code. Also, your PHP class extending `enrol_plugin` should return some data instead of null in the `get_enrol_info` function, otherwise it won't work in the app.
605+
- `guest` — Allows the user to enter the course as guest in the app. Requires implementing the 'canAccess' and 'validateAccess' functions in your JavaScript code. Also, your PHP class extending `enrol_plugin` should return some data instead of null in the `get_enrol_info` function, otherwise it won't work in the app.
606+
- `infoIcons` (optional) — Icons related to the enrolment to display next to the course. If the icons need to be calculated dynamically based on the course you need to implement the function 'getInfoIcons' in your JavaScript code. Properties for each icon:
607+
- `icon` (required) — The icon name. E.g. 'fas-credit-card'.
608+
- `label` (required) — The label of the icon (for accessibility).
609+
- `className` (optional) — A CSS class to add to the icon element.
610+
600611
## Delegates
601612

602613
Delegates can be classified by type of plugin. For more info about type of plugins, please see the [Types of plugins](#types-of-plugins) section.
@@ -678,6 +689,7 @@ These delegates require JavaScript to be supported. See [Initialisation](#initia
678689
- `CoreFileUploaderDelegate`
679690
- `CorePluginFileDelegate`
680691
- `CoreFilterDelegate`
692+
- `CoreEnrolDelegate` (added in 4.3 version of the app)
681693

682694
## Available components and directives
683695

@@ -1631,6 +1643,59 @@ class AddonSingleActivityFormatHandler {
16311643
this.CoreCourseFormatDelegate.registerHandler(new AddonSingleActivityFormatHandler());
16321644
```
16331645

1646+
##### Self enrol plugin
1647+
1648+
The `CoreEnrolDelegate` handler allows you to support enrolment plugins in the app. This example will show how to support a self enrol plugin, you can find an example of each type of plugin in the issue [MOBILE-4323](https://tracker.moodle.org/browse/MOBILE-4323).
1649+
1650+
Here's an example on how to create a prefetch handler using the JS returned by the main method:
1651+
1652+
```javascript
1653+
const getEnrolmentInfo = (id) => {
1654+
// Get enrolment info for the enrol instance.
1655+
// Used internally, you can use any name, parameters and return data in here.
1656+
};
1657+
1658+
const selfEnrol = (method, info) => {
1659+
// Self enrol the user in the course.
1660+
// Used internally, you can use any name, parameters and return data in here.
1661+
};
1662+
1663+
var result = {
1664+
getInfoIcons: (courseId) => {
1665+
return this.CoreEnrolService.getSupportedCourseEnrolmentMethods(courseId, 'selftest').then(enrolments => {
1666+
if (!enrolments.length) {
1667+
return [];
1668+
}
1669+
1670+
// Since this code is for testing purposes just use the first one.
1671+
return getEnrolmentInfo(enrolments[0].id).then(info => {
1672+
if (!info.enrolpassword) {
1673+
return [{
1674+
label: 'plugin.enrol_selftest.pluginname',
1675+
icon: 'fas-right-to-bracket',
1676+
}];
1677+
} else {
1678+
return [{
1679+
label: 'plugin.enrol_selftest.pluginname',
1680+
icon: 'fas-key',
1681+
}];
1682+
}
1683+
});
1684+
});
1685+
},
1686+
enrol: (method) => {
1687+
return getEnrolmentInfo(method.id).then(info => {
1688+
return selfEnrol(method, info);
1689+
});
1690+
},
1691+
invalidate: (method) => {
1692+
// Invalidate WS data.
1693+
},
1694+
};
1695+
1696+
result;
1697+
```
1698+
16341699
### Using the JavaScript API
16351700

16361701
The JavaScript API is only supported by the delegates specified in the [Templates downloaded on login and rendered using JS data](#templates-downloaded-on-login-and-rendered-using-js-data) section. This API allows you to override any of the functions of the default handler.

general/app/development/setup/troubleshooting.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ To get more debug output from npm commands, see [the available configuration fla
3535

3636
## I can't change the language
3737

38-
If you're getting a network error for a url like `http://localhost:8100/assets/lang/es.json`, this probably means that you haven't installed the language packs.
39-
40-
Currently, you can install them in your machine running the `scripts/update_lang.sh` script, but it may not work in your system if you don't have php installed. For future improvements, you can subscribe to [MOBILE-3864](https://tracker.moodle.org/browse/MOBILE-3864).
38+
If you're getting a network error for a url like `http://localhost:8100/assets/lang/es.json`, this probably means that you haven't installed the language packs. You can install them with `npm run lang:update-langpacks`.
4139

4240
## Error: `libsass` bindings not found. Try reinstalling node-sass?
4341

general/app/development/testing/acceptance-testing.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,15 @@ Behat tests can relate to particular versions of the mobile app. For these situa
286286

287287
You can use two-digit or three-digit version numbers. For example, you could use `@app_from4.0` or `@app_upto3.9.5`.
288288

289-
After changing the app version used for testing, make sure you re-run Behat init. It is the initialisation process that stores which version of the app you're using.
289+
Keep in mind that these tags will only take effect after using the `I enter the app` step, so it won't be effective for skipping steps in your Background blocks. If you need to skip these as well, you can do it using the following step:
290+
291+
```gherkin
292+
Background:
293+
Given the Moodle site is compatible with this feature
294+
And the following "courses" exist:
295+
```
296+
297+
Also, after changing the app version used for testing, make sure you re-run Behat init. It is the initialisation process that stores which version of the app you're using.
290298

291299
### Testing against multiple app versions
292300

general/app/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ When the application connects with a site, it will fetch information about which
6565

6666
## Platform Support
6767

68-
The Moodle App only works with Moodle sites running version 3.1 or newer.
68+
The Moodle App only works with Moodle sites running version 3.5 or newer.
6969

7070
The minimum platforms supported by the application are Android 5.1 (with Webview 61 or higher) and iOS 11.
7171

0 commit comments

Comments
 (0)