Package org.ametys.plugins.mobileapp
Class PushNotificationManager
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.mobileapp.PushNotificationManager
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
manager to push notifications to users
-
Field Summary
Modifier and TypeFieldDescriptionprotected UserPreferencesHelper
User Preferences Helperstatic final String
Avalon Role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_handlePushError
(io.github.jav.exposerversdk.PushNotificationException exception, String title, String message, Map<String, Object> data, Map<String, UserIdentity> tokenToUserMap) Handle an exception essentially when trying to push notifications to multiple expo projects, to do it again for each projectvoid
pushNotifications
(String title, String message, Map<UserIdentity, Set<String>> tokens, Map<String, Object> data) Push a notification to a list of registered devicesvoid
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon Role -
_userPreferencesHelper
User Preferences Helper
-
-
Constructor Details
-
PushNotificationManager
public PushNotificationManager()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
pushNotifications
public void pushNotifications(String title, String message, Map<UserIdentity, Set<String>> tokens, Map<String, throws io.github.jav.exposerversdk.PushClientExceptionObject> data) Push a notification to a list of registered devices- Parameters:
title
- title of the messagemessage
- message to sendtokens
- list of devicet tokensdata
- the data to push- Throws:
io.github.jav.exposerversdk.PushClientException
- something went wrong
-
_handlePushError
protected void _handlePushError(io.github.jav.exposerversdk.PushNotificationException exception, String title, String message, Map<String, Object> data, Map<String, throws io.github.jav.exposerversdk.PushClientExceptionUserIdentity> tokenToUserMap) Handle an exception essentially when trying to push notifications to multiple expo projects, to do it again for each project- Parameters:
exception
- the exception throwntitle
- title of the notificationmessage
- description of the notificationdata
- data of the notificationtokenToUserMap
- Reversed user/token map- Throws:
io.github.jav.exposerversdk.PushClientException
- Something went very wrong
-