Channel Participation

All participation-related methods in a channel fall under a separate AmityChannelParticipation model. You can access AmityChannelParticipation from AmityChannelRepository.membership() method as well as from AmityChannel.membership() method.

Member Listing

The getMembers() provides a list of members in the given channel.

The searchMembers() provides an ability to search for members in the given channel by displayname, roles, and membership status.

Manage Members

You can add and remove members, as well as removing yourself as a member of a channel (leaving the channel) via AmityChannelParticipation model should you have appropriate privileges.

Role and Permission

Creator of the channel can add and remove the role of user via AmityChannelModeration.

Note:

  1. The channel creator is automatically assigned as the channel moderator.

  2. The previous/last moderator is not allowed to leave a community and an error is displayed.

  3. The channel moderator can promote a user/member to moderator.

  4. The channel moderator can demote a moderator to a user/member.

This applies only to Live and Community channels’. This does not apply to Conversation Channel.

Role

Query memberships by role

The AmityChannelParticipation provides a list of members by role in the given channel.

Permission

You can check your permission in channel by sending AmityPermission enums to AmityCoreClient.hasPermission(amityPermission).

Reading Status And Unread Count

The AmityChannelRepository provides getTotalUnreadCount() method. It's giving the flowable of the number of messages that the current user has yet to read. This count is the sum of all the unreadCount channels properties where the user is a member of.

Unread mention

To check whether the current user has been mentioned on one of the unread messages:

Reading status update

The AmityChannelParticipation.startReading() and AmityChannelParticipation.stopReading() methods let the server know that the current user is reading a channel. After the startReading()and stopReading() methods are called, the unreadCount is reset to 0.

You can call both methods as many times as you require. The SDK takes care of multiple device management: thus, a user can read multiple channels from one or more devices simultaneously. In case of an abrupt disconnection (be it the app has been terminated or the internet is down, etc.), the SDK backend automatically calls the AmityChannelParticipation.stopReading() method for the user.

Last updated