TUIBaseMessageController.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. // Created by Tencent on 2023/06/09.
  2. // Copyright © 2023 Tencent. All rights reserved.
  3. /**
  4. *
  5. * This file declares the controller class used to implement the messaging logic
  6. * The message controller is responsible for uniformly displaying the messages you send/receive, while providing response callbacks when you interact with
  7. * those messages (tap/long-press, etc.). The message controller is also responsible for unified data processing of the messages you send into a data format
  8. * that can be sent through the IM SDK and sent. That is to say, when you use this controller, you can save a lot of data processing work, so that you can
  9. * access the IM SDK more quickly and conveniently.
  10. */
  11. #import <TIMCommon/TUIMessageCell.h>
  12. #import <UIKit/UIKit.h>
  13. #import "TUIBaseMessageControllerDelegate.h"
  14. #import "TUIChatConversationModel.h"
  15. #import "TUIChatDefine.h"
  16. NS_ASSUME_NONNULL_BEGIN
  17. @class TUIConversationCellData;
  18. @class TUIBaseMessageController;
  19. @class TUIReplyMessageCell;
  20. /////////////////////////////////////////////////////////////////////////////////
  21. //
  22. // TUIBaseMessageController
  23. //
  24. /////////////////////////////////////////////////////////////////////////////////
  25. @protocol TUIBaseMessageControllerDelegate_Two <NSObject>
  26. - (V2TIMMessage *)messageController_Two:(TUIBaseMessageController *)controller onNewMessage:(V2TIMMessage *)message;
  27. @end
  28. /**
  29. *
  30. * 【Module name】TUIBaseMessageController
  31. * 【Function description】The message controller is responsible for implementing a series of business logic such as receiving, sending, and displaying
  32. * messages.
  33. * - This class provides callback interfaces for interactive operations such as receiving/displaying new messages, showing/hiding menus, and clicking on
  34. * message avatars.
  35. * - At the same time, this class provides the sending function of image, video, and file information, and directly integrates and calls the IM SDK to realize
  36. * the sending function.
  37. *
  38. */
  39. @interface TUIBaseMessageController : UITableViewController
  40. + (void)asyncGetDisplayString:(NSArray<V2TIMMessage *> *)messageList callback:(void(^)(NSDictionary<NSString *, NSString *> *))callback;
  41. + (nullable NSString *)getDisplayString:(V2TIMMessage *)message;
  42. @property(nonatomic, weak) id<TUIBaseMessageControllerDelegate> delegate;
  43. @property(nonatomic, weak) id<TUIBaseMessageControllerDelegate_Two> delegate_Two;
  44. @property(nonatomic, assign) BOOL isInVC;
  45. /**
  46. * Whether a read receipt is required to send a message, the default is NO
  47. */
  48. @property(nonatomic) BOOL isMsgNeedReadReceipt;
  49. @property(nonatomic, copy) void (^groupRoleChanged)(V2TIMGroupMemberRole role);
  50. @property(nonatomic, copy) void (^pinGroupMessageChanged)(NSArray *groupPinList);
  51. - (void)sendMessage:(V2TIMMessage *)msg;
  52. - (void)sendMessage:(V2TIMMessage *)msg placeHolderCellData:(TUIMessageCellData *)placeHolderCellData;
  53. - (void)clearUImsg;
  54. - (void)scrollToBottom:(BOOL)animate;
  55. - (void)setConversation:(TUIChatConversationModel *)conversationData;
  56. - (void)sendPlaceHolderUIMessage:(TUIMessageCellData *)cellData;
  57. /**
  58. *
  59. * After enabling multi-selection mode, get the currently selected result
  60. * Returns an empty array if multiple selection mode is off
  61. */
  62. - (NSArray<TUIMessageCellData *> *)multiSelectedResult:(TUIMultiResultOption)option;
  63. - (void)enableMultiSelectedMode:(BOOL)enable;
  64. - (void)deleteMessages:(NSArray<TUIMessageCellData *> *)uiMsgs;
  65. /**
  66. * Conversation read report
  67. *
  68. */
  69. - (void)readReport;
  70. /**
  71. * Subclass implements click-to-reply messages
  72. */
  73. - (void)showReplyMessage:(TUIReplyMessageCell *)cell;
  74. - (void)willShowMediaMessage:(TUIMessageCell *)cell;
  75. - (void)didCloseMediaMessage:(TUIMessageCell *)cell;
  76. // Reload the specific cell UI.
  77. - (void)reloadCellOfMessage:(NSString *)messageID;
  78. - (void)reloadAndScrollToBottomOfMessage:(NSString *)messageID;
  79. - (void)scrollCellToBottomOfMessage:(NSString *)messageID;
  80. - (void)loadGroupInfo;
  81. - (BOOL)isCurrentUserRoleSuperAdminInGroup;
  82. - (BOOL)isCurrentMessagePin:(NSString *)msgID;
  83. - (void)unPinGroupMessage:(V2TIMMessage *)innerMessage;
  84. - (CGFloat)getHeightFromMessageCellData:(TUIMessageCellData *)cellData;
  85. @end
  86. NS_ASSUME_NONNULL_END