Conversation. Creation of
Standardtype has been removed. Creation of
Broadcastchannel type is not supported through the SDK. But for query,
getChannels:method supports all channel types including
channelId, which is any string that uniquely identifies the channel and is immutable through its lifetime. When creating channels, you can specify your own
channelId, or leave it to Amity's Chat SDK to automatically generate one for you.
createChannel:guarantees that the requested channel is a new channel, whereas
joinChannel:will attempt to join an existing channel. If there is a requirement to create a new channel, then use of
joinChannel:. Lastly calling
getChannel:only gives you back the channel LiveObject, but it won't make the current user join said channel.
AmityChannelRepositoryclass. Before being able to call any channel method, you must initialize a repository instance using the
AmityClientinstance you created during setup:
createChannel()method to create a new channel. It supports creating of 3 types of channels
Conversation. Each channel type has specific builder classes which help you to create that particular channel. Build your channel information first and then create the particular channel.
AmityChannelRepository, a class that contains all channel-related methods. Then it calls
createChannel:to obtain the LiveObject and observe it in order to obtain the final channel model.
AmityNotificationTokenreturned by the
observe:is saved in
self.channelToken, a strongly referenced property. This is needed in order to prevent the observe block from being released. You should note that this block can get called multiple times when the underlying data for the channel updates. If you don't want to get notified, you can call
channelToken.invalidate(). As soon as the token gets invalidated, observer is automatically removed from that channel.
channelID, the LiveObject will notify you with an
nil: when this happens, the SDK will generate a unique
channelIdfor this channel, ensuring no unique ID conflicts.
createConversation:method which creates a conversation channel type. You can use either
createConversationmethod directly as well.
joinChannel:is an idempotent method, this means it can be called multiple times throughout the lifecycle of the application, and you can expect this method to always return the same channel. Because of this, you can also use
joinChannel:any time you need to fetch a channel, even if you know the user may already be in the channel.
getChannel:method can be used:
AmityChannelRepositoryprovides a way to query list of channels using
getChannels()method. It returns a
AmityCollectionof all the matching channels available. This live collection returned will automatically update and notify you of any channel modifications as well.
UICollectionViewto display channel list data, the ideal location to reload table data is directly in the observe block of the LiveObject that you are displaying, as shown in the example above.
metadataproperty on the channel model.
displayNameproperty. This property is mainly used to identify the channel in push notifications, but it is also exposed to the application via
displayNamewith the following method:
AmityChannelParticipationclass. Before calling any participation methods, you must ensure to first instantiate a repository instance using the
AmityClientinstance you created on setup and a valid
AmityChannelRepositoryobject exposes a
totalUnreadCountproperty that reflects the number of messages that the current user has yet to read. This count is the sum of all the
unreadCountchannels properties where the user is already a member.
unreadCountto zero, the participation membership exposes the
stopReadingon the user's behalf.
AmityChannelModerationclass provides various methods to moderate the users present in any given channel. You can ban/unban/mute users, assign or remove roles from users.