QYCustomUIConfig.h 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. //
  2. // QYCustomUIConfig.h
  3. // QYSDK
  4. //
  5. // Created by Netease on 12/21/15.
  6. // Copyright (c) 2017 Netease. All rights reserved.
  7. //
  8. /**
  9. * 工具栏自定义配置项:QYCustomInputItem
  10. */
  11. /**
  12. * 输入框下方“更多”配置项点击回调
  13. */
  14. typedef void (^QYCustomInputItemBlock)(void);
  15. /**
  16. * 输入框下方“更多”配置项
  17. * 注:为达到最佳效果,配置项图片最佳尺寸为64ptx64pt
  18. */
  19. @interface QYCustomInputItem : NSObject
  20. @property (nonatomic, strong) UIImage *normalImage;
  21. @property (nonatomic, strong) UIImage *selectedImage;
  22. @property (nonatomic, copy) NSString *text;
  23. @property (nonatomic, copy) QYCustomInputItemBlock block;
  24. @end
  25. /**
  26. * 自定义UI配置类:QYCustomUIConfig,单例模式
  27. * 如果想要替换图片素材,可以自己创建一个QYCustomResource.bundle,在其中放置与QYResource.bundle同名的图片素材,即可实现替换。
  28. * SDK会优先使用QYCustomResource.bundle中的图片素材,若QYCustomResource.bundle中没有,才会使用QYResource.bundle中的图片素材。
  29. */
  30. /**
  31. * 访客分流展示模式
  32. */
  33. typedef NS_ENUM(NSInteger, QYBypassDisplayMode) {
  34. QYBypassDisplayModeNone,
  35. QYBypassDisplayModeCenter,
  36. QYBypassDisplayModeBottom
  37. };
  38. /**
  39. * 消息下拉加载状态
  40. */
  41. typedef NS_ENUM(NSInteger, QYMessagesLoadState) {
  42. QYMessagesLoadStateIdle,
  43. QYMessagesLoadStateWillLoad,
  44. QYMessagesLoadStateLoading,
  45. };
  46. @interface QYCustomUIConfig : NSObject
  47. + (instancetype)sharedInstance;
  48. /**
  49. * 恢复默认设置
  50. */
  51. - (void)restoreToDefault;
  52. //聊天背景设置
  53. /**
  54. * 消息tableview的背景图片
  55. */
  56. @property (nonatomic, strong) UIImageView *sessionBackground;
  57. //主题色设置
  58. /**
  59. * 聊天页面主题色,包括访客气泡填充色、按钮填充色、默认头像填充色、“+”按钮填充色等;默认蓝色
  60. * 注意:设置主题色会修改部分属性,例如访客默认头像、访客消息气泡等,后续再次修改此类属性会覆盖主题色设置
  61. */
  62. @property (nonatomic, strong) UIColor *themeColor;
  63. //导航栏相关设置(人工/评价按钮可后台关闭显示)
  64. /**
  65. * 导航栏右侧按钮风格,默认灰色风格,NO为白色风格
  66. */
  67. @property (nonatomic, assign) BOOL rightItemStyleGrayOrWhite;
  68. /**
  69. * 导航栏右侧退出会话按钮是否显示,默认为NO
  70. */
  71. @property (nonatomic, assign) BOOL showCloseSessionEntry;
  72. /**
  73. * 是否显示消息流头像
  74. */
  75. @property (nonatomic, assign) BOOL showHeadImage;
  76. /**
  77. * 是否显示导航栏客服头像
  78. */
  79. @property (nonatomic, assign) BOOL showTopHeadImage;
  80. //访客相关设置
  81. /**
  82. * 访客头像
  83. */
  84. @property (nonatomic, strong) UIImage *customerHeadImage;
  85. @property (nonatomic, copy) NSString *customerHeadImageUrl;
  86. /**
  87. * 访客消息气泡normal图片
  88. */
  89. @property (nonatomic, strong) UIImage *customerMessageBubbleNormalImage;
  90. /**
  91. * 访客消息气泡pressed图片
  92. */
  93. @property (nonatomic, strong) UIImage *customerMessageBubblePressedImage;
  94. /**
  95. * 访客文本消息字体颜色
  96. */
  97. @property (nonatomic, strong) UIColor *customMessageTextColor;
  98. /**
  99. * 访客文本消息中的链接字体颜色
  100. */
  101. @property (nonatomic, strong) UIColor *customMessageHyperLinkColor;
  102. /**
  103. * 访客文本消息字体大小
  104. */
  105. @property (nonatomic, assign) CGFloat customMessageTextFontSize;
  106. //客服相关设置
  107. /**
  108. * 客服头像
  109. */
  110. @property (nonatomic, strong) UIImage *serviceHeadImage;
  111. @property (nonatomic, copy) NSString *serviceHeadImageUrl;
  112. /**
  113. * 客服消息气泡normal图片
  114. */
  115. @property (nonatomic, strong) UIImage *serviceMessageBubbleNormalImage;
  116. /**
  117. * 客服消息气泡pressed图片
  118. */
  119. @property (nonatomic, strong) UIImage *serviceMessageBubblePressedImage;
  120. /**
  121. * 客服文本消息字体颜色
  122. */
  123. @property (nonatomic, strong) UIColor *serviceMessageTextColor;
  124. /**
  125. * 客服文本消息中的链接字体颜色
  126. */
  127. @property (nonatomic, strong) UIColor *serviceMessageHyperLinkColor;
  128. /**
  129. * 客服文本消息字体大小
  130. */
  131. @property (nonatomic, assign) CGFloat serviceMessageTextFontSize;
  132. //提示消息相关设置(例:***为你服务)
  133. /**
  134. * 提示文本消息字体颜色;提示文本消息有很多种,比如“***为你服务”就是一种
  135. */
  136. @property (nonatomic, strong) UIColor *tipMessageTextColor;
  137. /**
  138. * 提示文本消息字体大小;提示文本消息有很多种,比如“***为你服务”就是一种
  139. */
  140. @property (nonatomic, assign) CGFloat tipMessageTextFontSize;
  141. //消息相关设置
  142. /**
  143. * 访客分流展示模式
  144. */
  145. @property (nonatomic, assign) QYBypassDisplayMode bypassDisplayMode;
  146. /**
  147. * 消息竖直方向间距
  148. */
  149. @property (nonatomic, assign) CGFloat sessionMessageSpacing;
  150. /**
  151. * 头像与消息气泡间距,默认为4pt
  152. */
  153. @property (nonatomic, assign) CGFloat headMessageSpacing;
  154. /**
  155. * 消息内强提示按钮文字颜色,例如"立即评价"按钮,默认白色
  156. */
  157. @property (nonatomic, strong) UIColor *messageButtonTextColor;
  158. /**
  159. * 消息内强提示按钮底色,例如"立即评价"按钮,默认蓝色
  160. */
  161. @property (nonatomic, strong) UIColor *messageButtonBackColor;
  162. //输入栏上方操作按钮设置
  163. /**
  164. * 输入框上方操作按钮文字颜色
  165. */
  166. @property (nonatomic, strong) UIColor *actionButtonTextColor;
  167. /**
  168. * 输入框上方操作按钮边框颜色
  169. */
  170. @property (nonatomic, strong) UIColor *actionButtonBorderColor;
  171. //输入栏设置
  172. /**
  173. * 输入框字体颜色
  174. */
  175. @property (nonatomic, strong) UIColor *inputTextColor;
  176. /**
  177. * 输入框字体大小
  178. */
  179. @property (nonatomic, assign) CGFloat inputTextFontSize;
  180. /**
  181. * 输入框占位文案
  182. */
  183. @property (nonatomic, copy) NSString *inputTextPlaceholder;
  184. /**
  185. * 输入栏语音按钮,人工模式下是否显示,默认为YES
  186. */
  187. @property (nonatomic, assign) BOOL showAudioEntry;
  188. /**
  189. * 输入栏语音按钮,机器人模式下是否显示,默认为YES
  190. */
  191. @property (nonatomic, assign) BOOL showAudioEntryInRobotMode;
  192. /**
  193. * 输入栏表情按钮是否显示,默认为YES
  194. */
  195. @property (nonatomic, assign) BOOL showEmoticonEntry;
  196. /**
  197. * 输入栏相机按钮是否显示,默认为YES
  198. */
  199. @property (nonatomic, assign) BOOL showImageEntry;
  200. /**
  201. * 照片/视频选择页面主题颜色,默认为蓝色
  202. */
  203. @property (nonatomic, strong) UIColor *imagePickerColor;
  204. /**
  205. * 进入聊天界面是否自动弹出键盘,默认为YES
  206. */
  207. @property (nonatomic, assign) BOOL autoShowKeyboard;
  208. /**
  209. * 表示聊天组件离界面底部的间距,默认是0;比较典型的是底部有tabbar,这时候设置为tabbar的高度即可
  210. */
  211. @property (nonatomic, assign) CGFloat bottomMargin;
  212. //平台电商相关设置
  213. /**
  214. * 导航栏右侧商铺入口按钮是否显示,默认为NO
  215. */
  216. @property (nonatomic, assign) BOOL showShopEntrance;
  217. /**
  218. * 聊天内容区域的按钮(对于平台电商来说,这里可以考虑放置“会话列表入口“)显示,默认不显示
  219. */
  220. @property (nonatomic, assign) BOOL showSessionListEntrance;
  221. /**
  222. * 会话列表入口icon
  223. */
  224. @property (nonatomic, strong) UIImage *sessionListEntranceImage;
  225. /**
  226. * 聊天内容区域的按钮(对于平台电商来说,这里可以考虑放置“会话列表入口“)在聊天页面的位置,YES代表在右上角,NO代表在左上角,默认在右上角
  227. */
  228. @property (nonatomic, assign) BOOL sessionListEntrancePosition;
  229. //会话窗口上方提示条相关设置
  230. /**
  231. * 会话窗口上方提示条中的文本字体颜色
  232. */
  233. @property (nonatomic, strong) UIColor *sessionTipTextColor;
  234. /**
  235. * 会话窗口上方提示条中的文本字体大小
  236. */
  237. @property (nonatomic, assign) CGFloat sessionTipTextFontSize;
  238. /**
  239. * 会话窗口上方提示条中的背景颜色
  240. */
  241. @property (nonatomic, strong) UIColor *sessionTipBackgroundColor;
  242. /**
  243. * 输入框下方“完全自定义”配置项
  244. */
  245. @property (nonatomic, strong) NSArray<QYCustomInputItem *> *customInputItems;
  246. /**
  247. * 消息下拉刷新loading图片设置,区分不同state状态
  248. */
  249. - (void)setMessagesLoadImages:(NSArray *)images duration:(NSTimeInterval)duration forState:(QYMessagesLoadState)state;
  250. /**
  251. * 注册自定义商品卡片消息的model及contentView,配置其UI显示
  252. * @discussion 若要使用自定义商品卡片功能,需调用此方法设置映射关系,注意应在卡片消息渲染前设置
  253. * @param modelClass QYCustomCommodityInfo类型消息对应的数据模型类,QYCustomModel子类
  254. * @param contentViewClass QYCustomCommodityInfo类型消息对应的视图,QYCustomContentView子类
  255. */
  256. - (void)registerCustomCommodityInfoModelClass:(Class)modelClass contentViewClass:(Class)contentViewClass;
  257. //因访客端体验升级,以下属性在v5.1.0版本废弃
  258. /**
  259. * 导航栏右侧按钮文案颜色,默认是灰色,优先级高于rightItemStyleGrayOrWhite
  260. */
  261. //@property (nonatomic, strong) UIColor *rightItemTextColor;
  262. /**
  263. * 人工按钮文案
  264. */
  265. //@property (nonatomic, copy) NSString *humanButtonText;
  266. /**
  267. * 聊天窗口右上角按钮(对于平台电商来说,这里可以考虑放“商铺入口”)文本
  268. */
  269. //@property (nonatomic, copy) NSString *shopEntranceText;
  270. /**
  271. * 聊天窗口右上角按钮(对于平台电商来说,这里可以考虑放“商铺入口”)icon
  272. */
  273. //@property (nonatomic, strong) UIImage *shopEntranceImage;
  274. @end