Skip to content

Commit

Permalink
Merge branch 'main' into pluginupgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
kabalin authored Jul 12, 2024
2 parents cebcb2d + 562f79d commit cb093e4
Show file tree
Hide file tree
Showing 15 changed files with 251 additions and 63 deletions.
8 changes: 4 additions & 4 deletions data/libraries.json
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@
"copyrightHolders": [],
"location": "lib/laravel/serializable-closure",
"name": "Serializable Closure",
"version": "1.3.2",
"version": "1.3.3",
"license": "MIT",
"repository": "https://github.com/laravel/serializable-closure",
"customised": false
Expand Down Expand Up @@ -984,7 +984,7 @@
"location": "lib/psr/http-client",
"name": "http-client",
"description": "Provides an abstraction that describe the components of a HTTP Client.",
"version": "1.0.0",
"version": "1.0.3",
"license": "MIT",
"repository": "https://github.com/php-fig/http-client",
"customised": false
Expand All @@ -1004,7 +1004,7 @@
"location": "lib/psr/http-message",
"name": "http-message",
"description": "Provide a set of common interfaces for HTTP messages as described in RFC 7230 and RFC 7231",
"version": "1.0.1",
"version": "2.0.0",
"license": "MIT",
"repository": "https://github.com/php-fig/http-message",
"customised": false
Expand Down Expand Up @@ -1068,7 +1068,7 @@
"location": "lib/symfony/deprecation-contracts",
"name": "Symfony Deprecation contracts",
"description": "A generic function and convention to trigger deprecation notices",
"version": "3.1.1",
"version": "3.5.0",
"license": "MIT",
"repository": "https://github.com/symfony/deprecation-contracts",
"customised": false
Expand Down
1 change: 1 addition & 0 deletions data/main/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"privacy": "privacy",
"question": "question",
"rating": "rating",
"report": "report",
"reportbuilder": "reportbuilder",
"repository": "repository",
"rss": "rss",
Expand Down
14 changes: 7 additions & 7 deletions data/migratedPages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,11 @@ Course_formats:
- filePath: "/docs/apis/plugintypes/format/index.md"
slug: "/docs/apis/plugintypes/format"
Creating_mobile_course_formats:
- filePath: "/general/app/development/plugins-development-guide/examples/create-course-formats.md"
slug: "/general/app/development/plugins-development-guide/examples/create-course-formats"
- filePath: "/general/app/development/plugins-development-guide/examples/course-formats.md"
slug: "/general/app/development/plugins-development-guide/examples/course-formats"
Creating_mobile_question_types:
- filePath: "/general/app/development/plugins-development-guide/examples/question-types.md"
slug: "/general/app/development/plugins-development-guide/examples/question-types"
Credits:
- filePath: "/general/community/credits/index.md"
slug: "/general/community/credits"
Expand Down Expand Up @@ -1402,17 +1405,14 @@ Moodle_App_Release_Notes:
- filePath: "/general/app_releases.md"
slug: "/general/app_releases"
Moodle_App_Release_Process:
- filePath: "/general/app/development/release-process.md"
slug: "/general/app/development/release-process"
- filePath: "/general/development/process-moodleapp/release.md"
slug: "/general/development/process-moodleapp/release"
Moodle_App_Remote_Themes:
- filePath: "/general/app/customisation/remote-themes.md"
slug: "/general/app/customisation/remote-themes"
Moodle_App_Remote_Themes_Upgrade_Guide:
- filePath: "/general/app/upgrading/remote-themes-upgrade-guide.md"
slug: "/general/app/upgrading/remote-themes-upgrade-guide"
Moodle_App_Scripts:_gulp_push:
- filePath: "/general/app/development/scripts/gulp-push.md"
slug: "/general/app/development/scripts/gulp-push"
Moodle_Development_kit:
- filePath: "/general/development/tools/mdk.md"
slug: "/general/development/tools/mdk"
Expand Down
2 changes: 2 additions & 0 deletions data/moodle-contributors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ Hernández
Herrmann
Heywood
Hien
Hieu
Hilton
Hippisley
Hiroto
Expand Down Expand Up @@ -903,6 +904,7 @@ Rasmussen
Rawson
Raymond
Recio
Reichert
Reischmann
Renaat
Renaud
Expand Down
124 changes: 124 additions & 0 deletions docs/apis/subsystems/sms/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
---
title: SMS API
---

<Since version="4.5" issueNumber="MDL-79808" />

The SMS API lets you send SMS messages using configured gateways, fetch messages that were previously sent, and check on their status.

## Sending an SMS

Messages can be sent using the `send()` method of the SMS Manager class, which should be fetched using Dependency Injection, for example:

```php title="Sending a message"
$message = \core\di::get(\core_sms\manager::class)
->send(
recipientnumber: '+61987654321',
content: 'This is the content of the message',
component: 'mod_example',
messagetype: 'demonstrationmessage',
recipientuserid: $user->id,
issensitive: false,
async: false,
);
```

