LogAddViewController.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. //
  2. // LogAddViewController.h
  3. // IBOSSmini
  4. //
  5. // Created by guan hong hou on 2017/5/9.
  6. // Copyright © 2017年 elongtian. All rights reserved.
  7. //
  8. #import "BaseViewController.h"
  9. #import "BRDatePickerView.h"
  10. #import "DKAudioPlayerHelper.h"
  11. #import "DKPhoto.h"
  12. #import "UIScrollView+UITouch.h"
  13. #import "DateFormat.h"
  14. #import "MapViewController.h"
  15. #import "LogShareAndCommentInfoModel.h"
  16. #import "DKMessage.h"
  17. #import "DKMessageTableView.h"
  18. #import "DKUITableViewCell.h"
  19. #import "DKMessageInputView.h"
  20. #import "DKVoiceRecordHUD.h"
  21. #import "DKVoiceRecordHelper.h"
  22. #import "DKUICollectionViewCellImageProtocol.h"
  23. #import "CommentDelegate.h"
  24. #import "RefreshDataDelegate.h"
  25. #import "LogShareDelegate.h"
  26. @protocol DKUITableViewControllerDelegate <NSObject>
  27. @optional
  28. /**
  29. * 发送语音消息的回调方法
  30. *
  31. * @param voicePath 目标语音本地路径
  32. * @param voiceDuration 目标语音时长
  33. * @param sender 发送者的名字
  34. * @param date 发送时间
  35. */
  36. - (void)didSendVoice:(NSString *)voicePath voiceDuration:(NSString*)voiceDuration fromSender:(NSString *)sender onDate:(NSDate *)date;
  37. /**
  38. * 配置TableViewCell高度的方法,如果你想定制自己的Cell样式,那么你必须要实现DataSource中的方法
  39. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath targetMessage:(id<DKMessageModel>)message;
  40. *
  41. * @param tableView 目标TableView
  42. * @param indexPath 目标IndexPath
  43. * @param message 目标消息Model
  44. *
  45. * @return 返回计算好的Cell高度
  46. */
  47. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath targetMessage:(id<DKMessageModel>)message;
  48. @end
  49. @protocol DKUITableViewControllerDataSource <NSObject>
  50. @required
  51. - (id <DKMessageModel>)messageForRowAtIndexPath:(NSIndexPath *)indexPath;
  52. @optional
  53. /**
  54. * 配置TableViewCell的方法,如果你想定制自己的Cell样式,那么你必须要实现Delegate中的方法
  55. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath targetMessage:(id<DKMessageModel>)message;
  56. *
  57. * @param tableView 目标TableView
  58. * @param indexPath 目标IndexPath
  59. * @param message 目标消息Model
  60. *
  61. * @return 返回UITableViewCell或者继承于UITableViewCell的实例化对象
  62. */
  63. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath targetMessage:(id<DKMessageModel>)message;
  64. @end
  65. @interface LogAddViewController :BaseViewController<UITabBarDelegate,UICollectionViewDataSource, UICollectionViewDelegate,DKPhotoPickerBrowserViewControllerDataSource,DKPhotoPickerBrowserViewControllerDelegate,DKPhotoPickerViewControllerDelegate,PositionDelegate,UITableViewDataSource, UITableViewDelegate, DKUITableViewControllerDelegate, DKUITableViewControllerDataSource, DKUITableViewCellDelegate,DKMessageInputViewDelegate, DKUICollectionViewCellImageProtocol,UITextViewDelegate,CommentDelegate,LogShareDelegate>
  66. @property(strong, nonatomic) UIButton *btnDate;//日期按钮
  67. @property long preTag;//日期按钮
  68. @property int preMoveY;
  69. @property(strong, nonatomic) UIButton *btnShare;//范围权限按钮
  70. @property(strong, nonatomic) UIButton *btnComment;
  71. @property (strong, nonatomic) UITextView *txtContent;
  72. @property (strong, nonatomic) UILabel *lblPosition;
  73. @property(copy, nonatomic) NSString *sShareId;// 分享范围
  74. @property(copy, nonatomic) NSString *sShareUserName;// 分享范围
  75. @property(copy, nonatomic) NSString *sCommentId;//点评人
  76. @property(copy, nonatomic) NSString *sComment;//点评人
  77. @property(copy, nonatomic) NSString *sDate; //日期
  78. @property(copy, nonatomic) NSString *displayDate; //日期
  79. @property(copy, nonatomic) NSString *sLocation; //位置
  80. @property(nonatomic,weak) id<RefreshDataDelegate> refreshDelegate;
  81. @property(strong) NSMutableArray *shareArr;//分享范围数组
  82. @property(strong) NSMutableArray *commentArr;//评论数组
  83. @property(strong)BRDatePickerView *brdatePicker;//日期控件
  84. @property (nonatomic, copy) NSString *messageSender;//消息发送者
  85. @property (nonatomic, strong) DKUITableViewCell *currentSelectedCell;//tableviewcell
  86. @property (nonatomic , strong) NSMutableArray *assets;//相册数组
  87. @property (nonatomic , strong) NSMutableArray *voicePaths;//声音路径数组
  88. @property (nonatomic , strong) NSMutableArray *voiceUploadPaths;//服务器返回照片的路径
  89. @property (nonatomic , strong) NSMutableArray *voiceUploadTimes;//时间
  90. @property (nonatomic , strong) NSMutableArray *imagePaths;//上传后返回照片的路径
  91. @property (nonatomic , strong) NSMutableArray *imageLocalPaths;//本地存入沙盒照片的路径
  92. @property (retain,nonatomic) UICollectionView *collectionView;//图片collectionview控件
  93. @property (strong,nonatomic) DKCameraViewController *cameraVc;//照相机控制器
  94. @property (nonatomic, assign, readonly) DKInputViewType textViewInputViewType;//底部消息视图类型
  95. @property(strong) ASIDownManager* mDownManager ;//下载管理器
  96. @property(copy, nonatomic) UIImageView *positionImg; //位置图片
  97. @property(copy, nonatomic) UIButton *btnTakePhoto;//拍照按钮
  98. @property(copy, nonatomic) UIButton *btnPhoto;//照片按钮
  99. @property(copy, nonatomic) UIButton *btnPosition;//地图位置按钮
  100. @property(copy, nonatomic) UIView *separatorView;//分隔线
  101. @property(copy, nonatomic) UIImageView *voiceImg;//声音图片控件
  102. @property(copy, nonatomic) UILabel *lblVoice;//语音标签
  103. @property(copy, nonatomic) UIButton *btnRecord;//录音按钮
  104. @property (nonatomic, assign) BOOL allowsPanToDismissKeyboard;//允许键盘消失
  105. @property (nonatomic, assign) BOOL allowsSendVoice;//允许发送语音
  106. @property (nonatomic, strong) NSMutableArray *messages;//消息数组
  107. @property (nonatomic, weak) id <DKUITableViewControllerDataSource> dataSource;//DKUITableViewController数据源
  108. @property (nonatomic,strong) DKMessageTableView *messageTV;//消息tableview
  109. @property (nonatomic,strong) DKMessageInputView *inputView;//底部语音视图
  110. @property (nonatomic, assign) BOOL isUserScrolling;// 判断是否用户手指滚动
  111. @property (nonatomic, strong, readwrite) DKVoiceRecordHUD *voiceRecordHUD;//声音录制工具类
  112. /**
  113. * 管理录音工具对象
  114. */
  115. @property (nonatomic, strong) DKVoiceRecordHelper *voiceRecordHelper;
  116. /**
  117. * 判断是不是超出了录音最大时长
  118. */
  119. @property (nonatomic) BOOL isMaxTimeStop;
  120. #pragma mark - DataSource Change
  121. /**
  122. * 改变数据源需要的子线程
  123. *
  124. * @param queue 子线程执行完成的回调block
  125. */
  126. - (void)exChangeMessageDataSourceQueue:(void (^)())queue;
  127. /**
  128. * 执行块代码在主线程
  129. *
  130. * @param queue 主线程执行完成回调block
  131. */
  132. - (void)exMainQueue:(void (^)())queue;
  133. #pragma mark - RecorderPath Helper Method
  134. /**
  135. * 获取录音的路径
  136. *
  137. * @return 返回录音的路径
  138. */
  139. - (NSString *)getRecorderPath;
  140. /**
  141. * 根据底部高度获取UIEdgeInsets常量
  142. *
  143. * @param bottom 底部高度
  144. *
  145. * @return 返回UIEdgeInsets常量
  146. */
  147. - (UIEdgeInsets)tableViewInsetsWithBottomValue:(CGFloat)bottom;
  148. #pragma mark - Message Calculate Cell Height
  149. /**
  150. * 统一计算Cell的高度方法
  151. *
  152. * @param message 被计算目标消息对象
  153. * @param indexPath 被计算目标消息所在的位置
  154. *
  155. * @return 返回计算的高度
  156. */
  157. - (CGFloat)calculateCellHeightWithMessage:(id <DKMessageModel>)message atIndexPath:(NSIndexPath *)indexPath;
  158. #pragma mark - Message Send helper Method
  159. /**
  160. * 根据录音路径开始发送语音消息
  161. *
  162. * @param voicePath 目标语音路径
  163. * @param voiceDuration 目标语音时长
  164. */
  165. - (void)didSendMessageWithVoice:(NSString *)voicePath voiceDuration:(NSString*)voiceDuration;
  166. #pragma mark - Voice Recording Helper Method
  167. /**
  168. * 开始录音
  169. */
  170. - (void)startRecord;
  171. /**
  172. * 完成录音
  173. */
  174. - (void)finishRecorded;
  175. /**
  176. * 想停止录音
  177. */
  178. - (void)pauseRecord;
  179. /**
  180. * 继续录音
  181. */
  182. - (void)resumeRecord;
  183. /**
  184. * 取消录音
  185. */
  186. - (void)cancelRecord;
  187. @end