NIMSessionViewController.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. //
  2. // NIMSessionViewController.h
  3. // NIMKit
  4. //
  5. // Created by NetEase.
  6. // Copyright (c) 2015年 NetEase. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import <NIMSDK/NIMSDK.h>
  10. #import "NIMSessionConfig.h"
  11. #import "NIMMessageCellProtocol.h"
  12. #import "NIMSessionConfigurateProtocol.h"
  13. #import "YOUPAINIMInputView.h"
  14. @interface NIMSessionViewController : UIViewController<NIMSessionInteractorDelegate,NIMInputActionDelegate,NIMMessageCellDelegate,NIMChatManagerDelegate,NIMConversationManagerDelegate>
  15. @property (nonatomic, strong) UITableView *tableView;
  16. @property (nonatomic, strong) YOUPAINIMInputView *sessionInputView;
  17. @property (nonatomic, strong) NIMSession *session;
  18. /**
  19. * 当前当初的菜单所关联的消息
  20. *
  21. * @discussion 在菜单点击方法中,想获取所点的消息,可以调用此接口
  22. */
  23. @property (nonatomic, strong, readonly) NIMMessage *messageForMenu;
  24. /**
  25. * 会话页主标题
  26. *
  27. * @discussion 可以更改文字的大小,颜色等属性,文案内容请使用 - (NSString *)sessionTitle 接口
  28. */
  29. @property (nonatomic, strong, readonly) UILabel *titleLabel;
  30. /**
  31. * 会话页子标题
  32. *
  33. * @discussion 可以更改文字的大小,颜色等属性,文案内容请使用 - (NSString *)sessionSubTitle 接口
  34. */
  35. @property (nonatomic, strong, readonly) UILabel *subTitleLabel;
  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. - (NSString *)sessionSubTitle;
  53. /**
  54. * 刷新导航栏标题
  55. */
  56. - (void)refreshSessionTitle:(NSString *)title;
  57. /**
  58. * 刷新导航子栏标题
  59. */
  60. - (void)refreshSessionSubTitle:(NSString *)title;
  61. /**
  62. * 会话页长按消息可以弹出的菜单
  63. *
  64. * @param message 长按的消息
  65. *
  66. * @return 菜单,为UIMenuItem的数组
  67. */
  68. - (NSArray *)menusItems:(NIMMessage *)message;
  69. /**
  70. * 会话页详细配置
  71. */
  72. - (id<NIMSessionConfig>)sessionConfig;
  73. #pragma mark - 消息接口
  74. /**
  75. * 发送消息
  76. *
  77. * @param message 消息
  78. */
  79. - (void)sendMessage:(NIMMessage *)message;
  80. #pragma mark - 录音接口
  81. /**
  82. * 录音失败回调
  83. *
  84. * @param error 失败原因
  85. */
  86. - (void)onRecordFailed:(NSError *)error;
  87. /**
  88. * 录音内容是否可以被发送
  89. *
  90. * @param filepath 录音路径
  91. *
  92. * @return 是否允许发送
  93. *
  94. * @discussion 在此回调里检查录音时长是否满足要求发送的录音时长
  95. */
  96. - (BOOL)recordFileCanBeSend:(NSString *)filepath;
  97. /**
  98. * 语音不能发送的原因
  99. *
  100. * @discussion 可以显示录音时间不满足要求之类的文案
  101. */
  102. - (void)showRecordFileNotSendReason;
  103. #pragma mark - 操作接口
  104. /**
  105. * 追加多条消息
  106. *
  107. * @param messages 消息集合
  108. *
  109. * @discussion 不会比较时间戳,直接加在消息列表末尾。不会触发 DB 操作,,请手动调用 SDK 里 saveMessage:forSession:completion: 接口。
  110. */
  111. - (void)uiAddMessages:(NSArray *)messages;
  112. /**
  113. * 插入多条消息
  114. *
  115. * @param messages 消息集合
  116. *
  117. * @discussion 会比较时间戳,加在合适的地方,不推荐聊天室这种大消息量场景使用。不会触发 DB 操作,,请手动调用 SDK 里 saveMessage:forSession:completion: 接口。
  118. */
  119. - (void)uiInsertMessages:(NSArray *)messages;
  120. /**
  121. * 删除一条消息
  122. *
  123. * @param message 消息
  124. *
  125. * @return 被删除的 MessageModel
  126. *
  127. * @discussion 不会触发 DB 操作,请手动调用 SDK 里 deleteMessage: 接口
  128. */
  129. - (NIMMessageModel *)uiDeleteMessage:(NIMMessage *)message;
  130. /**
  131. * 更新一条消息
  132. *
  133. * @param message 消息
  134. *
  135. * @discussion 不会触发 DB 操作,请手动调用 SDK 里 updateMessage:forSession:completion: 接口
  136. */
  137. - (void)uiUpdateMessage:(NIMMessage *)message;
  138. @end