mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-70081 airnotifier: Add missing device type in token registration
This commit is contained in:
parent
99680d1be4
commit
4bc5333b05
@ -92,7 +92,7 @@ class message_airnotifier_manager {
|
||||
array('userdeviceid' => $device->id))) {
|
||||
|
||||
// We have to create the device token in airnotifier.
|
||||
if (! $this->create_token($device->pushid)) {
|
||||
if (! $this->create_token($device->pushid, $device->platform)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -149,9 +149,10 @@ class message_airnotifier_manager {
|
||||
/**
|
||||
* Create a device token in the Airnotifier instance
|
||||
* @param string $token The token to be created
|
||||
* @param string $deviceplatform The device platform (Android, iOS, iOS-fcm, etc...)
|
||||
* @return bool True if all was right
|
||||
*/
|
||||
private function create_token($token) {
|
||||
private function create_token($token, $deviceplatform = '') {
|
||||
global $CFG;
|
||||
|
||||
if (!$this->is_system_configured()) {
|
||||
@ -165,7 +166,10 @@ class message_airnotifier_manager {
|
||||
'X-AN-APP-KEY: ' . $CFG->airnotifieraccesskey);
|
||||
$curl = new curl;
|
||||
$curl->setHeader($header);
|
||||
$params = array();
|
||||
$params = [];
|
||||
if (!empty($deviceplatform)) {
|
||||
$params["device"] = $deviceplatform;
|
||||
}
|
||||
$resp = $curl->post($serverurl, $params);
|
||||
|
||||
if ($token = json_decode($resp, true)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user