From 7ea44364e15ecb0280fb9e512791990b5815779a Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 21 Jul 2021 11:29:46 +0200 Subject: [PATCH] MOBILE-3060 local: Support sender image in local notifications --- package-lock.json | 14 +++++++------- package.json | 2 +- .../services/pushnotifications.ts | 5 ++++- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 29eef5220..68b99fc85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,7 +46,7 @@ "@moodlehq/cordova-plugin-file-transfer": "1.7.1-moodle.2", "@moodlehq/cordova-plugin-inappbrowser": "5.0.0-moodle.2", "@moodlehq/cordova-plugin-ionic-webview": "5.0.0-moodle.1", - "@moodlehq/cordova-plugin-local-notification": "0.9.0-moodle.2", + "@moodlehq/cordova-plugin-local-notification": "0.9.0-moodle.3", "@moodlehq/cordova-plugin-qrscanner": "3.0.1-moodle.2", "@moodlehq/phonegap-plugin-push": "2.0.0-moodle.2", "@ngx-translate/core": "^13.0.0", @@ -4989,9 +4989,9 @@ } }, "node_modules/@moodlehq/cordova-plugin-local-notification": { - "version": "0.9.0-moodle.2", - "resolved": "https://registry.npmjs.org/@moodlehq/cordova-plugin-local-notification/-/cordova-plugin-local-notification-0.9.0-moodle.2.tgz", - "integrity": "sha512-enK/jcbXrnSFJt8TS2drb/5uUOpsTYbUqjI3pYgvogKdP5k5JOnT0xtW54Arlpl5RphcINx733OuXHRJAED2Ow==", + "version": "0.9.0-moodle.3", + "resolved": "https://registry.npmjs.org/@moodlehq/cordova-plugin-local-notification/-/cordova-plugin-local-notification-0.9.0-moodle.3.tgz", + "integrity": "sha512-dSEvshH9fE3aUG4bO05gCMqWVCnvZGUeddIfB8OShN60sj0CUWuI1e7Mn5syzTcRRNRi8XQ4MTv85zk4c8mzww==", "engines": [ { "name": "cordova", @@ -34705,9 +34705,9 @@ "integrity": "sha512-+6UrPKsEgXl3pcuTyI1hZIUw9y22Li/nvn7nxiphgZdldlhBvkMK/7nn4IAaXYlnrmIOpCkIrU4BbrAjSJGWSQ==" }, "@moodlehq/cordova-plugin-local-notification": { - "version": "0.9.0-moodle.2", - "resolved": "https://registry.npmjs.org/@moodlehq/cordova-plugin-local-notification/-/cordova-plugin-local-notification-0.9.0-moodle.2.tgz", - "integrity": "sha512-enK/jcbXrnSFJt8TS2drb/5uUOpsTYbUqjI3pYgvogKdP5k5JOnT0xtW54Arlpl5RphcINx733OuXHRJAED2Ow==" + "version": "0.9.0-moodle.3", + "resolved": "https://registry.npmjs.org/@moodlehq/cordova-plugin-local-notification/-/cordova-plugin-local-notification-0.9.0-moodle.3.tgz", + "integrity": "sha512-dSEvshH9fE3aUG4bO05gCMqWVCnvZGUeddIfB8OShN60sj0CUWuI1e7Mn5syzTcRRNRi8XQ4MTv85zk4c8mzww==" }, "@moodlehq/cordova-plugin-qrscanner": { "version": "3.0.1-moodle.2", diff --git a/package.json b/package.json index ee81a3bc7..061f50558 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "@moodlehq/cordova-plugin-file-transfer": "1.7.1-moodle.2", "@moodlehq/cordova-plugin-inappbrowser": "5.0.0-moodle.2", "@moodlehq/cordova-plugin-ionic-webview": "5.0.0-moodle.1", - "@moodlehq/cordova-plugin-local-notification": "0.9.0-moodle.2", + "@moodlehq/cordova-plugin-local-notification": "0.9.0-moodle.3", "@moodlehq/cordova-plugin-qrscanner": "3.0.1-moodle.2", "@moodlehq/phonegap-plugin-push": "2.0.0-moodle.2", "@ngx-translate/core": "^13.0.0", diff --git a/src/core/features/pushnotifications/services/pushnotifications.ts b/src/core/features/pushnotifications/services/pushnotifications.ts index beef5bbbb..6b02caf7e 100644 --- a/src/core/features/pushnotifications/services/pushnotifications.ts +++ b/src/core/features/pushnotifications/services/pushnotifications.ts @@ -454,7 +454,8 @@ export class CorePushNotificationsProvider { ( localNotif).text = [ { message: notification.message, - person: data.conversationtype == '2' ? data.userfromfullname : '', + person: data.sender ?? (data.conversationtype == '2' ? data.userfromfullname : ''), + personIcon: data.senderImage, }, ]; } @@ -866,6 +867,8 @@ export type CorePushNotificationsNotificationBasicRawData = { userfromid?: string; // ID of user sending the push. Only if it's a push generated by a Moodle message. picture?: string; // Notification big picture. "Extra" feature. summaryText?: string; // Notification summary text. "Extra" feature. + sender?: string; // Name of the user who sent the message. "Extra" feature. + senderImage?: string; // Image of the user who sent the message. "Extra" feature. }; /**