JMSGMessageDelegate.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * | | | | \ \ / / | | | | / _______|
  3. * | |____| | \ \/ / | |____| | / /
  4. * | |____| | \ / | |____| | | | _____
  5. * | | | | / \ | | | | | | |____ |
  6. * | | | | / /\ \ | | | | \ \______| |
  7. * | | | | /_/ \_\ | | | | \_________|
  8. *
  9. * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved.
  10. */
  11. #import <Foundation/Foundation.h>
  12. #import <JMessage/JMSGMessage.h>
  13. /*!
  14. * 消息相关的变更通知
  15. *
  16. * 包括三类:
  17. *
  18. * - 发出消息的返回结果;
  19. * - 服务器端下发的消息;
  20. * - 服务器端下发的事件(一类特殊的消息);
  21. */
  22. @protocol JMSGMessageDelegate <NSObject>
  23. /*!
  24. * @abstract 发送消息结果返回回调
  25. *
  26. * @param message 原发出的消息对象
  27. * @param error 不为nil表示发送消息出错
  28. *
  29. * @discussion 应检查 error 是否为空来判断是否出错. 如果未出错, 则成功.
  30. */
  31. @optional
  32. - (void)onSendMessageResponse:(JMSGMessage *)message error:(NSError *)error;
  33. /*!
  34. * @abstract 接收消息(服务器端下发的)回调
  35. *
  36. * @param message 接收到下发的消息
  37. * @param error 不为 nil 表示接收消息出错
  38. *
  39. * @discussion 应检查 error 是否为空来判断有没有出错. 如果未出错, 则成功.
  40. * 留意的是, 这里的 error 不包含媒体消息下载文件错误. 这类错误有单独的回调 onReceiveMessageDownloadFailed:
  41. *
  42. * 收到的消息里, 也包含服务器端下发的各类消息事件, 比如有人被加入了群聊. 这类消息事件处理为特殊的 JMSGMessage 类型.
  43. *
  44. * 事件类的消息, 基于 JMSGMessage 类里的 contentType 属性来做判断,
  45. * contentType = kJMSGContentTypeEventNotification.
  46. */
  47. @optional
  48. - (void)onReceiveMessage:(JMSGMessage *)message error:(NSError *)error;
  49. /*!
  50. * @abstract 接收消息媒体文件下载失败的回调
  51. *
  52. * @param message 下载出错的消息
  53. *
  54. * @discussion 因为对于接收消息, 最主要需要特别做处理的就是媒体文件下载, 所以单列出来. 一定要处理.
  55. *
  56. * 通过的作法是: 如果是图片, 则 App 展示一张特别的表明未下载成功的图, 用户点击再次发起下载. 如果是语音,
  57. * 则不必特别处理, 还是原来的图标展示. 用户点击时, SDK 发现语音文件在本地没有, 会再次发起下载.
  58. */
  59. @optional
  60. - (void)onReceiveMessageDownloadFailed:(JMSGMessage *)message;
  61. @end