:::info Message lengths

A single SMS sent by the API may consist of up to 480 UTF-8 characters. It is up to the message _gateway_ plugin to determine how this message is sent to the recipient.

Any message longer than the maximum length will be immediately rejected.

:::

### Sending messages containing sensitive information

When sending a message containing something like a 2FA login token, you should make use of the `issensitive` flag.

Passing this flag prevents the SMS subsystem from storing the content of the message in the message log.

The `send()` method return an instance of `\core_sms\message` which can be used to check on the message status.

## Fetching messages

Every sent message is stored in the database for subsequent reporting, and to check statuses.

Messages can be fetched from the database by calling the `\core_sms\manager::get_message()` and `\core_sms\manager::get_messages()` methods and supplying a filter.

```php title="Fetching messages"
$message = \core\di::get(\core_sms\manager::class)
->get_message(['id' => $id]);

$messages = \core\di::get(\core_sms\manager::class)
->get_messages(['recipientuserid' => $userid]);
```

:::note Sensitive content

If the message was sent with the `issensitive` flag the message body will not be stored.

:::

## Checking the status of a message

Once a message is sent, a status is recorded against it. This can be used to determine whether the message was sent successfully.

:::info

The level of status information available will depend on individual message gateways and recipient regions. In some regions delivery status may be available, but not in others.

:::

Message status can be checked using the `\core_sms\message::$status` property.

Statuses are represented by a PHP Enum object with each status having a translatable description, and methods to determine whether the message was sent, is failed, or still in-progress.

```php title="Checking the status of a message"
$message = \core\di::get(\core_sms\manager::class)
->get_message(['id' => $id]);

// Check if the message is failed.
$message->is_failed();

// Check if the message is still in transit.
$message->is_in_progress();

// Check if the message is sent.
$message->is_sent();

// Get the description of the state.
$message->description();
```

```mermaid
graph TD
classDef failed fill:#f00,color:white,font-weight:bold,stroke:yellow
classDef inprogress fill:orange
classDef success fill:green,color:white,font-weight:bold
unknown["UNKNOWN"]
MOS["MESSAGE_OVER_SIZE"]:::failed
GNA["GATEWAY_NOT_AVAILABLE"]:::failed
GQ["GATEWAY_QUEUED"]:::inprogress
GS["GATEWAY_SENT"]:::success
GF["GATEWAY_FAILED"]:::failed
GR["GATEWAY_REJECTED"]:::failed
MLC{Message length check}
GWSEL{Gateway selection}
direction TB
start[/Start/] --> |Initial state| unknown
unknown --> |Initial message checks| MLC
MLC --> |Message over length| MOS
MLC --> |Message within limits| GWSEL
GWSEL --> |No gateway available to send this message| GNA
GWSEL --> |Message passed to Gateway| Gateway
subgraph Gateway
GQ --> |The gateway rejected the message| GR
GQ --> |Sent to recipient by Gateway| GS
GQ --> |Gateway failed to send the message| GF
end
```
24 changes: 24 additions & 0 deletions docs/devupdate.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,26 @@ tags:

This page highlights the important changes that are coming in Moodle 4.5 for developers.

## Badges

### Deprecated `badges/newbadge.php`

The `badges/newbadge.php` and `badges/edit.php` pages have been combined to make things easier to maintain since both were pretty similar (`newbadge.php` for creating badges and `edit.php` for editing them).

As a result, `badges/newbadge.php` is now deprecated and will be removed in Moodle 6.0. Please update your code to use badges/edit.php instead.

:::info

Visiting

https://yourmoodlesite/badges/newbadge.php?id=x

will now automatically redirect to

https://yourmoodlesite/badges/edit.php?courseid=x&mode=new

:::

## Core changes

### Autoloader
Expand All @@ -27,6 +47,10 @@ Please note that the same limitations regarding access to the Database, Session,

:::

### SMS API

A new SMS API was introduced. See the [SMS API documentation](./apis/subsystems/sms/index.md) for more information.

## Course

### Reset course page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,30 @@ class mobile {
```html handlebars title="templates/mobile_course.mustache"
{{=<% %>=}}
<core-dynamic-component [component]="coreCourseFormatComponent.allSectionsComponent" [data]="data" class="format-myformat">
<ng-container *ngFor="let section of sections">
@for (section of sections; track section.id) {
<ion-item-divider>
<ion-label>
<core-format-text [text]="section.name" contextLevel="course" [contextInstanceId]="course.id">
</core-format-text>
</ion-label>
</ion-item-divider>

<ion-item *ngIf="section.summary">
<ion-label>
<core-format-text [text]="section.summary" contextLevel="course" [contextInstanceId]="course.id">
</core-format-text>
</ion-label>
</ion-item>
@if (section.summary) {
<ion-item>
<ion-label>
<core-format-text [text]="section.summary" contextLevel="course" [contextInstanceId]="course.id">
</core-format-text>
</ion-label>
</ion-item>
}

<ng-container *ngFor="let module of section.modules">
<ng-container *ngIf="module.visibleoncoursepage !== 0">
@for (module of section.modules; track module.id) {
@if (module.visibleoncoursepage !== 0) {
<core-course-module [module]="module" [section]="section" (completionChanged)="onCompletionChange()">
</core-course-module>
</ng-container>
</ng-container>
</ng-container>
}
}
}
</core-dynamic-component>
```

