- Android
- iOS
- JavaScript
- Flutter
- ReactNative
You can register multiple listeners.
JIM.getInstance().getConversationManager().addTagListener("main", new IConversationManager.IConversationTagListener() {
/// tag created
@Override
public void onTagCreate(ConversationTagInfo tagInfo) {
}
/// tag destroyed
@Override
public void onTagDestroy(String tagId) {
}
/// tag name changed
@Override
public void onTagNameUpdate(String tagId, String tagName) {
}
/// conversation added to the tag
@Override
public void onConversationsAddToTag(String tagId, List<Conversation> conversations) {
}
/// conversation removed from the tag
@Override
public void onConversationsRemoveFromTag(String tagId, List<Conversation> conversations) {
}
});
You can register multiple delegates.
[JIM.shared.conversationManager addTagDelegate:self];
/// tag created
- (void)tagDidCreate:(JConversationTagInfo *)tagInfo {
}
/// tag destroyed
- (void)tagDidDestroy:(NSString *)tagId {
}
/// tag name changed
- (void)tagNameDidUpdate:(NSString *)tagId name:(NSString *)tagName {
}
/// conversation added to the tag
- (void)conversationsDidAddToTag:(NSString *)tagId
conversations:(NSArray <JConversation *> *)conversationList {
}
/// conversation removed from the tag
- (void)conversationsDidRemoveFromTag:(NSString *)tagId
conversations:(NSArray <JConversation *> *)conversationList {
}
let { Event } = JIM;
### Tag Added
jim.on(Event.TAG_ADDED, ({ tags }) => {
/* tags => [{ id: 'tag_01', name: 'My Favorites', order: 1 }, ... ] */
});
### tag destroyed
jim.on(Event.TAG_REMOVED, (notify) => {
/* tags => [{ id: 'tag_01' }, ... ] */
});
### Tag Changed
jim.on(Event.TAG_CHANGED, (notify) => {
/* tags => [{ id: 'tag_01', name: 'My Favorites', order: 1 }, ... ] */
});
### Conversation Added to Tag
jim.on(Event.TAG_CONVERSATION_ADDED, (notify) => {
/* tags => [{ id: 'tag_01', conversations: [ Conversation, ...] }, ... ] */
});
### Conversation Removed from Tag
jim.on(Event.TAG_CONVERSATION_REMOVED, (notify) => {
/* tags => [{ id: 'tag_01', conversations: [ Conversation, ...] }, ... ] */
});
Not supported.
You can register multiple listeners.
import JuggleIM from 'juggleim-rnsdk';
// conversation added to the tag
const removeAddToTagListener = JuggleIM.addConversationsAddToTagListener((data) => {
console.log('conversations added to tag:', data);
});
// conversation removed from the tag
const removeRemoveFromTagListener = JuggleIM.addConversationsRemoveFromTagListener((data) => {
console.log('conversations removed from tag:', data);
});
// remove the listener
removeAddToTagListener();
removeRemoveFromTagListener();