EMFileMessageBody.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*!
  2. * \~chinese
  3. * @header EMFileMessageBody.h
  4. * @abstract 文件消息体
  5. * @author Hyphenate
  6. * @version 3.00
  7. *
  8. * \~english
  9. * @header EMFileMessageBody.h
  10. * @abstract File message body
  11. * @author Hyphenate
  12. * @version 3.00
  13. */
  14. #import <Foundation/Foundation.h>
  15. #import "EMMessageBody.h"
  16. /*!
  17. * \~chinese
  18. * 附件下载状态
  19. *
  20. * \~english
  21. * File downloading status
  22. */
  23. typedef enum {
  24. EMDownloadStatusDownloading = 0, /*! \~chinese 正在下载 \~english Downloading */
  25. EMDownloadStatusSucceed, /*! \~chinese 下载成功 \~english Succeed */
  26. EMDownloadStatusFailed, /*! \~chinese 下载失败 \~english Failed */
  27. EMDownloadStatusPending, /*! \~chinese 准备下载 \~english Pending */
  28. EMDownloadStatusSuccessed=EMDownloadStatusSucceed, /*! \~chinese 旧版 \~english legacy */
  29. } EMDownloadStatus;
  30. /*!
  31. * \~chinese
  32. * 文件消息体
  33. *
  34. * \~english
  35. * File message body
  36. */
  37. @interface EMFileMessageBody : EMMessageBody
  38. /*!
  39. * \~chinese
  40. * 附件的显示名
  41. *
  42. * \~english
  43. * Display name of attachment
  44. */
  45. @property (nonatomic, copy) NSString *displayName;
  46. /*!
  47. * \~chinese
  48. * 附件的本地路径
  49. *
  50. * \~english
  51. * Local path of attachment
  52. */
  53. @property (nonatomic, copy) NSString *localPath;
  54. /*!
  55. * \~chinese
  56. * 附件在服务器上的路径
  57. *
  58. * \~english
  59. * Server path of attachment
  60. */
  61. @property (nonatomic, copy) NSString *remotePath;
  62. /*!
  63. * \~chinese
  64. * 附件的密钥, 下载附件时需要密匙做校验
  65. *
  66. * \~english
  67. * Secret key for downloading the message attachment
  68. */
  69. @property (nonatomic, copy) NSString *secretKey;
  70. /*!
  71. * \~chinese
  72. * 附件的大小, 以字节为单位
  73. *
  74. * \~english
  75. * Length of attachment, in bytes
  76. */
  77. @property (nonatomic) long long fileLength;
  78. /*!
  79. * \~chinese
  80. * 附件的下载状态
  81. *
  82. * \~english
  83. * Downloading status of attachment
  84. */
  85. @property (nonatomic) EMDownloadStatus downloadStatus;
  86. /*!
  87. * \~chinese
  88. * 初始化文件消息体
  89. *
  90. * @param aLocalPath 附件本地路径
  91. * @param aDisplayName 附件显示名(不包含路径)
  92. *
  93. * @result 消息体实例
  94. *
  95. * \~english
  96. * Initialize a file message body instance
  97. *
  98. * @param aLocalPath Local path of the attachment
  99. * @param aDisplayName Display name of the attachment
  100. *
  101. * @result File message body instance
  102. */
  103. - (instancetype)initWithLocalPath:(NSString *)aLocalPath
  104. displayName:(NSString *)aDisplayName;
  105. /*!
  106. * \~chinese
  107. * 初始化文件消息体
  108. *
  109. * @param aData 附件数据
  110. * @param aDisplayName 附件显示名(不包含路径)
  111. *
  112. * @result 消息体实例
  113. *
  114. * \~english
  115. * Initialize a file message body instance
  116. *
  117. * @param aData The data of attachment file
  118. * @param aDisplayName Display name of the attachment
  119. *
  120. * @result File message body instance
  121. */
  122. - (instancetype)initWithData:(NSData *)aData
  123. displayName:(NSString *)aDisplayName;
  124. @end