TUIInputController.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. // Created by Tencent on 2023/06/09.
  2. // Copyright © 2023 Tencent. All rights reserved.
  3. /**
  4. * This document declares the relevant components to implement the input area.
  5. * The input area includes the emoticon view input area (TUIFaceView+TUIMoreView), the "more" functional area (TUIMoreView) and the text input area
  6. * (TUIInputBar). This file contains the TUIInputControllerDelegate protocol and the TInputController class. In the input bar (TUIInputBar), button response
  7. * callbacks for expressions, voices, and more views are provided. In this class, the InputBar is actually combined with the above three views to realize the
  8. * display and switching logic of each view.
  9. */
  10. #import <TIMCommon/TUIMessageCell.h>
  11. #import <UIKit/UIKit.h>
  12. #import "TUIChatDefine.h"
  13. #import "TUIFaceView.h"
  14. #import "TUIInputBar.h"
  15. #import "TUIMenuView.h"
  16. #import "TUIMoreView.h"
  17. #import "TUIReplyPreviewBar.h"
  18. #import "TUIFaceSegementScrollView.h"
  19. @class TUIInputController;
  20. /////////////////////////////////////////////////////////////////////////////////
  21. //
  22. // TUIInputControllerDelegate
  23. //
  24. /////////////////////////////////////////////////////////////////////////////////
  25. @protocol TUIInputControllerDelegate <NSObject>
  26. /**
  27. * Callback when the current InputController height changes.
  28. * You can use this callback to adjust the UI layout of each component in the controller according to the changed height.
  29. */
  30. - (void)inputController:(TUIInputController *)inputController didChangeHeight:(CGFloat)height;
  31. /**
  32. * Callback when the current InputController sends a message.
  33. */
  34. - (void)inputController:(TUIInputController *)inputController didSendMessage:(V2TIMMessage *)msg;
  35. /**
  36. * Callback for clicking a more item
  37. * You can use this callback to achieve: according to the clicked cell type, do the next step. For example, select pictures, select files, etc.
  38. * At the same time, the implementation of this delegate contains the following code:
  39. * <pre>
  40. * - (void)inputController:(TUIInputController *)inputController didSelectMoreCell:(TUIInputMoreCell *)cell {
  41. * ……
  42. * ……
  43. * if(_delegate && [_delegate respondsToSelector:@selector(chatController:onSelectMoreCell:)]){
  44. * [_delegate chatController:self onSelectMoreCell:cell];
  45. * }
  46. * }
  47. * </pre>
  48. * The above code can help you to customize the "more" unit.
  49. * For more information you can refer to the comments in TUIChat\UI\Chat\TUIBaseChatController.h
  50. */
  51. - (void)inputController:(TUIInputController *)inputController didSelectMoreCell:(TUIInputMoreCell *)cell;
  52. /**
  53. * Callback when @ character is entered
  54. */
  55. - (void)inputControllerDidInputAt:(TUIInputController *)inputController;
  56. /**
  57. * Callback when there are @xxx characters removed
  58. */
  59. - (void)inputController:(TUIInputController *)inputController didDeleteAt:(NSString *)atText;
  60. - (void)inputControllerBeginTyping:(TUIInputController *)inputController;
  61. - (void)inputControllerEndTyping:(TUIInputController *)inputController;
  62. - (void)inputControllerDidClickMore:(TUIInputController *)inputController;
  63. @end
  64. /////////////////////////////////////////////////////////////////////////////////
  65. //
  66. // TUIInputControllerDelegate
  67. //
  68. /////////////////////////////////////////////////////////////////////////////////
  69. @interface TUIInputController : UIViewController
  70. /**
  71. * A preview view above the input box for message reply scenarios
  72. */
  73. @property(nonatomic, strong) TUIReplyPreviewBar *replyPreviewBar;
  74. /**
  75. * The preview view below the input box, with the message reference scene
  76. *
  77. */
  78. @property(nonatomic, strong) TUIReferencePreviewBar *referencePreviewBar;
  79. /**
  80. * Message currently being replied to
  81. */
  82. @property(nonatomic, strong) TUIReplyPreviewData *replyData;
  83. @property(nonatomic, strong) TUIReferencePreviewData *referenceData;
  84. /**
  85. * Input bar
  86. * The input bar contains a series of interactive components such as text input box, voice button, "more" button, emoticon button, etc., and provides
  87. * corresponding callbacks for these components.
  88. */
  89. @property(nonatomic, strong) TUIInputBar *inputBar;
  90. /**
  91. * Emoticon view
  92. * The emoticon view generally appears after clicking the "Smiley" button. Responsible for displaying each expression group and the expressions within the
  93. * group.
  94. *
  95. */
  96. //@property(nonatomic, strong) TUIFaceView *faceView;
  97. @property(nonatomic, strong) TUIFaceSegementScrollView *faceSegementScrollView;
  98. /**
  99. * Menu view
  100. * The menu view is located below the emoticon view and is responsible for providing the emoticon grouping unit and the send button.
  101. */
  102. @property(nonatomic, strong) TUIMenuView *menuView;
  103. /**
  104. * More view
  105. * More views generally appear after clicking the "More" button ("+" button), and are responsible for displaying each more unit, such as shooting, video, file,
  106. * album, etc.
  107. */
  108. @property(nonatomic, strong) TUIMoreView *moreView;
  109. @property(nonatomic, weak) id<TUIInputControllerDelegate> delegate;
  110. /**
  111. * Reset the current input controller.
  112. * If there is currently an emoji view or a "more" view being displayed, collapse the corresponding view and set the current status to Input_Status_Input.
  113. * That is, no matter what state the current InputController is in, reset it to its initialized state.
  114. */
  115. - (void)reset;
  116. /**
  117. * Show/hide preview bar of message reply input box
  118. */
  119. - (void)showReplyPreview:(TUIReplyPreviewData *)data;
  120. - (void)showReferencePreview:(TUIReferencePreviewData *)data;
  121. - (void)exitReplyAndReference:(void (^__nullable)(void))finishedCallback;
  122. /**
  123. * Current input box state
  124. */
  125. @property(nonatomic, assign, readonly) InputStatus status;
  126. @end