TUIBaseMessageControllerDelegate.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. // Created by Tencent on 2023/06/09.
  2. // Copyright © 2023 Tencent. All rights reserved.
  3. #import <Foundation/Foundation.h>
  4. @import ImSDK_Plus;
  5. @class TUIBaseMessageController;
  6. @class TUIMessageCellData;
  7. @class TUIMessageCell;
  8. NS_ASSUME_NONNULL_BEGIN
  9. /////////////////////////////////////////////////////////////////////////////////
  10. //
  11. // TUIBaseMessageControllerDelegate
  12. //
  13. /////////////////////////////////////////////////////////////////////////////////
  14. @protocol TUIBaseMessageControllerDelegate <NSObject>
  15. /**
  16. * 控制器点击回调
  17. * 您可以通过该回调实现:重置 InputController,收起键盘。
  18. *
  19. * @param controller 委托者,消息控制器
  20. */
  21. /**
  22. * Callback for clicking controller
  23. * You can use this callback to: reset the InputController, dismiss the keyboard.
  24. *
  25. * @param controller Delegator, Message Controller
  26. */
  27. - (void)didTapInMessageController:(TUIBaseMessageController *)controller;
  28. /**
  29. * 隐藏长按菜单后的回调函数
  30. * 您可以根据您的需求个性化实现该委托函数。
  31. *
  32. * @param controller 委托者,消息控制器
  33. */
  34. /**
  35. * Callback after hide long press menu button
  36. * You can customize the implementation of this delegate function according to your needs.
  37. *
  38. * @param controller Delegator, Message Controller
  39. */
  40. - (void)didHideMenuInMessageController:(TUIBaseMessageController *)controller;
  41. /**
  42. * 显示长按菜单前的回调函数
  43. * 您可以根据您的需求个性化实现该委托函数。
  44. *
  45. * @param controller 委托者,消息控制器
  46. * @param view 控制器所在view
  47. */
  48. /**
  49. * Callback before hide long press menu button
  50. * You can customize the implementation of this delegate function according to your needs.
  51. *
  52. * @param controller Delegator, Message Controller
  53. * @param view The view where the controller is located
  54. */
  55. - (BOOL)messageController:(TUIBaseMessageController *)controller willShowMenuInCell:(UIView *)view;
  56. /**
  57. * 收到新消息的函数委托
  58. * 您可以通过该回调实现:根据传入的 data 初始化新消息并进行新消息提醒。
  59. *
  60. * @param controller 委托者,消息控制器
  61. * @param message 新消息
  62. *
  63. * @return 返回需要显示的新消息单元
  64. */
  65. /**
  66. * Callback for receiving new message
  67. * You can use this callback to initialize a new message based on the incoming data and perform a new message reminder.
  68. *
  69. * @param controller Delegator, Message Controller
  70. * @param message Incoming new message
  71. *
  72. * @return Returns the new message unit that needs to be displayed.
  73. */
  74. - (TUIMessageCellData *)messageController:(TUIBaseMessageController *)controller onNewMessage:(V2TIMMessage *)message;
  75. /**
  76. * 显示消息数据委托
  77. * 您可以通过该回调实现:根据传入的 data 初始化消息气泡并进行显示
  78. *
  79. * @param controller 委托者,消息控制器
  80. * @param data 需要显示的消息数据
  81. *
  82. * @return 返回需要显示的消息单元。
  83. */
  84. /**
  85. * Callback for displaying new message
  86. * You can use this callback to initialize the message bubble based on the incoming data and display it
  87. *
  88. * @param controller Delegator, Message Controller
  89. * @param data Data needed to display
  90. *
  91. * @return Returns the new message unit that needs to be displayed.。
  92. */
  93. - (TUIMessageCell *)messageController:(TUIBaseMessageController *)controller onShowMessageData:(TUIMessageCellData *)data;
  94. /**
  95. * cell 将要显示事件
  96. * The callback the cell will be displayed with
  97. */
  98. - (void)messageController:(TUIBaseMessageController *)controller willDisplayCell:(TUIMessageCell *)cell withData:(TUIMessageCellData *)cellData;
  99. /**
  100. * 点击消息头像委托
  101. * 您可以通过该回调实现:跳转到对应用户的详细信息界面。
  102. * 1、首先拉取用户信息,如果该用户是当前使用者好友,则初始化相应的好友信息界面并进行跳转。
  103. * 2、如果该用户不是当前使用者好友,则初始化相应的添加好友界面并进行跳转。
  104. *
  105. * Callback for clicking avatar in the message cell
  106. * You can use this callback to achieve: jump to the detailed information interface of the corresponding user.
  107. * 1. First pull user information, if the user is a friend of the current user, initialize the corresponding friend information interface and jump.
  108. * 2. If the user is not a friend of the current user, the corresponding interface for adding friends is initialized and a jump is performed.
  109. *
  110. */
  111. - (void)messageController:(TUIBaseMessageController *)controller onSelectMessageAvatar:(TUIMessageCell *)cell;
  112. /**
  113. * 长按消息头像委托
  114. * Callback for long pressing avatar in the message cell
  115. */
  116. - (void)messageController:(TUIBaseMessageController *)controller onLongSelectMessageAvatar:(TUIMessageCell *)cell;
  117. /**
  118. * 点击消息内容委托
  119. * Callback for clicking message content in the message cell
  120. */
  121. - (void)messageController:(TUIBaseMessageController *)controller onSelectMessageContent:(TUIMessageCell *)cell;
  122. /**
  123. * 长按消息内容弹窗菜单栏,点击菜单选项
  124. * menuType:点击的菜单类型。 0 - 多选,1 - 转发。
  125. *
  126. * After long-pressing the message, the menu bar will pop up, and the callback after clicking the menu option
  127. * menuType: The type of menu that was clicked. 0 - multiple choice, 1 - forwarding.
  128. */
  129. - (void)messageController:(TUIBaseMessageController *)controller onSelectMessageMenu:(NSInteger)menuType withData:(TUIMessageCellData *)data;
  130. /**
  131. * 即将回复消息(一般是长按消息内容后点击回复按钮触发)
  132. * Callback for about to reply to the message (usually triggered by long-pressing the message content and then clicking the reply button)
  133. */
  134. - (void)messageController:(TUIBaseMessageController *)controller onRelyMessage:(TUIMessageCellData *)data;
  135. /**
  136. * 引用消息(长按消息内容后点击引用按钮)
  137. * Callback for quoting message (triggered by long-pressing the message content and then clicking the quote button)
  138. */
  139. - (void)messageController:(TUIBaseMessageController *)controller onReferenceMessage:(TUIMessageCellData *)data;
  140. /**
  141. * 表情回应消息(一般是长按消息内容后点击emoji表情触发)
  142. * Callback for emoji-reacting message (triggered by long-pressing the message content and then clicking the emoji)
  143. */
  144. - (void)messageController:(TUIBaseMessageController *)controller modifyMessage:(nonnull TUIMessageCellData *)cellData reactEmoji:(NSString *)emojiName;
  145. /**
  146. * 重新编辑消息(一般用于撤回消息)
  147. * Callback for re-editing message (usually for re-calling a message)
  148. */
  149. - (void)messageController:(TUIBaseMessageController *)controller onReEditMessage:(TUIMessageCellData *)data;
  150. /// Forward text.
  151. - (void)messageController:(TUIBaseMessageController *)controller onForwardText:(NSString *)text;
  152. /**
  153. * 拿到自定义Tips的高度(例如Demo中的安全提示)
  154. * Get the height of custom Tips (such as safety tips in Demo)
  155. */
  156. - (CGFloat)getTopMarginByCustomView;
  157. // 自定义错误消息发送回调
  158. - (void)messageController:(TUIBaseMessageController *)controller sendMsgError:(int)code desc:(NSString *)desc;
  159. @end
  160. NS_ASSUME_NONNULL_END