EMFileMessageBody.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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 The 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. * The status types for downloading the file message.
  22. */
  23. typedef NS_ENUM(NSInteger, EMDownloadStatus) {
  24. EMDownloadStatusDownloading = 0, /** \~chinese 正在下载文件消息。 \~english The SDK is downloading the file message. */
  25. EMDownloadStatusSucceed, /** \~chinese 下载文件消息成功。 \~english The SDK successfully downloads the file message. */
  26. EMDownloadStatusFailed, /** \~chinese 下载文件消息失败。 \~english The SDK fails to download the file message.*/
  27. EMDownloadStatusPending, /** \~chinese 文件消息下载正在等待中。 \~english File message download is pending.*/
  28. EMDownloadStatusSuccessed=EMDownloadStatusSucceed, /** \~chinese 该状态已废弃。请改用 EMDownloadStatusSucceed。 \~english This state is deprecated. Use EMDownloadStatusSucceed instead.*/
  29. };
  30. /**
  31. * \~chinese
  32. * 文件消息体。
  33. *
  34. * \~english
  35. * The file message body.
  36. */
  37. @interface EMFileMessageBody : EMMessageBody
  38. /**
  39. * \~chinese
  40. * 附件的显示名称。
  41. *
  42. * \~english
  43. * The display name of the attachment.
  44. */
  45. @property (nonatomic, copy) NSString *displayName;
  46. /**
  47. * \~chinese
  48. * 附件的本地路径。
  49. *
  50. * \~english
  51. * The path of the attachment on the local device.
  52. */
  53. @property (nonatomic, copy) NSString *localPath;
  54. /**
  55. * \~chinese
  56. * 附件在服务器上的路径。
  57. *
  58. * \~english
  59. * The path of the attachment in the server.
  60. */
  61. @property (nonatomic, copy) NSString *remotePath;
  62. /**
  63. * \~chinese
  64. * 附件的密钥, 下载附件时需要密匙做校验。
  65. *
  66. * \~english
  67. * The secret key for downloading the message attachment.
  68. */
  69. @property (nonatomic, copy) NSString *secretKey;
  70. /**
  71. * \~chinese
  72. * 附件的大小, 以字节为单位。
  73. *
  74. * \~english
  75. * The data length (bytes) of the attachment.
  76. */
  77. @property (nonatomic) long long fileLength;
  78. /**
  79. * \~chinese
  80. * 附件的下载状态。
  81. *
  82. * \~english
  83. * The downloading status of the 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. * Initializes a file message instance.
  97. *
  98. * @param aLocalPath The path of the file attachment in the local device.
  99. * @param aDisplayName The display name of the file attachment.
  100. *
  101. * @result The file message instance.
  102. */
  103. - (instancetype _Nonnull)initWithLocalPath:(NSString * _Nullable)aLocalPath
  104. displayName:(NSString * _Nullable)aDisplayName;
  105. /**
  106. * \~chinese
  107. * 初始化文件消息体。
  108. *
  109. * @param aData 附件内容数据。
  110. * @param aDisplayName 附件显示名(不包含路径)。
  111. *
  112. * @result 消息体实例。
  113. *
  114. * \~english
  115. * Initializes a file message instance.
  116. *
  117. * @param aData The data of the attachment file.
  118. * @param aDisplayName The display name of the attachment.
  119. *
  120. * @Result The file message instance.
  121. */
  122. - (instancetype _Nonnull)initWithData:(NSData *_Nullable)aData
  123. displayName:(NSString *_Nullable)aDisplayName;
  124. @end