TUIConversationListBaseDataProvider.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. //
  2. // TUIConversationListBaseDataProvider.h
  3. // TUIConversation
  4. //
  5. // Created by harvy on 2022/7/14.
  6. // Copyright © 2023 Tencent. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. @import ImSDK_Plus;
  10. @class V2TIMConversation;
  11. @class V2TIMConversationListFilter;
  12. @class V2TIMMessage;
  13. @class TUIConversationCellData;
  14. NS_ASSUME_NONNULL_BEGIN
  15. static NSString *gGroup_conversationFoldListMockID = @"group_conversationFoldListMockID";
  16. @protocol TUIConversationListDataProviderDelegate <NSObject>
  17. @optional
  18. - (NSString *)getConversationDisplayString:(V2TIMConversation *)conversation;
  19. - (void)insertConversationsAtIndexPaths:(NSArray *)indexPaths;
  20. - (void)reloadConversationsAtIndexPaths:(NSArray *)indexPaths;
  21. - (void)deleteConversationAtIndexPaths:(NSArray *)indexPaths;
  22. - (void)reloadAllConversations;
  23. - (void)updateMarkUnreadCount:(NSInteger)markUnreadCount markHideUnreadCount:(NSInteger)markHideUnreadCount;
  24. @end
  25. @protocol TUIConversationListDataProviderDelegate_Two <NSObject>
  26. - (TUIConversationCellData *)cellDataForConversation_Two:(V2TIMConversation *)conversation;
  27. @end
  28. @interface TUIConversationListBaseDataProvider : NSObject
  29. /**
  30. *
  31. * The conversations pull filter
  32. */
  33. @property(nonatomic, strong) V2TIMConversationListFilter *filter;
  34. /**
  35. * , 100
  36. * The count of conversations per page, default is 100
  37. */
  38. @property(nonatomic, assign) NSUInteger pageSize;
  39. /**
  40. *
  41. * The index of the current page
  42. */
  43. @property(nonatomic, assign) NSUInteger pageIndex;
  44. /**
  45. *
  46. * An identifier that identifies whether the paging data has been completely pulled
  47. */
  48. @property(nonatomic, assign, readonly, getter=isLastPage) BOOL lastPage;
  49. @property(nonatomic, weak, nullable) id<TUIConversationListDataProviderDelegate> delegate;
  50. @property(nonatomic, strong, readonly) NSMutableArray<TUIConversationCellData *> *conversationList;
  51. @property(nonatomic, strong) NSMutableDictionary<NSString *, TUIConversationCellData *> *markHideMap;
  52. @property(nonatomic, strong) NSMutableDictionary<NSString *, TUIConversationCellData *> *markUnreadMap;
  53. @property(nonatomic, strong) NSMutableDictionary<NSString *, TUIConversationCellData *> *markFoldMap;
  54. @property(nonatomic, strong) NSDictionary<NSString *, NSString *> *lastMessageDisplayMap;
  55. @property (nonatomic, weak, nullable) id <TUIConversationListDataProviderDelegate_Two> delegateTwo;
  56. - (void)loadNexPageConversations;
  57. - (void)addConversationList:(NSArray<TUIConversationCellData *> *)conversationList;
  58. - (void)removeConversation:(TUIConversationCellData *)conversation;
  59. - (void)clearHistoryMessage:(TUIConversationCellData *)conversation;
  60. - (void)pinConversation:(TUIConversationCellData *)conversation pin:(BOOL)pin;
  61. - (void)hideConversation:(TUIConversationCellData *)conversation;
  62. - (void)markConversationHide:(TUIConversationCellData *)data;
  63. - (void)markConversationAsRead:(TUIConversationCellData *)conv;
  64. - (void)markConversationAsUnRead:(TUIConversationCellData *)conv;
  65. + (void)cacheConversationFoldListSettings_HideFoldItem:(BOOL)flag;
  66. + (void)cacheConversationFoldListSettings_FoldItemIsUnread:(BOOL)flag;
  67. + (BOOL)getConversationFoldListSettings_HideFoldItem;
  68. + (BOOL)getConversationFoldListSettings_FoldItemIsUnread;
  69. - (NSString *)getGroupAtTipString:(V2TIMConversation *)conv;
  70. - (NSString *)getDraftContent:(V2TIMConversation *)conv;
  71. - (BOOL)isConversationNotDisturb:(V2TIMConversation *)conversation;
  72. - (NSMutableArray<NSNumber *> *)getGroupatMsgSeqs:(V2TIMConversation *)conv;
  73. - (NSDate *)getLastDisplayDate:(V2TIMConversation *)conv;
  74. // subclass override
  75. - (Class)getConversationCellClass;
  76. - (void)asnycGetLastMessageDisplay:(NSArray<TUIConversationCellData *> *)duplicateDataList addedDataList:(NSArray<TUIConversationCellData *> *)addedDataList;
  77. - (NSString *)getDisplayStringFromService:(V2TIMMessage *)msg;
  78. - (NSMutableAttributedString *)getLastDisplayString:(V2TIMConversation *)conversation;
  79. - (NSMutableAttributedString *)getLastDisplayStringForFoldList:(V2TIMConversation *)conversation;
  80. - (TUIConversationCellData *)cellDataForConversation:(V2TIMConversation *)conversation;
  81. - (BOOL)filteConversation:(V2TIMConversation *)conversation;
  82. - (void)sortDataList:(NSMutableArray<TUIConversationCellData *> *)dataList;
  83. - (void)handleInsertConversationList:(NSArray<TUIConversationCellData *> *)conversationList;
  84. - (void)handleUpdateConversationList:(NSArray<TUIConversationCellData *> *)conversationList
  85. positions:(NSMutableDictionary<NSString *, NSNumber *> *)positionMaps;
  86. - (void)handleHideConversation:(TUIConversationCellData *)conversation;
  87. - (void)updateMarkUnreadCount;
  88. @end
  89. NS_ASSUME_NONNULL_END