Dialogs
Open Channels¶
Getting a list of open channels¶
af.PublicChannel.fetchChannels((channelList, error) => { if (error) { // handle error } else { // success, you get a list of channel dialogs objects } });
Private Dialogs¶
Getting a list of dialogs that you are in¶
af.Dialog.fetchAllDialogs((dialogList, error) => { if (error) { // handle error } else { // success, you get a list of private dialogs objects } });
Get information of one dialog¶
af.Dialog.getDialogInfo(dialogID, function(dialog, error) { if (error) { // handle error } else { // success, you get a list of private dialogs objects } });
Manage dialog members¶
To see the current users in a dialog, use memberIDs
property of a dialog object.
const memberIDs = dialog.memberIDs;
Invite someone to a group dialog
af.Dialog.inviteWithMemberIds(dialogID, userIds, (response, error) => { if (error) { // handle error } else { // success, you get a list of private dialogs objects } });
Leave a group dialog
af.Dialog.leaveDialog(channel.id, (channel, error) => { if (error) { // handle error } else { // success, you get a list of private dialogs objects } });
Unread Message Count¶
To get unread message count of each dialog, use unreadMessageCount
property of the a dialog object.
const unreadMessageCount = dialog.unreadMessageCount
Get total unread message count of all dialogs¶
af.getTotalUnreadMessageCount((unreadCount) => { // returns the number of unread messages });
Clear dialog unread count¶
After you enter a dialog, you can clear the unread count by:
dialog.markAsRead();