Interface ChannelHandler
-
- All Implemented Interfaces:
public interface ChannelHandlerChannel status event handler.
Listens for channel-level status changes and sync events, including:
Multi-device sync: pinned state, do-not-disturb level, and translation strategy changes made on other devices are synced to the current device
Remote sync: server-side channel list pull completion
Typing status: real-time typing indicators from other users
Community events: sub-channel type changes, deletions, and user kicks
Register via NCEngine.addChannelHandler. All callback methods have default empty implementations; override only the callbacks you need.
NCEngine.addChannelHandler("CHANNEL_HANDLER_ID", object : ChannelHandler { override fun onChannelPinnedSync(event: ChannelPinnedSyncEvent) { println("Channel ${event.channelIdentifier.channelId} pinned: ${event.isPinned}") } override fun onChannelNoDisturbLevelSync(event: ChannelNoDisturbLevelSyncEvent) { println("Channel ${event.channelIdentifier.channelId} DND level: ${event.level}") } override fun onChannelStatusSyncCompleted(event: ChannelStatusSyncCompletedEvent) { if (event.error == null) { println("Channel status sync completed") } } override fun onChannelTranslateStrategySync(event: ChannelTranslateStrategySyncEvent) { println("Channel ${event.channelIdentifier.channelId} translate strategy: ${event.strategy}") } override fun onRemoteChannelsSyncCompleted(event: RemoteChannelsSyncCompletedEvent) { if (event.error == null) { println("Remote channels sync completed") } } })
-
-
Method Summary
Modifier and Type Method Description UnitonChannelPinnedSync(ChannelPinnedSyncEvent event)Called when channel pinned status is synced from another device. UnitonChannelNoDisturbLevelSync(ChannelNoDisturbLevelSyncEvent event)Called when channel DND level is synced from another device. UnitonChannelStatusSyncCompleted(ChannelStatusSyncCompletedEvent event)Called when channel status sync completes. UnitonChannelTranslateStrategySync(ChannelTranslateStrategySyncEvent event)Called when a channel's translation strategy is synced from another device. UnitonRemoteChannelsSyncCompleted(RemoteChannelsSyncCompletedEvent event)Called when remote channels sync completes. UnitonTypingStatusChanged(TypingStatusChangedEvent event)Called when typing status changes in a channel. UnitonCommunitySubChannelTypeChanged(CommunitySubChannelTypeChangedEvent event)Called when a community sub-channel's type changes. UnitonCommunitySubChannelDeleted(CommunitySubChannelDeletedEvent event)Called when a community sub-channel is deleted. UnitonCommunitySubChannelUserKicked(CommunitySubChannelUserKickedEvent event)Called when a user is kicked from a community private sub-channel. UnitonCommunityChannelsSyncCompleted(CommunityChannelsSyncCompletedEvent event)Called when community channel list sync completes. -
-
Method Detail
-
onChannelPinnedSync
Unit onChannelPinnedSync(ChannelPinnedSyncEvent event)
Called when channel pinned status is synced from another device.
- Parameters:
event- Channel pinned sync event
-
onChannelNoDisturbLevelSync
Unit onChannelNoDisturbLevelSync(ChannelNoDisturbLevelSyncEvent event)
Called when channel DND level is synced from another device.
- Parameters:
event- Channel no-disturb level sync event
-
onChannelStatusSyncCompleted
Unit onChannelStatusSyncCompleted(ChannelStatusSyncCompletedEvent event)
Called when channel status sync completes.
- Parameters:
event- Channel status sync completed event
-
onChannelTranslateStrategySync
Unit onChannelTranslateStrategySync(ChannelTranslateStrategySyncEvent event)
Called when a channel's translation strategy is synced from another device.
- Parameters:
event- Channel translate strategy sync event
-
onRemoteChannelsSyncCompleted
Unit onRemoteChannelsSyncCompleted(RemoteChannelsSyncCompletedEvent event)
Called when remote channels sync completes.
Triggered after NCEngine pulls the channel list from the server.
- Parameters:
event- Remote channels sync completed event
-
onTypingStatusChanged
Unit onTypingStatusChanged(TypingStatusChangedEvent event)
Called when typing status changes in a channel.
For direct channels, triggered when the other party starts or stops typing. When the other party stops typing, TypingStatusChangedEvent.userTypingStatus will be empty.
- Parameters:
event- Typing status changed event
-
onCommunitySubChannelTypeChanged
Unit onCommunitySubChannelTypeChanged(CommunitySubChannelTypeChangedEvent event)
Called when a community sub-channel's type changes.
Triggered when a sub-channel changes between public and private.
Private to public: whitelist members receive this event.
Public to private: all members receive this event.
- Parameters:
event- Community sub-channel type changed event
-
onCommunitySubChannelDeleted
Unit onCommunitySubChannelDeleted(CommunitySubChannelDeletedEvent event)
Called when a community sub-channel is deleted.
Public channel: all members are notified.
Private channel: whitelist members are notified.
- Parameters:
event- Community sub-channel deleted event
-
onCommunitySubChannelUserKicked
Unit onCommunitySubChannelUserKicked(CommunitySubChannelUserKickedEvent event)
Called when a user is kicked from a community private sub-channel.
Only whitelist members of the private channel receive this event. Not triggered for public channels.
- Parameters:
event- Community sub-channel user kicked event
-
onCommunityChannelsSyncCompleted
Unit onCommunityChannelsSyncCompleted(CommunityChannelsSyncCompletedEvent event)
Called when community channel list sync completes.
Triggered after the SDK finishes syncing the community channel list and latest messages from the server.
- Parameters:
event- Community channels sync completed event
-
-
-
-