EMConversationHelper.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // EMConversationHelper.h
  3. // ChatDemo-UI3.0
  4. //
  5. // Created by XieYajie on 2019/1/14.
  6. // Copyright © 2019 XieYajie. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. NS_ASSUME_NONNULL_BEGIN
  10. @interface EMConversationModel : NSObject
  11. @property (nonatomic, strong) EMConversation *emModel;
  12. @property (nonatomic, strong) NSString *name;
  13. - (instancetype)initWithEMModel:(EMConversation *)aModel;
  14. @end
  15. @protocol EMConversationsDelegate;
  16. @interface EMConversationHelper : NSObject
  17. - (void)addDelegate:(id<EMConversationsDelegate>)aDelegate;
  18. - (void)removeDelegate:(id<EMConversationsDelegate>)aDelegate;
  19. + (instancetype)shared;
  20. + (NSArray<EMConversationModel *> *)modelsFromEMConversations:(NSArray<EMConversation *> *)aConversations;
  21. + (EMConversationModel *)modelFromContact:(NSString *)aContact;
  22. + (EMConversationModel *)modelFromGroup:(EMGroup *)aGroup;
  23. + (EMConversationModel *)modelFromChatroom:(EMChatroom *)aChatroom;
  24. //调用该方法,会触发[EMConversationsDelegate didConversationUnreadCountToZero:]
  25. + (void)markAllAsRead:(EMConversationModel *)aConversationModel;
  26. //调用该方法,会触发[EMConversationsDelegate didResortConversationsLatestMessage]
  27. + (void)resortConversationsLatestMessage;
  28. @end
  29. @protocol EMConversationsDelegate <NSObject>
  30. @optional
  31. - (void)didConversationUnreadCountToZero:(EMConversationModel *)aConversation;
  32. - (void)didResortConversationsLatestMessage;
  33. @end
  34. NS_ASSUME_NONNULL_END