TUIChatConfig_Minimalist.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. //
  2. // TUIChatConfig_Minimalist.h
  3. // TUIChat
  4. //
  5. // Created by Tencent on 2024/7/16.
  6. // Copyright © 2024 Tencent. All rights reserved.
  7. #import <Foundation/Foundation.h>
  8. #import "UIAlertController+TUICustomStyle.h"
  9. #import "TUIChatShortcutMenuView.h"
  10. #import <TIMCommon/TIMCommonModel.h>
  11. #import <TIMCommon/TUIMessageCellLayout.h>
  12. #import "TUIChatConfig.h"
  13. NS_ASSUME_NONNULL_BEGIN
  14. @class TUIMessageCellData;
  15. typedef NS_ENUM(NSInteger, TUIAvatarStyle_Minimalist) {
  16. TUIAvatarStyleRectangle_Minimalist,
  17. TUIAvatarStyleCircle_Minimalist,
  18. TUIAvatarStyleRoundedRectangle_Minimalist,
  19. };
  20. typedef NS_OPTIONS(NSInteger, TUIChatItemWhenLongPressMessage_Minimalist) {
  21. TUIChatItemWhenLongPressMessage_Minimalist_None = 0,
  22. TUIChatItemWhenLongPressMessage_Minimalist_Reply = 1 << 0,
  23. TUIChatItemWhenLongPressMessage_Minimalist_EmojiReaction = 1 << 1,
  24. TUIChatItemWhenLongPressMessage_Minimalist_Quote = 1 << 2,
  25. TUIChatItemWhenLongPressMessage_Minimalist_Pin = 1 << 3,
  26. TUIChatItemWhenLongPressMessage_Minimalist_Recall = 1 << 4,
  27. TUIChatItemWhenLongPressMessage_Minimalist_Translate = 1 << 5,
  28. TUIChatItemWhenLongPressMessage_Minimalist_Convert = 1 << 6,
  29. TUIChatItemWhenLongPressMessage_Minimalist_Forward = 1 << 7,
  30. TUIChatItemWhenLongPressMessage_Minimalist_Select = 1 << 8,
  31. TUIChatItemWhenLongPressMessage_Minimalist_Copy = 1 << 9,
  32. TUIChatItemWhenLongPressMessage_Minimalist_Delete = 1 << 10,
  33. TUIChatItemWhenLongPressMessage_Minimalist_Info = 1 << 11,
  34. };
  35. @protocol TUIChatConfigDelegate_Minimalist <NSObject>
  36. /**
  37. * Tells the delegate a user's avatar in the chat list is clicked.
  38. * Returning YES indicates this event has been intercepted, and Chat will not process it further.
  39. * Returning NO indicates this event is not intercepted, and Chat will continue to process it.
  40. */
  41. - (BOOL)onUserAvatarClicked:(UIView *)view messageCellData:(TUIMessageCellData *)celldata;
  42. /**
  43. * Tells the delegate a user's avatar in the chat list is long pressed.
  44. * Returning YES indicates that this event has been intercepted, and Chat will not process it further.
  45. * Returning NO indicates that this event is not intercepted, and Chat will continue to process it.
  46. */
  47. - (BOOL)onUserAvatarLongPressed:(UIView *)view messageCellData:(TUIMessageCellData *)celldata;
  48. /**
  49. * Tells the delegate a message in the chat list is clicked.
  50. * Returning YES indicates that this event has been intercepted, and Chat will not process it further.
  51. * Returning NO indicates that this event is not intercepted, and Chat will continue to process it.
  52. */
  53. - (BOOL)onMessageClicked:(UIView *)view messageCellData:(TUIMessageCellData *)celldata;
  54. /**
  55. * Tells the delegate a message in the chat list is long pressed.
  56. * Returning YES indicates that this event has been intercepted, and Chat will not process it further.
  57. * Returning NO indicates that this event is not intercepted, and Chat will continue to process it.
  58. */
  59. - (BOOL)onMessageLongPressed:(UIView *)view messageCellData:(TUIMessageCellData *)celldata;
  60. @end
  61. @interface TUIChatConfig_Minimalist : NSObject
  62. + (TUIChatConfig_Minimalist *)sharedConfig;
  63. /**
  64. * The object that acts as the delegate of the TUIChatMessageConfig_Minimalist.
  65. */
  66. @property (nonatomic, weak) id<TUIChatConfigDelegate_Minimalist> delegate;
  67. /**
  68. * Customize the backgroud color of message list interface.
  69. * This configuration takes effect in all message list interfaces.
  70. */
  71. @property (nonatomic, strong) UIColor *backgroudColor;
  72. /**
  73. * Customize the backgroud image of message list interface.
  74. * This configuration takes effect in all message list interfaces.
  75. */
  76. @property (nonatomic, strong) UIImage *backgroudImage;
  77. /**
  78. * Customize the style of avatar.
  79. * The default value is TUIAvatarStyleCircle.
  80. * This configuration takes effect in all avatars.
  81. */
  82. @property (nonatomic, assign) TUIAvatarStyle_Minimalist avatarStyle;
  83. /**
  84. * Customize the corner radius of the avatar.
  85. * This configuration takes effect in all avatars.
  86. */
  87. @property (nonatomic, assign) CGFloat avatarCornerRadius;
  88. /**
  89. * Display the group avatar in the nine-square grid style.
  90. * The default value is YES.
  91. * This configuration takes effect in all groups.
  92. */
  93. @property (nonatomic, assign) BOOL enableGroupGridAvatar;
  94. /**
  95. * Default avatar image.
  96. * This configuration takes effect in all avatars.
  97. */
  98. @property (nonatomic, strong) UIImage *defaultAvatarImage;
  99. /**
  100. * Enable the display "Alice is typing..." on one-to-one chat interface.
  101. * The default value is YES.
  102. * This configuration takes effect in all one-to-one chat message list interfaces.
  103. */
  104. @property (nonatomic, assign) BOOL enableTypingIndicator;
  105. /**
  106. * When sending a message, set this flag to require message read receipt.
  107. * The default value is NO.
  108. * This configuration takes effect in all chat message list interfaces.
  109. */
  110. @property (nonatomic, assign) BOOL isMessageReadReceiptNeeded;
  111. /**
  112. * Hide the "Video Call" button in the message list header.
  113. * The default value is NO.
  114. */
  115. @property (nonatomic, assign) BOOL hideVideoCallButton;
  116. /**
  117. * Hide the "Audio Call" button in the message list header.
  118. * The default value is NO.
  119. */
  120. @property (nonatomic, assign) BOOL hideAudioCallButton;
  121. /**
  122. * Turn on audio and video call floating windows,
  123. * The default value is YES.
  124. */
  125. @property (nonatomic, assign) BOOL enableFloatWindowForCall;
  126. /**
  127. * Enable multi-terminal login function for audio and video calls
  128. * The default value is NO.
  129. */
  130. @property (nonatomic, assign) BOOL enableMultiDeviceForCall;
  131. /**
  132. * Set this parameter when the sender sends a message, and the receiver will not update the unread count after receiving the message.
  133. * The default value is NO.
  134. */
  135. @property (nonatomic, assign) BOOL isExcludedFromUnreadCount;
  136. /**
  137. * Set this parameter when the sender sends a message, and the receiver will not update the last message of the conversation after receiving the message.
  138. * The default value is NO.
  139. */
  140. @property (nonatomic, assign) BOOL isExcludedFromLastMessage;
  141. /**
  142. * Time interval within which a message can be recalled after being sent.
  143. * The default value is 120 seconds.
  144. * If you want to adjust this configuration, please modify the setting on Chat Console synchronously: https://trtc.io/document/34419?platform=web&product=chat&menulabel=uikit#message-recall-settings
  145. */
  146. @property (nonatomic, assign) NSUInteger timeIntervalForAllowedMessageRecall;
  147. /**
  148. * Maximum audio recording duration, no more than 60s.
  149. * The default value is 60 seconds.
  150. */
  151. @property (nonatomic, assign) CGFloat maxAudioRecordDuration;
  152. /**
  153. * Maximum video recording duration, no more than 15s.
  154. * The default value is 15 seconds.
  155. */
  156. @property (nonatomic, assign) CGFloat maxVideoRecordDuration;
  157. /**
  158. * Enable custom ringtone.
  159. * This config takes effect only for Android devices.
  160. */
  161. @property (nonatomic, assign) BOOL enableAndroidCustomRing;
  162. /**
  163. * Hide the items in the pop-up menu when user presses the message.
  164. */
  165. + (void)hideItemsWhenLongPressMessage:(TUIChatItemWhenLongPressMessage_Minimalist)items;
  166. /**
  167. * Call this method to use speakers instead of handsets by default when playing voice messages.
  168. */
  169. + (void)setPlayingSoundMessageViaSpeakerByDefault;
  170. /**
  171. * Add a custom view at the top of the chat interface.
  172. * This view will be displayed at the top of the message list and will not slide up.
  173. */
  174. + (void)setCustomTopView:(UIView *)view;
  175. /**
  176. * Register custom message.
  177. * - Parameters:
  178. * - businessID: Customized message‘s businessID, which is unique.
  179. * - cellName: Customized message's MessagCell class name.
  180. * - cellDataName: Customized message's MessagCellData class name.
  181. */
  182. - (void)registerCustomMessage:(NSString *)businessID
  183. messageCellClassName:(NSString *)cellName
  184. messageCellDataClassName:(NSString *)cellDataName;
  185. @end
  186. @interface TUIChatConfig_Minimalist (MessageStyle)
  187. /**
  188. * The color of send text message.
  189. */
  190. @property(nonatomic, assign) UIColor *sendTextMessageColor;
  191. /**
  192. * The font of send text message.
  193. */
  194. @property(nonatomic, assign) UIFont *sendTextMessageFont;
  195. /**
  196. * The color of receive text message.
  197. */
  198. @property(nonatomic, assign) UIColor *receiveTextMessageColor;
  199. /**
  200. * The font of receive text message.
  201. */
  202. @property(nonatomic, assign) UIFont *receiveTextMessageFont;
  203. /**
  204. * The text color of system message.
  205. */
  206. @property (nonatomic, strong) UIColor *systemMessageTextColor;
  207. /**
  208. * The font of system message.
  209. */
  210. @property (nonatomic, strong) UIFont *systemMessageTextFont;
  211. /**
  212. * The background color of system message.
  213. */
  214. @property (nonatomic, strong) UIColor *systemMessageBackgroundColor;
  215. @end
  216. @interface TUIChatConfig_Minimalist (MessageLayout)
  217. /**
  218. * Text message cell layout of my sent message.
  219. */
  220. @property(nonatomic, assign, readonly) TUIMessageCellLayout *sendTextMessageLayout;
  221. /**
  222. * Text message cell layout of my received message.
  223. */
  224. @property(nonatomic, assign, readonly) TUIMessageCellLayout *receiveTextMessageLayout;
  225. /**
  226. * Image message cell layout of my sent message.
  227. */
  228. @property(nonatomic, assign, readonly) TUIMessageCellLayout *sendImageMessageLayout;
  229. /**
  230. * Image message cell layout of my received message.
  231. */
  232. @property(nonatomic, assign, readonly) TUIMessageCellLayout *receiveImageMessageLayout;
  233. /**
  234. * Voice message cell layout of my sent message.
  235. */
  236. @property(nonatomic, assign, readonly) TUIMessageCellLayout *sendVoiceMessageLayout;
  237. /**
  238. * Voice message cell layout of my received message.
  239. */
  240. @property(nonatomic, assign, readonly) TUIMessageCellLayout *receiveVoiceMessageLayout;
  241. /**
  242. * Video message cell layout of my sent message.
  243. */
  244. @property(nonatomic, assign, readonly) TUIMessageCellLayout *sendVideoMessageLayout;
  245. /**
  246. * Video message cell layout of my received message.
  247. */
  248. @property(nonatomic, assign, readonly) TUIMessageCellLayout *receiveVideoMessageLayout;
  249. /**
  250. * Other message cell layout of my sent message.
  251. */
  252. @property(nonatomic, assign, readonly) TUIMessageCellLayout *sendMessageLayout;
  253. /**
  254. * Other message cell layout of my received message.
  255. */
  256. @property(nonatomic, assign, readonly) TUIMessageCellLayout *receiveMessageLayout;
  257. /**
  258. * System message cell layout.
  259. */
  260. @property(nonatomic, assign, readonly) TUIMessageCellLayout *systemMessageLayout;
  261. @end
  262. @interface TUIChatConfig_Minimalist (MessageBubble)
  263. /**
  264. * Enable the message display in the bubble style.
  265. * The default value is YES.
  266. */
  267. @property(nonatomic, assign) BOOL enableMessageBubbleStyle;
  268. /**
  269. * Set the background image of the last sent message bubble in consecutive messages.
  270. */
  271. @property (nonatomic, strong) UIImage *sendLastBubbleBackgroundImage;
  272. /**
  273. * Set the background image of the non-last sent message bubble in consecutive message.
  274. */
  275. @property (nonatomic, strong) UIImage *sendBubbleBackgroundImage;
  276. /**
  277. * Set the background image of the sent message bubble in highlight status.
  278. */
  279. @property (nonatomic, strong) UIImage *sendHighlightBubbleBackgroundImage;
  280. /**
  281. * Set the light background image when the sent message bubble needs to flicker.
  282. */
  283. @property (nonatomic, strong) UIImage *sendAnimateLightBubbleBackgroundImage;
  284. /**
  285. * Set the dark background image when the sent message bubble needs to flicker.
  286. */
  287. @property (nonatomic, strong) UIImage *sendAnimateDarkBubbleBackgroundImage;
  288. /**
  289. * Set the background image of the last received message bubble in consecutive message.
  290. */
  291. @property (nonatomic, strong) UIImage *receiveLastBubbleBackgroundImage;
  292. /**
  293. * Set the background image of the non-last received message bubble in consecutive message.
  294. */
  295. @property (nonatomic, strong) UIImage *receiveBubbleBackgroundImage;
  296. /**
  297. * Set the background image of the received message bubble in highlight status.
  298. */
  299. @property (nonatomic, strong) UIImage *receiveHighlightBubbleBackgroundImage;
  300. /**
  301. * Set the light background image when the received message bubble needs to flicker.
  302. */
  303. @property (nonatomic, strong) UIImage *receiveAnimateLightBubbleBackgroundImage;
  304. /**
  305. * Set the dark background image when the received message bubble needs to flicker.
  306. */
  307. @property (nonatomic, strong) UIImage *receiveAnimateDarkBubbleBackgroundImage;
  308. @end
  309. @interface TUIChatConfig_Minimalist (InputBar)
  310. /**
  311. * DataSource for inputBar.
  312. */
  313. @property (nonatomic, weak) id<TUIChatInputBarConfigDataSource> inputBarDataSource;
  314. /**
  315. * Show the input bar in the message list interface.
  316. * The default value is YES.
  317. */
  318. @property(nonatomic, assign) BOOL showInputBar;
  319. /**
  320. * Hide items in more menu.
  321. */
  322. + (void)hideItemsInMoreMenu:(TUIChatInputBarMoreMenuItem)items;
  323. /**
  324. * Add sticker group.
  325. */
  326. - (void)addStickerGroup:(TUIFaceGroup *)group;
  327. @end
  328. NS_ASSUME_NONNULL_END