Expand Down Expand Up @@ -116,11 +118,11 @@ class mobile {
Then filter the list of sections in your template:

```html
<ng-container *ngFor="let section of sections">
<ng-container *ngIf="section.id in CONTENT_OTHERDATA.displaysections">
@for (section of sections; track $index) {
@if (section.id in CONTENT_OTHERDATA.displaysections) {
<!-- code to display the section goes here -->
</ng-container>
</ng-container>
}
}
```

## Using JavaScript
Expand Down
6 changes: 4 additions & 2 deletions general/app/development/testing/unit-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Most services will be instantiated properly without mocks, but sometimes you may
## Testing components
Angular components have a strong graphical part, but that doesn't mean that you can't test their logic and markup rendering using unit tests with Jest. You can follow [Angular's best practices for testing components](https://angular.io/guide/testing-components-scenarios), and we also provide a couple of helpers that make things easier.
Angular components have a strong graphical part, but that doesn't mean that you can't test their logic and markup rendering using unit tests with Jest. You can follow [Angular's best practices for testing components](https://angular.dev/guide/testing/components-scenarios), and we also provide a couple of helpers that make things easier.
Let's say you want to test the following component that render a list of user names:
Expand All @@ -138,7 +138,9 @@ Let's say you want to test the following component that render a list of user na
template: `
<h1>Users List</h1>
<ul>
<li *ngFor="let user of users">{{ user }}</li>
@for (user of users; track $index) {
<li>{{ user }}</li>
}
</ul>
`,
})
Expand Down
1 change: 1 addition & 0 deletions general/app_releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ tags:

| **Version name** | **Date** |
|---|---|
| [Moodle App 4.4.1](./app_releases/v4/v4.4.1) | 9 July 2024 |
| [Moodle App 4.4.0](./app_releases/v4/v4.4.0) | 28 June 2024 |
| [Moodle App 4.3.0](./app_releases/v4/v4.3.0) | 10 November 2023 |
| [Moodle App 4.2.0](./app_releases/v4/v4.2.0) | 9 June 2023 |
Expand Down
2 changes: 1 addition & 1 deletion general/app_releases/v4/v4.4.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Release date: 28 June 2024
### Task

- [MOBILE-3947](https://tracker.moodle.org/browse/MOBILE-3947) - Upgrade to Ionic 7 and to Angular 17
- [MOBILE-4357](https://tracker.moodle.org/browse/MOBILE-4357) - Upgrade Cordova and Android SDK to 34, cordova-android to 12 and cordova-ios to 7
- [MOBILE-4357](https://tracker.moodle.org/browse/MOBILE-4357) - Upgrade Cordova, cordova-android to 12 and cordova-ios to 7
- [MOBILE-4449](https://tracker.moodle.org/browse/MOBILE-4449) - Use Android photo picker to avoid using READ_MEDIA_IMAGES and READ_MEDIA_VIDEO
- [MOBILE-4465](https://tracker.moodle.org/browse/MOBILE-4465) - Remove deprecated 4.0 code
- [MOBILE-4492](https://tracker.moodle.org/browse/MOBILE-4492) - Upgrade cordova-plugin-file to 8.0.1, cordova-plugin-media-capture and use cordova-plugin-camera
Expand Down
26 changes: 26 additions & 0 deletions general/app_releases/v4/v4.4.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: Moodle App 4.4.1 release notes
sidebar_label: Moodle App 4.4.1
tags:
- Moodle App
- Release notes
---

Release date: 9 July 2024

## New features and improvements

- Android target SDK updated to 34
- Fix bug when playing embedded videos
- Fix bug in certain courses using single activity formats

## Complete list of issues

### Task

- [MOBILE-4621](https://tracker.moodle.org/browse/MOBILE-4621) - Update Android targetSdk to 34

### Bug

- [MOBILE-4620](https://tracker.moodle.org/browse/MOBILE-4620) - Some courses using single activity format do not work anymore in the app
- [MOBILE-4624](https://tracker.moodle.org/browse/MOBILE-4624) - Iframes with inline styles aren't displayed in the app after 4.4 upgrade
Loading

0 comments on commit cb093e4

Please sign in to comment.