-
- All Implemented Interfaces:
-
io.getstream.chat.android.offline.event.handler.chat.ChatEventHandler
public class DefaultChatEventHandler extends BaseChatEventHandler
Default implementation of ChatEventHandler which is based on the current user membership.
-
-
Constructor Summary
Constructors Constructor Description DefaultChatEventHandler(StateFlow<Map<String, Channel>> channels, ClientState clientState)
-
Method Summary
Modifier and Type Method Description EventHandlingResulthandleCidEvent(CidEvent event, FilterObject filter, Channel cachedChannel)Handles additional events: NewMessageEvent - adds the channel to the set if its not a system message.
MemberRemovedEvent - removes the channel from the set if a current user left.
MemberAddedEvent - adds the channel to the set if a current user was added.
EventHandlingResulthandleChannelEvent(HasChannel event, FilterObject filter)Handles additional events: NotificationMessageNewEvent - calls watch and adds the channel to the set.
NotificationRemovedFromChannelEvent - removes the channel from the set if a current user left.
NotificationAddedToChannelEvent - calls watch and adds the channel to the set if a current user was added.
EventHandlingResulthandleMemberRemovedEvent(MemberRemovedEvent event, FilterObject filter, Channel cachedChannel)Handles MemberRemovedEvent. EventHandlingResulthandleMemberAddedEvent(MemberAddedEvent event, FilterObject filter, Channel cachedChannel)Handles MemberAddedEvent event. EventHandlingResulthandleNotificationRemovedFromChannelEvent(NotificationRemovedFromChannelEvent event, FilterObject filter)Handles NotificationRemovedFromChannelEvent. EventHandlingResulthandleNotificationAddedToChannelEvent(NotificationAddedToChannelEvent event, FilterObject filter)Handles NotificationAddedToChannelEvent event. EventHandlingResulthandleChannelUpdatedByUserEvent(ChannelUpdatedByUserEvent event, FilterObject filter)Handles ChannelUpdatedByUserEvent event. EventHandlingResulthandleChannelUpdatedEvent(ChannelUpdatedEvent event, FilterObject filter)Handles ChannelUpdatedEvent event. -
Methods inherited from class io.getstream.chat.android.offline.event.handler.chat.BaseChatEventHandler
handleChannelVisibleEvent, handleChatEvent, handleNotificationMessageNewEvent -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
handleCidEvent
EventHandlingResult handleCidEvent(CidEvent event, FilterObject filter, Channel cachedChannel)
Handles additional events:
NewMessageEvent - adds the channel to the set if its not a system message.
MemberRemovedEvent - removes the channel from the set if a current user left.
MemberAddedEvent - adds the channel to the set if a current user was added.
- Parameters:
event- ChatEvent that may contain updates for the set of channels.filter- FilterObject associated with the set of channels.cachedChannel- Optional cached Channel object if exists.
-
handleChannelEvent
EventHandlingResult handleChannelEvent(HasChannel event, FilterObject filter)
Handles additional events:
NotificationMessageNewEvent - calls watch and adds the channel to the set.
NotificationRemovedFromChannelEvent - removes the channel from the set if a current user left.
NotificationAddedToChannelEvent - calls watch and adds the channel to the set if a current user was added.
- Parameters:
event- ChatEvent that may contain updates for the set of channels.filter- FilterObject associated with the set of channels.
-
handleMemberRemovedEvent
EventHandlingResult handleMemberRemovedEvent(MemberRemovedEvent event, FilterObject filter, Channel cachedChannel)
Handles MemberRemovedEvent. It removes the channel if it's present in the list.
- Parameters:
event- Instance of MemberRemovedEvent that is being handled.filter- FilterObject which is used to define an outcome.cachedChannel- optional Channel object cached in database
-
handleMemberAddedEvent
EventHandlingResult handleMemberAddedEvent(MemberAddedEvent event, FilterObject filter, Channel cachedChannel)
Handles MemberAddedEvent event. It adds the channel if it is absent.
- Parameters:
event- Instance of NotificationAddedToChannelEvent that is being handled.filter- FilterObject which is used to define an outcome.cachedChannel- optional Channel object cached in database.
-
handleNotificationRemovedFromChannelEvent
EventHandlingResult handleNotificationRemovedFromChannelEvent(NotificationRemovedFromChannelEvent event, FilterObject filter)
Handles NotificationRemovedFromChannelEvent. It removes the channel if it's present in the list.
- Parameters:
event- Instance of NotificationRemovedFromChannelEvent that is being handled.filter- FilterObject which is used to define an outcome.
-
handleNotificationAddedToChannelEvent
EventHandlingResult handleNotificationAddedToChannelEvent(NotificationAddedToChannelEvent event, FilterObject filter)
Handles NotificationAddedToChannelEvent event. It adds the channel if it is absent.
- Parameters:
event- Instance of NotificationAddedToChannelEvent that is being handled.filter- FilterObject which is used to define an outcome.
-
handleChannelUpdatedByUserEvent
EventHandlingResult handleChannelUpdatedByUserEvent(ChannelUpdatedByUserEvent event, FilterObject filter)
Handles ChannelUpdatedByUserEvent event. The event is skipped.
-
handleChannelUpdatedEvent
EventHandlingResult handleChannelUpdatedEvent(ChannelUpdatedEvent event, FilterObject filter)
Handles ChannelUpdatedEvent event. The event is skipped.
-
-
-