YOUPAIUCIMP2PSessionVC.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. //
  2. // YOUPAIUCIMP2PSessionVC.h
  3. // wolfman
  4. //
  5. // Created by 张灿 on 2017/6/3.
  6. // Copyright © 2017年 shareSmile. All rights reserved.
  7. //
  8. #import "ZCBaseVC.h"
  9. #import "NIMSessionConfig.h"
  10. #import "NIMMessageCellProtocol.h"
  11. #import "NIMSessionConfigurateProtocol.h"
  12. #import "YOUPAINIMInputView.h"
  13. #import "YOUPAIUCBaseTouchTableView.h"
  14. #import "YOUPAILCGiftAttachment.h"
  15. #import "YOUPAILCOneImageAttachment.h"
  16. #import "YOUPAILCMultiImageAttachment.h"
  17. #import "YOUPAILCMessageTxtAttachment.h"
  18. #import "YOUPAILPFollowAttachment.h"
  19. @class NIMSessionConfigurator;
  20. @interface YOUPAIUCIMP2PSessionVC : UIViewController<NIMSessionInteractorDelegate,NIMInputActionDelegate,NIMMessageCellDelegate,NIMChatManagerDelegate,NIMConversationManagerDelegate,NIMInputDelegate,UCBaseTouchTableViewDelegate>
  21. @property (nonatomic, strong) YOUPAIUCBaseTouchTableView *tableView;
  22. @property (nonatomic,strong) YOUPAINIMInputView *sessionInputView;
  23. @property (nonatomic, strong) NIMSession *session;
  24. @property (nonatomic,weak) id<NIMSessionInteractor> interactor;
  25. @property (nonatomic,assign) BOOL disableCommandTyping;
  26. @property (nonatomic,strong) NIMSessionConfigurator *configurator;
  27. //@property (nonatomic,strong) NSMutableArray<NIMMessage *> *imagesArray; //图片数组
  28. //子类实现右上角头像点击的方法
  29. - (void)youpaifprofileClick;
  30. /**
  31. * 当前当初的菜单所关联的消息
  32. *
  33. * @discussion 在菜单点击方法中,想获取所点的消息,可以调用此接口
  34. */
  35. @property (nonatomic,readonly) NIMMessage *messageForMenu;
  36. /**
  37. * 初始化方法
  38. *
  39. * @param session 所属会话
  40. *
  41. * @return 会话页实例
  42. */
  43. - (instancetype)initWithSession:(NIMSession *)session;
  44. #pragma mark - 界面
  45. /**
  46. * 会话页导航栏标题-这里指对方的名称
  47. */
  48. - (NSString *)youpaifsessionTitle;
  49. /**
  50. * 刷新导航栏标题-这里指对方的名称
  51. */
  52. - (void)youpaifrefreshNavTitle:(NSString *)title;
  53. - (void)youpaifrefreshNavSubTitle:(NSString *)title;
  54. //刷新导航栏显示的在线状态
  55. - (void)youpaifrefreshNavOnline:(BOOL)online;
  56. /**
  57. * 会话页长按消息可以弹出的菜单
  58. *
  59. * @param message 长按的消息
  60. *
  61. * @return 菜单,为UIMenuItem的数组
  62. */
  63. - (NSArray *)youpaifmenusItems:(NIMMessage *)message;
  64. /**
  65. * 会话页详细配置
  66. */
  67. - (id<NIMSessionConfig>)sessionConfig;
  68. #pragma mark - 消息接口
  69. /**
  70. * 发送消息
  71. *
  72. * @param message 消息
  73. */
  74. - (void)sendMessage:(NIMMessage *)message;
  75. #pragma mark - 录音接口
  76. /**
  77. * 录音失败回调
  78. *
  79. * @param error 失败原因
  80. */
  81. - (void)youpaifonRecordFailed:(NSError *)error;
  82. /**
  83. * 录音内容是否可以被发送
  84. *
  85. * @param filepath 录音路径
  86. *
  87. * @return 是否允许发送
  88. *
  89. * @discussion 在此回调里检查录音时长是否满足要求发送的录音时长
  90. */
  91. - (BOOL)youpaifrecordFileCanBeSend:(NSString *)filepath;
  92. /**
  93. * 语音不能发送的原因
  94. *
  95. * @discussion 可以显示录音时间不满足要求之类的文案
  96. */
  97. - (void)showRecordFileNotSendReason;
  98. #pragma mark - 操作接口
  99. /**
  100. * 追加一条消息
  101. *
  102. * @param messages 消息
  103. *
  104. * @discussion 不会比较时间戳,直接加在消息列表末尾。不会触发 DB 操作,,请手动调用 SDK 里 saveMessage:forSession:completion: 接口。
  105. */
  106. - (void)youpaifuiAddMessages:(NSArray *)messages;
  107. /**
  108. * 插入多条消息
  109. *
  110. * @param messages 消息
  111. *
  112. * @discussion 会比较时间戳,加在合适的地方,不推荐聊天室这种大消息量场景使用。不会触发 DB 操作,,请手动调用 SDK 里 saveMessage:forSession:completion: 接口。
  113. */
  114. - (void)youpaifuiInsertMessages:(NSArray *)messages;
  115. /**
  116. * 删除一条消息
  117. *
  118. * @param message 消息
  119. *
  120. * @return 被删除的 MessageModel
  121. *
  122. * @discussion 不会触发 DB 操作,请手动调用 SDK 里 deleteMessage: 接口
  123. */
  124. - (NIMMessageModel *)youpaifuiDeleteMessage:(NIMMessage *)message;
  125. /**
  126. * 更新一条消息
  127. *
  128. * @param message 消息
  129. *
  130. * @discussion 不会触发 DB 操作,请手动调用 SDK 里 updateMessage:forSession:completion: 接口
  131. */
  132. - (void)youpaifuiUpdateMessage:(NIMMessage *)message;
  133. //子类需要调用
  134. - (void)sendMessageReceipt:(NSArray *)messages;
  135. - (id<NIMConversationManager>)conversationManager;
  136. @end