TUIFileMessageCellData.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Created by Tencent on 2023/06/09.
  2. // Copyright © 2023 Tencent. All rights reserved.
  3. #import <TIMCommon/TUIBubbleMessageCellData.h>
  4. #import <TIMCommon/TUIMessageCellData.h>
  5. NS_ASSUME_NONNULL_BEGIN
  6. @interface TUIFileMessageCellData : TUIBubbleMessageCellData <TUIMessageCellDataFileUploadProtocol, TUIMessageCellDataFileDownloadProtocol>
  7. /**
  8. * File path
  9. */
  10. @property(nonatomic, strong) NSString *path;
  11. /**
  12. * File name, including suffix.
  13. */
  14. @property(nonatomic, strong) NSString *fileName;
  15. /**
  16. * Inner ID for file
  17. */
  18. @property(nonatomic, strong) NSString *uuid;
  19. /**
  20. * File size, used to display the data volume information of the file.
  21. */
  22. @property(nonatomic, assign) int length;
  23. /**
  24. * The progress of file uploading, which maintained by the cellData.
  25. */
  26. @property(nonatomic, assign) NSUInteger uploadProgress;
  27. /**
  28. * The progress of file downloading, which maintained by the cellData.
  29. */
  30. @property(nonatomic, assign) NSUInteger downladProgress;
  31. /**
  32. * The flag of indicating whether the file is downloading
  33. * YES: dowloading; NO: not download
  34. */
  35. @property(nonatomic, assign) BOOL isDownloading;
  36. /**
  37. * Downloading the file
  38. * This method integrates and calls the IM SDK, and obtains the file through the interface provided by the SDK.
  39. * 1. Before downloading the file from server, it will try to read file from local when the file exists in the local.
  40. * 2. When the file not exists in the local, it will download from server through the api provided by IMSDK. But if there is downloading task, it will wait for
  41. * the task finished.
  42. * - The download progress (percentage value) is updated through the callback of the IMSDK.
  43. * - There are two parameters which is @curSize and @totalSize in the callback of IMSDK. The progress value equals to curSize * 100 / totalSize.
  44. * 3. When finished download, the file will be storaged to the @path.
  45. */
  46. - (void)downloadFile;
  47. /**
  48. * Determine if the file is already downloaded to local
  49. * This method will first try to get the file path from the local, if the acquisition is successful, record the path and return YES. Otherwise return NO.
  50. */
  51. - (BOOL)isLocalExist;
  52. /**
  53. * Getting the file path and it will return the flag of whether the file exists through @isExist.
  54. */
  55. - (NSString *)getFilePath:(BOOL *)isExist;
  56. @end
  57. NS_ASSUME_NONNULL_END