I see guide about support notification click for custom plugin:
https://docs.moodle.org/dev/Mobile_support_for_plugins#Support_push_notification_clicks
Is there any example or something like that?
I try to register click handler from CorePushNotificationsDelegate.
But when clicking it push to homepage or message page.
Any idea?
(function (t) {
//Handler to proceed Push Notification
function AddonFooPushClickHandler() {
this.name = "AddonFooPushClickHandler";
this.priority = 1;
this.featureName = 'CoreMainMenuDelegate_AddonFoo';
}
AddonFooPushClickHandler.prototype.constructor = AddonFooPushClickHandler;
AddonFooPushClickHandler.prototype.handles = function(notification){
if (t.CoreUtilsProvider.isTrueOrOne(notification.notif) && notification.name == 'lesson') {
return true;
}
return false;
};
AddonFooPushClickHandler.prototype.handleClick = function(notification){
const data = notification.customdata || {},
courseId = Number(notification.courseid),
moduleId = Number(data.cmid);
return this.CoreGradesHelperProvider.goToGrades(courseId, undefined, moduleId, undefined, notification.site);
};
t.CorePushNotificationsDelegate.registerClickHandler(new AddonFooPushClickHandler());
})(this);