Class ChatNotificationService

java.lang.Object
io.meeds.chat.service.ChatNotificationService

@Service public class ChatNotificationService extends Object
This service creates and manages all different notifications related to the chat application
  • Field Details

    • IN_KEY

      public static String IN_KEY
    • USER_CHAT_NOTIFICATION_SCOPE

      public static final org.exoplatform.commons.api.settings.data.Scope USER_CHAT_NOTIFICATION_SCOPE
    • MUTED_ROOMS

      public static final String MUTED_ROOMS
      See Also:
    • PUSH_NOTIFICATIONS_SETTINGS

      public static final String PUSH_NOTIFICATIONS_SETTINGS
      See Also:
  • Constructor Details

    • ChatNotificationService

      public ChatNotificationService()
  • Method Details

    • sendCreateNotificationAction

      public void sendCreateNotificationAction(String eventId, String userName, String roomId, int unreadCount)
      Sends a notification Creation request to the Push service on the browser based on the event contents
      Parameters:
      eventId - the event ID
      userName - the user name
      roomId - the room ID
      unreadCount - the number of unread messages
    • createNotification

      public io.meeds.pwa.model.PwaNotificationMessage createNotification(MatrixMessage message, String userName)
      Creates a notification based on the received message
      Parameters:
      message - the received message
      userName - the user who will receive the notification
      Returns:
      a PWA push notification object
    • createNotification

      public io.meeds.pwa.model.PwaNotificationMessage createNotification(String eventId, String roomId, String userName, long lastMessageTimeStamp, String token)
      Creates a PWA notification based on the event details
      Parameters:
      eventId - the event Id
      roomId - the room ID
      userName - the user who received the notification
      lastMessageTimeStamp - the timestamp of the last message
      token - the authorization token
      Returns:
      notification object
    • createMentionNotification

      public boolean createMentionNotification(String eventId, String roomId, String userName, String pushKey)
      Creates a web/Mail notification for mentions in space Chat rooms
      Parameters:
      eventId - the event ID
      roomId - the room ID
      userName - the username of the receiver of the notification
      pushKey - jwt token of one of the users in case the room is private
      Returns:
      true if the Mention notification is created, false otherwise
    • isPrivateRoomMutedForUser

      public boolean isPrivateRoomMutedForUser(String userName, String roomId)
    • toggleMutePrivateRoom

      public void toggleMutePrivateRoom(String userName, String roomId)
    • isPushNotificationsEnabled

      public boolean isPushNotificationsEnabled(String userName)
      Check the status of the Push notifications on Chat for a specified user
      Parameters:
      userName - the specified username
      Returns:
      true if the Push notifications settings is enabled
    • updatePushNotificationSettings

      public void updatePushNotificationSettings(String userName, boolean pushNotificationStatus)
      Set the status of the Push notifications on Chat for a specified user
      Parameters:
      userName - the specified user
      pushNotificationStatus - the status true or false