MOBILE-3507 push: Support notifications without component
parent
ca172baba8
commit
e46aab5ed0
|
@ -39,6 +39,11 @@ export class AddonNotificationsPushClickHandler implements CorePushNotifications
|
||||||
* @return Whether the notification click is handled by this handler
|
* @return Whether the notification click is handled by this handler
|
||||||
*/
|
*/
|
||||||
handles(notification: any): boolean | Promise<boolean> {
|
handles(notification: any): boolean | Promise<boolean> {
|
||||||
|
if (!notification.moodlecomponent) {
|
||||||
|
// The notification doesn't come from Moodle. Handle it.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.utils.isTrueOrOne(notification.notif)) {
|
if (this.utils.isTrueOrOne(notification.notif)) {
|
||||||
// Notification clicked, mark as read. Don't block for this.
|
// Notification clicked, mark as read. Don't block for this.
|
||||||
const notifId = notification.savedmessageid || notification.id;
|
const notifId = notification.savedmessageid || notification.id;
|
||||||
|
@ -74,7 +79,7 @@ export class AddonNotificationsPushClickHandler implements CorePushNotifications
|
||||||
// Try to handle the appurl.
|
// Try to handle the appurl.
|
||||||
if (notification.customdata && notification.customdata.appurl) {
|
if (notification.customdata && notification.customdata.appurl) {
|
||||||
switch (notification.customdata.appurlopenin) {
|
switch (notification.customdata.appurlopenin) {
|
||||||
case 'inappbrowser':
|
case 'inapp':
|
||||||
this.utils.openInApp(notification.customdata.appurl);
|
this.utils.openInApp(notification.customdata.appurl);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -37,8 +37,8 @@ export class CoreCoursesEnrolPushClickHandler implements CorePushNotificationsCl
|
||||||
* @return Whether the notification click is handled by this handler
|
* @return Whether the notification click is handled by this handler
|
||||||
*/
|
*/
|
||||||
handles(notification: any): boolean | Promise<boolean> {
|
handles(notification: any): boolean | Promise<boolean> {
|
||||||
return this.utils.isTrueOrOne(notification.notif) && notification.moodlecomponent.indexOf('enrol_') === 0 &&
|
return this.utils.isTrueOrOne(notification.notif) && notification.moodlecomponent &&
|
||||||
notification.name == 'expiry_notification';
|
notification.moodlecomponent.indexOf('enrol_') === 0 && notification.name == 'expiry_notification';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue