From e968e988e83a43ba7cdd5a65bac75900e2bede59 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 13 Sep 2022 14:10:57 +0200 Subject: [PATCH] MOBILE-4123 cordova: Update push plugin to 4.0.0-moodle.2 --- package-lock.json | 39 ++++++++++++++----- package.json | 2 +- .../services/pushnotifications.ts | 7 +++- 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index f6e4a5dcd..02d9f2080 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5298,9 +5298,9 @@ "integrity": "sha512-QD5S6bsm6awJrNMb8YN/vkYghKAMfZMHccdimx6s1i5S9fgZUSf7L477NJqjFu62imVZYJIJuavBbw5fR/562w==" }, "@moodlehq/phonegap-plugin-push": { - "version": "4.0.0-moodle.1", - "resolved": "https://registry.npmjs.org/@moodlehq/phonegap-plugin-push/-/phonegap-plugin-push-4.0.0-moodle.1.tgz", - "integrity": "sha512-gSP7qjeOGnwuzXqrxgT7fJS4udSYFYm56GHRGKvYM0A3V73D6VCcDokDniixBdz2w12c/K0MyiBZdjgbVmHtOw==" + "version": "4.0.0-moodle.2", + "resolved": "https://registry.npmjs.org/@moodlehq/phonegap-plugin-push/-/phonegap-plugin-push-4.0.0-moodle.2.tgz", + "integrity": "sha512-kxHnpCzM7VMw5XUrLeZX03bLkQzA3j//+4nq7MiZbLoliPsQRAxGqyZ9HmbLcPsvlt1h7NM1eSVG52qZ7D3PlQ==" }, "@mrmlnc/readdir-enhanced": { "version": "2.2.1", @@ -11355,8 +11355,7 @@ "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "base": { "version": "0.11.2", @@ -11677,7 +11676,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -13341,8 +13339,7 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, "concat-stream": { "version": "1.6.2", @@ -18286,8 +18283,19 @@ "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", + "minimatch": "^3.0.4", "once": "^1.3.0", "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + } } }, "glob-base": { @@ -19921,7 +19929,20 @@ "ignore-walk": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", - "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==" + "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", + "requires": { + "minimatch": "^3.0.4" + }, + "dependencies": { + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + } + } }, "image-size": { "version": "0.5.5", diff --git a/package.json b/package.json index be156b756..19b9c149b 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "@moodlehq/cordova-plugin-local-notification": "0.9.0-moodle.4", "@moodlehq/cordova-plugin-qrscanner": "3.0.1-moodle.4", "@moodlehq/cordova-plugin-zip": "3.1.0-moodle.1", - "@moodlehq/phonegap-plugin-push": "4.0.0-moodle.1", + "@moodlehq/phonegap-plugin-push": "4.0.0-moodle.2", "@ngx-translate/core": "^13.0.0", "@ngx-translate/http-loader": "^6.0.0", "@types/chart.js": "^2.9.31", diff --git a/src/core/features/pushnotifications/services/pushnotifications.ts b/src/core/features/pushnotifications/services/pushnotifications.ts index 927db6168..b7865abda 100644 --- a/src/core/features/pushnotifications/services/pushnotifications.ts +++ b/src/core/features/pushnotifications/services/pushnotifications.ts @@ -667,9 +667,14 @@ export class CorePushNotificationsProvider { const pushObject = Push.init(options); - pushObject.on('notification').subscribe((notification: NotificationEventResponse) => { + pushObject.on('notification').subscribe((notification: NotificationEventResponse | {registrationType: string}) => { // Execute the callback in the Angular zone, so change detection doesn't stop working. NgZone.run(() => { + if ('registrationType' in notification) { + // Not a valid notification, ignore. + return; + } + this.logger.log('Received a notification', notification); this.onMessageReceived(notification); });