WFCUMediaMessageDownloader.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // MediaMessageDownloader.h
  3. // WildFireChat
  4. //
  5. // Created by heavyrain lee on 2018/8/29.
  6. // Copyright © 2018 WildFireChat. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #define kMediaMessageStartDownloading @"kMediaMessageStartDownloading"
  10. #define kMediaMessageDownloadingProgress @"kMediaMessageDownloadingProgress"
  11. #define kMediaMessageDownloadFinished @"kMediaMessageDownloadFinished"
  12. typedef NS_ENUM(NSInteger, DownloadMediaType) {
  13. DownloadMediaType_Image,
  14. DownloadMediaType_Voice,
  15. DownloadMediaType_Video,
  16. DownloadMediaType_File,
  17. };
  18. @class WFCCMessage;
  19. @interface WFCUMediaMessageDownloader : NSObject
  20. + (instancetype)sharedDownloader;
  21. /*
  22. * @return YES 正在下载; NO 无法下载
  23. */
  24. - (BOOL)tryDownload:(WFCCMessage *)msg
  25. success:(void(^)(long long messageUid, NSString *localPath))successBlock
  26. error:(void(^)(long long messageUid, int error_code))errorBlock;
  27. /*
  28. * @return YES 正在下载; NO 无法下载。朋友圈会使用这个方法
  29. */
  30. - (BOOL)tryDownload:(NSString *)mediaPath
  31. uid:(long long)uid
  32. mediaType:(DownloadMediaType)mediaType
  33. success:(void(^)(long long messageUid, NSString *localPath))successBlock
  34. error:(void(^)(long long messageUid, int error_code))errorBlock;
  35. @end