TUIChatConfig_Classic.m 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. //
  2. // TUIChatConfig_Classic.m
  3. // TUIChat
  4. //
  5. // Created by Tencent on 2024/7/16.
  6. // Copyright © 2024 Tencent. All rights reserved.
  7. #import "TUIChatConfig_Classic.h"
  8. #import <TUICore/TUIConfig.h>
  9. #import <TIMCommon/TUIBubbleMessageCell.h>
  10. #import <TIMCommon/TUISystemMessageCellData.h>
  11. #import <TIMCommon/TUIMessageCell.h>
  12. #import <TIMCommon/TIMConfig.h>
  13. #import <TIMCommon/TIMCommonMediator.h>
  14. #import <TIMCommon/TUIEmojiMeditorProtocol.h>
  15. #import "TUIBaseChatViewController.h"
  16. #import "TUITextMessageCell.h"
  17. #import "TUIEmojiConfig.h"
  18. #import "TUIChatConversationModel.h"
  19. #import "TUIVoiceMessageCellData.h"
  20. @interface TUIChatConfig_Classic()<TUIChatEventListener>
  21. @end
  22. @implementation TUIChatConfig_Classic
  23. + (TUIChatConfig_Classic *)sharedConfig {
  24. static dispatch_once_t onceToken;
  25. static TUIChatConfig_Classic *config;
  26. dispatch_once(&onceToken, ^{
  27. config = [[TUIChatConfig_Classic alloc] init];
  28. });
  29. return config;
  30. }
  31. - (instancetype)init {
  32. self = [super init];
  33. if (self) {
  34. TUIChatConfig.defaultConfig.eventConfig.chatEventListener = self;
  35. }
  36. return self;
  37. }
  38. - (void)setEnableTypingIndicator:(BOOL)enable {
  39. [TUIChatConfig defaultConfig].enableTypingStatus = enable;
  40. }
  41. - (BOOL)enableTypingIndicator {
  42. return [TUIChatConfig defaultConfig].enableTypingStatus;
  43. }
  44. - (void)setBackgroudColor:(UIColor *)backgroudColor {
  45. [TUIChatConfig defaultConfig].backgroudColor = backgroudColor;
  46. }
  47. - (UIColor *)backgroudColor {
  48. return [TUIChatConfig defaultConfig].backgroudColor;
  49. }
  50. - (void)setBackgroudImage:(UIImage *)backgroudImage {
  51. [TUIChatConfig defaultConfig].backgroudImage = backgroudImage;
  52. }
  53. - (UIImage *)backgroudImage {
  54. return [TUIChatConfig defaultConfig].backgroudImage;
  55. }
  56. - (void)setAvatarStyle:(TUIAvatarStyle_Classic)avatarStyle {
  57. [TUIConfig defaultConfig].avatarType = (TUIKitAvatarType)avatarStyle;
  58. }
  59. - (TUIAvatarStyle_Classic)avatarStyle {
  60. return (TUIAvatarStyle_Classic)[TUIConfig defaultConfig].avatarType;
  61. }
  62. - (void)setAvatarCornerRadius:(CGFloat)avatarCornerRadius {
  63. [TUIConfig defaultConfig].avatarCornerRadius = avatarCornerRadius;
  64. }
  65. - (CGFloat)avatarCornerRadius {
  66. return [TUIConfig defaultConfig].avatarCornerRadius;
  67. }
  68. - (void)setDefaultAvatarImage:(UIImage *)defaultAvatarImage {
  69. [TUIConfig defaultConfig].defaultAvatarImage = defaultAvatarImage;
  70. }
  71. - (UIImage *)defaultAvatarImage {
  72. return [TUIConfig defaultConfig].defaultAvatarImage;
  73. }
  74. - (void)setEnableGroupGridAvatar:(BOOL)enableGroupGridAvatar {
  75. [TUIConfig defaultConfig].enableGroupGridAvatar = enableGroupGridAvatar;
  76. }
  77. - (BOOL)enableGroupGridAvatar {
  78. return [TUIConfig defaultConfig].enableGroupGridAvatar;
  79. }
  80. - (void)setIsMessageReadReceiptNeeded:(BOOL)isMessageReadReceiptNeeded {
  81. [TUIChatConfig defaultConfig].msgNeedReadReceipt = isMessageReadReceiptNeeded;
  82. }
  83. - (BOOL)isMessageReadReceiptNeeded {
  84. return [TUIChatConfig defaultConfig].msgNeedReadReceipt;
  85. }
  86. - (void)setTimeIntervalForAllowedMessageRecall:(NSUInteger)timeIntervalForAllowedMessageRecall {
  87. [TUIChatConfig defaultConfig].timeIntervalForMessageRecall = timeIntervalForAllowedMessageRecall;
  88. }
  89. - (NSUInteger)timeIntervalForAllowedMessageRecall {
  90. return [TUIChatConfig defaultConfig].timeIntervalForMessageRecall;
  91. }
  92. - (void)setEnableFloatWindowForCall:(BOOL)enableFloatWindowForCall {
  93. [TUIChatConfig defaultConfig].enableFloatWindowForCall = enableFloatWindowForCall;
  94. }
  95. - (BOOL)enableFloatWindowForCall {
  96. return [TUIChatConfig defaultConfig].enableFloatWindowForCall;
  97. }
  98. - (void)setEnableMultiDeviceForCall:(BOOL)enableMultiDeviceForCall {
  99. [TUIChatConfig defaultConfig].enableMultiDeviceForCall = enableMultiDeviceForCall;
  100. }
  101. - (BOOL)enableMultiDeviceForCall {
  102. return [TUIChatConfig defaultConfig].enableMultiDeviceForCall;
  103. }
  104. - (void)setHideVideoCallButton:(BOOL)hideVideoCallButton {
  105. [TUIChatConfig defaultConfig].enableVideoCall = !hideVideoCallButton;
  106. }
  107. - (void)setEnableAndroidCustomRing:(BOOL)enableAndroidCustomRing {
  108. [TUIConfig defaultConfig].enableCustomRing = enableAndroidCustomRing;
  109. }
  110. - (BOOL)enableAndroidCustomRing {
  111. return [TUIConfig defaultConfig].enableCustomRing;
  112. }
  113. - (BOOL)hideVideoCallButton {
  114. return ![TUIChatConfig defaultConfig].enableVideoCall;
  115. }
  116. - (void)setHideAudioCallButton:(BOOL)hideAudioCallButton {
  117. [TUIChatConfig defaultConfig].enableAudioCall = !hideAudioCallButton;
  118. }
  119. - (BOOL)hideAudioCallButton {
  120. return ![TUIChatConfig defaultConfig].enableAudioCall;
  121. }
  122. + (void)hideItemsWhenLongPressMessage:(TUIChatItemWhenLongPressMessage_Classic)items {
  123. [TUIChatConfig defaultConfig].enablePopMenuReplyAction = !(items & TUIChatItemWhenLongPressMessage_Classic_Reply);
  124. [TUIChatConfig defaultConfig].enablePopMenuEmojiReactAction = !(items & TUIChatItemWhenLongPressMessage_Classic_EmojiReaction);
  125. [TUIChatConfig defaultConfig].enablePopMenuReferenceAction = !(items & TUIChatItemWhenLongPressMessage_Classic_Quote);
  126. [TUIChatConfig defaultConfig].enablePopMenuPinAction = !(items & TUIChatItemWhenLongPressMessage_Classic_Pin);
  127. [TUIChatConfig defaultConfig].enablePopMenuRecallAction = !(items & TUIChatItemWhenLongPressMessage_Classic_Recall);
  128. [TUIChatConfig defaultConfig].enablePopMenuTranslateAction = !(items & TUIChatItemWhenLongPressMessage_Classic_Translate);
  129. [TUIChatConfig defaultConfig].enablePopMenuConvertAction = !(items & TUIChatItemWhenLongPressMessage_Classic_Convert);
  130. [TUIChatConfig defaultConfig].enablePopMenuForwardAction = !(items & TUIChatItemWhenLongPressMessage_Classic_Forward);
  131. [TUIChatConfig defaultConfig].enablePopMenuSelectAction = !(items & TUIChatItemWhenLongPressMessage_Classic_Select);
  132. [TUIChatConfig defaultConfig].enablePopMenuCopyAction = !(items & TUIChatItemWhenLongPressMessage_Classic_Copy);
  133. [TUIChatConfig defaultConfig].enablePopMenuDeleteAction = !(items & TUIChatItemWhenLongPressMessage_Classic_Delete);
  134. }
  135. - (void)setIsExcludedFromUnreadCount:(BOOL)isExcludedFromUnreadCount {
  136. [TUIConfig defaultConfig].isExcludedFromUnreadCount = isExcludedFromUnreadCount;
  137. }
  138. - (BOOL)isExcludedFromUnreadCount {
  139. return [TUIConfig defaultConfig].isExcludedFromUnreadCount;
  140. }
  141. - (void)setIsExcludedFromLastMessage:(BOOL)isExcludedFromLastMessage {
  142. [TUIConfig defaultConfig].isExcludedFromLastMessage = isExcludedFromLastMessage;
  143. }
  144. - (BOOL)isExcludedFromLastMessage {
  145. return [TUIConfig defaultConfig].isExcludedFromLastMessage;
  146. }
  147. - (void)setMaxAudioRecordDuration:(CGFloat)maxAudioRecordDuration {
  148. [TUIChatConfig defaultConfig].maxAudioRecordDuration = maxAudioRecordDuration;
  149. }
  150. - (CGFloat)maxAudioRecordDuration {
  151. return [TUIChatConfig defaultConfig].maxAudioRecordDuration;
  152. }
  153. - (void)setMaxVideoRecordDuration:(CGFloat)maxVideoRecordDuration {
  154. [TUIChatConfig defaultConfig].maxVideoRecordDuration = maxVideoRecordDuration;
  155. }
  156. - (CGFloat)maxVideoRecordDuration {
  157. return [TUIChatConfig defaultConfig].maxVideoRecordDuration;
  158. }
  159. + (void)setPlayingSoundMessageViaSpeakerByDefault {
  160. if ([TUIVoiceMessageCellData getAudioplaybackStyle] == TUIVoiceAudioPlaybackStyleHandset) {
  161. [TUIVoiceMessageCellData changeAudioPlaybackStyle];
  162. }
  163. }
  164. + (void)setCustomTopView:(UIView *)view {
  165. [TUIBaseChatViewController setCustomTopView:view];
  166. }
  167. - (void)registerCustomMessage:(NSString *)businessID
  168. messageCellClassName:(NSString *)cellName
  169. messageCellDataClassName:(NSString *)cellDataName {
  170. [[TUIChatConfig defaultConfig] registerCustomMessage:businessID
  171. messageCellClassName:cellName
  172. messageCellDataClassName:cellDataName];
  173. }
  174. #pragma mark - TUIChatEventListener
  175. - (BOOL)onUserIconClicked:(UIView *)view messageCellData:(TUIMessageCellData *)celldata {
  176. if ([self.delegate respondsToSelector:@selector(onUserAvatarClicked:messageCellData:)]) {
  177. return [self.delegate onUserAvatarClicked:view messageCellData:celldata];
  178. }
  179. return NO;
  180. }
  181. - (BOOL)onUserIconLongClicked:(UIView *)view messageCellData:(TUIMessageCellData *)celldata {
  182. if ([self.delegate respondsToSelector:@selector(onUserAvatarLongPressed:messageCellData:)]) {
  183. return [self.delegate onUserAvatarLongPressed:view messageCellData:celldata];
  184. }
  185. return NO;
  186. }
  187. - (BOOL)onMessageClicked:(UIView *)view messageCellData:(TUIMessageCellData *)celldata {
  188. if ([self.delegate respondsToSelector:@selector(onMessageClicked:messageCellData:)]) {
  189. return [self.delegate onMessageClicked:view messageCellData:celldata];
  190. }
  191. return NO;
  192. }
  193. - (BOOL)onMessageLongClicked:(UIView *)view messageCellData:(TUIMessageCellData *)celldata {
  194. if ([self.delegate respondsToSelector:@selector(onMessageLongPressed:messageCellData:)]) {
  195. return [self.delegate onMessageLongPressed:view messageCellData:celldata];
  196. }
  197. return NO;
  198. }
  199. @end
  200. @implementation TUIChatConfig_Classic (MessageStyle)
  201. - (void)setSendNicknameFont:(UIFont *)sendNicknameFont {
  202. TUIMessageCell.outgoingNameFont = sendNicknameFont;
  203. }
  204. - (UIFont *)sendNicknameFont {
  205. return TUIMessageCell.outgoingNameFont;
  206. }
  207. - (void)setReceiveNicknameFont:(UIFont *)receiveNicknameFont {
  208. TUIMessageCell.incommingNameFont = receiveNicknameFont;
  209. }
  210. - (UIFont *)receiveNicknameFont {
  211. return TUIMessageCell.incommingNameFont;
  212. }
  213. - (void)setSendNicknameColor:(UIColor *)sendNicknameColor {
  214. TUIMessageCell.outgoingNameColor = sendNicknameColor;
  215. }
  216. - (UIColor *)sendNicknameColor {
  217. return TUIMessageCell.outgoingNameColor;
  218. }
  219. - (void)setReceiveNicknameColor:(UIColor *)receiveNicknameColor {
  220. TUIMessageCell.incommingNameColor = receiveNicknameColor;
  221. }
  222. - (UIColor *)receiveNicknameColor {
  223. return TUIMessageCell.incommingNameColor;
  224. }
  225. - (void)setSendTextMessageFont:(UIFont *)sendTextMessageFont {
  226. TUITextMessageCell.outgoingTextFont = sendTextMessageFont;
  227. }
  228. - (UIFont *)sendTextMessageFont {
  229. return TUITextMessageCell.outgoingTextFont;
  230. }
  231. - (void)setReceiveTextMessageFont:(UIFont *)receiveTextMessageFont {
  232. TUITextMessageCell.incommingTextFont = receiveTextMessageFont;
  233. }
  234. - (UIFont *)receiveTextMessageFont {
  235. return TUITextMessageCell.incommingTextFont;
  236. }
  237. - (void)setSendTextMessageColor:(UIColor *)sendTextMessageColor {
  238. TUITextMessageCell.outgoingTextColor = sendTextMessageColor;
  239. }
  240. - (UIColor *)sendTextMessageColor {
  241. return TUITextMessageCell.outgoingTextColor;
  242. }
  243. - (void)setReceiveTextMessageColor:(UIColor *)receiveTextMessageColor {
  244. TUITextMessageCell.incommingTextColor = receiveTextMessageColor;
  245. }
  246. - (UIColor *)receiveTextMessageColor {
  247. return TUITextMessageCell.incommingTextColor;
  248. }
  249. @end
  250. typedef NS_ENUM(NSInteger, UIMessageCellLayoutType) {
  251. UIMessageCellLayoutTypeText,
  252. UIMessageCellLayoutTypeImage,
  253. UIMessageCellLayoutTypeVideo,
  254. UIMessageCellLayoutTypeVoice,
  255. UIMessageCellLayoutTypeOther,
  256. UIMessageCellLayoutTypeSystem
  257. };
  258. @implementation TUIChatConfig_Classic (MessageLayout)
  259. - (TUIMessageCellLayout *)sendTextMessageLayout {
  260. return [self getMessageLayoutOfType:UIMessageCellLayoutTypeText isSender:YES];
  261. }
  262. - (TUIMessageCellLayout *)receiveTextMessageLayout {
  263. return [self getMessageLayoutOfType:UIMessageCellLayoutTypeText isSender:NO];
  264. }
  265. - (TUIMessageCellLayout *)sendImageMessageLayout {
  266. return [self getMessageLayoutOfType:UIMessageCellLayoutTypeImage isSender:YES];
  267. }
  268. - (TUIMessageCellLayout *)receiveImageMessageLayout {
  269. return [self getMessageLayoutOfType:UIMessageCellLayoutTypeImage isSender:NO];
  270. }
  271. - (TUIMessageCellLayout *)sendVoiceMessageLayout {
  272. return [self getMessageLayoutOfType:UIMessageCellLayoutTypeVoice isSender:YES];
  273. }
  274. - (TUIMessageCellLayout *)receiveVoiceMessageLayout {
  275. return [self getMessageLayoutOfType:UIMessageCellLayoutTypeVoice isSender:NO];
  276. }
  277. - (TUIMessageCellLayout *)sendVideoMessageLayout {
  278. return [self getMessageLayoutOfType:UIMessageCellLayoutTypeVideo isSender:YES];
  279. }
  280. - (TUIMessageCellLayout *)receiveVideoMessageLayout {
  281. return [self getMessageLayoutOfType:UIMessageCellLayoutTypeVideo isSender:NO];
  282. }
  283. - (TUIMessageCellLayout *)sendMessageLayout {
  284. return [self getMessageLayoutOfType:UIMessageCellLayoutTypeOther isSender:YES];
  285. }
  286. - (TUIMessageCellLayout *)receiveMessageLayout {
  287. return [self getMessageLayoutOfType:UIMessageCellLayoutTypeOther isSender:NO];
  288. }
  289. - (TUIMessageCellLayout *)systemMessageLayout {
  290. return [self getMessageLayoutOfType:UIMessageCellLayoutTypeSystem isSender:NO];
  291. }
  292. - (TUIMessageCellLayout *)getMessageLayoutOfType:(UIMessageCellLayoutType)type isSender:(BOOL)isSender {
  293. TUIMessageCellLayout *innerLayout = nil;
  294. switch (type) {
  295. case UIMessageCellLayoutTypeText: {
  296. innerLayout = isSender ? [TUIMessageCellLayout outgoingTextMessageLayout] : [TUIMessageCellLayout incommingTextMessageLayout];
  297. break;
  298. }
  299. case UIMessageCellLayoutTypeImage: {
  300. innerLayout = isSender ? [TUIMessageCellLayout outgoingImageMessageLayout] : [TUIMessageCellLayout incommingImageMessageLayout];
  301. break;
  302. }
  303. case UIMessageCellLayoutTypeVideo: {
  304. innerLayout = isSender ? [TUIMessageCellLayout outgoingVideoMessageLayout] : [TUIMessageCellLayout incommingVideoMessageLayout];
  305. break;
  306. }
  307. case UIMessageCellLayoutTypeVoice: {
  308. innerLayout = isSender ? [TUIMessageCellLayout outgoingVoiceMessageLayout] : [TUIMessageCellLayout incommingVoiceMessageLayout];
  309. break;
  310. }
  311. case UIMessageCellLayoutTypeOther: {
  312. innerLayout = isSender ? [TUIMessageCellLayout outgoingMessageLayout] : [TUIMessageCellLayout incommingMessageLayout];
  313. break;
  314. }
  315. case UIMessageCellLayoutTypeSystem: {
  316. innerLayout = [TUIMessageCellLayout systemMessageLayout];
  317. break;
  318. }
  319. }
  320. return innerLayout;
  321. }
  322. - (void)setSystemMessageBackgroundColor:(UIColor *)systemMessageBackgroundColor {
  323. TUISystemMessageCellData.textBackgroundColor = systemMessageBackgroundColor;
  324. }
  325. - (UIColor *)systemMessageBackgroundColor {
  326. return TUISystemMessageCellData.textBackgroundColor;
  327. }
  328. - (void)setSystemMessageTextFont:(UIFont *)systemMessageTextFont {
  329. TUISystemMessageCellData.textFont = systemMessageTextFont;
  330. }
  331. - (UIFont *)systemMessageTextFont {
  332. return TUISystemMessageCellData.textFont;
  333. }
  334. - (void)setSystemMessageTextColor:(UIColor *)systemMessageTextColor {
  335. TUISystemMessageCellData.textColor = systemMessageTextColor;
  336. }
  337. - (UIColor *)systemMessageTextColor {
  338. return TUISystemMessageCellData.textColor;
  339. }
  340. - (void)setReceiveNicknameFont:(UIFont *)receiveNicknameFont {
  341. TUIMessageCell.incommingNameFont = receiveNicknameFont;
  342. }
  343. - (UIFont *)receiveNicknameFont {
  344. return TUIMessageCell.incommingNameFont;
  345. }
  346. - (void)setReceiveNicknameColor:(UIColor *)receiveNicknameColor {
  347. TUIMessageCell.incommingNameColor = receiveNicknameColor;
  348. }
  349. - (UIColor *)receiveNicknameColor {
  350. return TUIMessageCell.incommingNameColor;
  351. }
  352. @end
  353. @implementation TUIChatConfig_Classic (MessageBubble)
  354. - (void)setEnableMessageBubbleStyle:(BOOL)enableMessageBubbleStyle {
  355. [TIMConfig defaultConfig].enableMessageBubble = enableMessageBubbleStyle;
  356. }
  357. - (BOOL)enableMessageBubbleStyle {
  358. return [TIMConfig defaultConfig].enableMessageBubble;
  359. }
  360. - (void)setSendBubbleBackgroundImage:(UIImage *)sendBubbleBackgroundImage {
  361. [TUIBubbleMessageCell setOutgoingBubble:sendBubbleBackgroundImage];
  362. }
  363. - (UIImage *)sendBubbleBackgroundImage {
  364. return [TUIBubbleMessageCell outgoingBubble];
  365. }
  366. - (void)setSendHighlightBubbleBackgroundImage:(UIImage *)sendHighlightBackgroundImage {
  367. [TUIBubbleMessageCell setOutgoingHighlightedBubble:sendHighlightBackgroundImage];
  368. }
  369. - (UIImage *)sendHighlightBubbleBackgroundImage {
  370. return [TUIBubbleMessageCell outgoingHighlightedBubble];
  371. }
  372. - (void)setSendAnimateLightBubbleBackgroundImage:(UIImage *)sendAnimateLightBackgroundImage {
  373. [TUIBubbleMessageCell setOutgoingAnimatedHighlightedAlpha20:sendAnimateLightBackgroundImage];
  374. }
  375. - (UIImage *)sendAnimateLightBubbleBackgroundImage {
  376. return [TUIBubbleMessageCell outgoingAnimatedHighlightedAlpha20];
  377. }
  378. - (void)setSendAnimateDarkBubbleBackgroundImage:(UIImage *)sendAnimateDarkBackgroundImage {
  379. [TUIBubbleMessageCell setOutgoingAnimatedHighlightedAlpha50:sendAnimateDarkBackgroundImage];
  380. }
  381. - (UIImage *)sendAnimateDarkBubbleBackgroundImage {
  382. return [TUIBubbleMessageCell outgoingAnimatedHighlightedAlpha50];
  383. }
  384. - (void)setSendErrorBubbleBackgroundImage:(UIImage *)sendErrorBubbleBackgroundImage {
  385. [TUIBubbleMessageCell setOutgoingErrorBubble:sendErrorBubbleBackgroundImage];
  386. }
  387. - (UIImage *)sendErrorBubbleBackgroundImage {
  388. return [TUIBubbleMessageCell outgoingErrorBubble];
  389. }
  390. - (void)setReceiveBubbleBackgroundImage:(UIImage *)receiveBubbleBackgroundImage {
  391. [TUIBubbleMessageCell setIncommingBubble:receiveBubbleBackgroundImage];
  392. }
  393. - (UIImage *)receiveBubbleBackgroundImage {
  394. return [TUIBubbleMessageCell incommingBubble];
  395. }
  396. - (void)setReceiveHighlightBubbleBackgroundImage:(UIImage *)receiveHighlightBubbleBackgroundImage {
  397. [TUIBubbleMessageCell setIncommingHighlightedBubble:receiveHighlightBubbleBackgroundImage];
  398. }
  399. - (UIImage *)receiveHighlightBubbleBackgroundImage {
  400. return [TUIBubbleMessageCell incommingHighlightedBubble];
  401. }
  402. - (void)setReceiveAnimateLightBubbleBackgroundImage:(UIImage *)receiveAnimateLightBubbleBackgroundImage {
  403. [TUIBubbleMessageCell setIncommingAnimatedHighlightedAlpha20:receiveAnimateLightBubbleBackgroundImage];
  404. }
  405. - (UIImage *)receiveAnimateLightBubbleBackgroundImage {
  406. return [TUIBubbleMessageCell incommingAnimatedHighlightedAlpha20];
  407. }
  408. - (void)setReceiveAnimateDarkBubbleBackgroundImage:(UIImage *)receiveAnimateDarkBubbleBackgroundImage {
  409. [TUIBubbleMessageCell setIncommingAnimatedHighlightedAlpha50:receiveAnimateDarkBubbleBackgroundImage];
  410. }
  411. - (UIImage *)receiveAnimateDarkBubbleBackgroundImage {
  412. return [TUIBubbleMessageCell incommingAnimatedHighlightedAlpha50];
  413. }
  414. - (void)setReceiveErrorBubbleBackgroundImage:(UIImage *)receiveErrorBubbleBackgroundImage {
  415. [TUIBubbleMessageCell setIncommingErrorBubble:receiveErrorBubbleBackgroundImage];
  416. }
  417. - (UIImage *)receiveErrorBubbleBackgroundImage {
  418. return [TUIBubbleMessageCell incommingErrorBubble];
  419. }
  420. @end
  421. @implementation TUIChatConfig_Classic (InputBar)
  422. - (id<TUIChatInputBarConfigDataSource>)setinputBarDataSource {
  423. return [TUIChatConfig defaultConfig].inputBarDataSource;
  424. }
  425. - (void)setInputBarDataSource:(id<TUIChatInputBarConfigDataSource>)inputBarDataSource {
  426. [TUIChatConfig defaultConfig].inputBarDataSource = inputBarDataSource;
  427. }
  428. - (id<TUIChatShortcutViewDataSource>)shortcutViewDataSource {
  429. return [TUIChatConfig defaultConfig].shortcutViewDataSource;
  430. }
  431. - (void)setShortcutViewDataSource:(id<TUIChatShortcutViewDataSource>)shortcutViewDataSource {
  432. [TUIChatConfig defaultConfig].shortcutViewDataSource = shortcutViewDataSource;
  433. }
  434. - (void)setShowInputBar:(BOOL)showInputBar {
  435. [TUIChatConfig defaultConfig].enableMainPageInputBar = showInputBar;
  436. }
  437. - (BOOL)showInputBar {
  438. return ![TUIChatConfig defaultConfig].enableMainPageInputBar;
  439. }
  440. + (void)hideItemsInMoreMenu:(TUIChatInputBarMoreMenuItem)items {
  441. [TUIChatConfig defaultConfig].enableWelcomeCustomMessage = !(items & TUIChatInputBarMoreMenuItem_CustomMessage);
  442. [TUIChatConfig defaultConfig].showRecordVideoButton = !(items & TUIChatInputBarMoreMenuItem_RecordVideo);
  443. [TUIChatConfig defaultConfig].showTakePhotoButton = !(items & TUIChatInputBarMoreMenuItem_TakePhoto);
  444. [TUIChatConfig defaultConfig].showAlbumButton = !(items & TUIChatInputBarMoreMenuItem_Album);
  445. [TUIChatConfig defaultConfig].showFileButton = !(items & TUIChatInputBarMoreMenuItem_File);
  446. [TUIChatConfig defaultConfig].showRoomButton = !(items & TUIChatInputBarMoreMenuItem_Room);
  447. [TUIChatConfig defaultConfig].showPollButton = !(items & TUIChatInputBarMoreMenuItem_Poll);
  448. [TUIChatConfig defaultConfig].showGroupNoteButton = !(items & TUIChatInputBarMoreMenuItem_GroupNote);
  449. [TUIChatConfig defaultConfig].enableVideoCall = !(items & TUIChatInputBarMoreMenuItem_VideoCall);
  450. [TUIChatConfig defaultConfig].enableAudioCall = !(items & TUIChatInputBarMoreMenuItem_AudioCall);
  451. }
  452. - (void)addStickerGroup:(TUIFaceGroup *)group {
  453. id<TUIEmojiMeditorProtocol> service = [[TIMCommonMediator share] getObject:@protocol(TUIEmojiMeditorProtocol)];
  454. [service appendFaceGroup:group];
  455. }
  456. @end