KMDropboxManager.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. //
  2. // KMDropboxManager.h
  3. // PDF Reader Pro Edition
  4. //
  5. // Created by 万军 on 2020/2/18.
  6. // Copyright © 2020 WanJun. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "KMServicesCloudFile.h"
  10. #import "KMCloudServer.h"
  11. #import "KMCloudOperation.h"
  12. NS_ASSUME_NONNULL_BEGIN
  13. @class KMCloudOperation;
  14. @interface KMDropboxManager : NSObject
  15. {
  16. NSString *_appKey;
  17. }
  18. //The user's unique Dropbox ID
  19. @property (nonatomic, readonly) NSString *accountId;
  20. @property (nonatomic, readonly) NSString *name;
  21. @property (nonatomic, copy, readonly) NSString *email;
  22. ////获取本地当前目录下文件列表(仅当前层)
  23. //@property (nonatomic, strong) NSMutableArray<KMDropboxFileMetadata *> *localFileList;
  24. //获取根目录对象
  25. @property (nonatomic, readonly) KMServicesCloudFile *localRootFolder;
  26. + (instancetype) shareInstance;
  27. /** Dropbox Whether to login. */
  28. - (BOOL)isSignedIn;
  29. /** Dropbox auth/login. */
  30. - (void) authorizedLoginCompletion:(CloudLoginCallBack)completion;
  31. /** Dropbox logout. */
  32. - (void) authorizedLogoutCompletion:(CloudLogoutCallBack)completion;
  33. /**
  34. Upload local content to Dropbox cloud disk space.
  35. @param cloudPath Dropbox cloud disk space.
  36. @param localPath local file path url.
  37. @return upload operation.
  38. */
  39. - (KMCloudOperation *)uploadCloudPath:(KMServicesCloudFile *)cloudPath
  40. localPath:(NSURL *)localPath
  41. currentConvetProgress:(CurrentProgressCallBack)currentProgress
  42. completion:(CompletionCallBack)completion;
  43. /**
  44. Dropbox cancel upload operation.
  45. @param operation upload operation
  46. */
  47. - (void) uploadCancel:(KMCloudOperation *)operation;
  48. /**
  49. Download files from Dropbox cloud disk to local space.
  50. @param cloudPath Dropbox cloud disk space.
  51. @param localPath local space path url.
  52. @return download operation.
  53. */
  54. - (KMCloudOperation *)downloadCloudPath:(KMServicesCloudFile *)cloudPath
  55. localPath:(NSURL *)localPath
  56. currentConvetProgress:(CurrentProgressCallBack)currentProgress
  57. completion:(CompletionCallBack)completion;
  58. /**
  59. Dropbox cancel download operation.
  60. @param operation download operation
  61. */
  62. - (void) downloadCancel:(KMCloudOperation *)operation;
  63. /**
  64. Delete Dropbox file based on file object.
  65. @param fileData dropbox file metadata
  66. */
  67. -(void) deleteFileWithPath:(KMServicesCloudFile *)fileData
  68. completion:(CloudDeleteFileCallBack)completion;
  69. /**
  70. Create Dropbox folder based on file object.
  71. @param fileData dropbox file metadata.
  72. @param folderName Created folder name.
  73. */
  74. -(void) createFolderWithPath:(KMServicesCloudFile *)fileData
  75. folderName:(NSString *)folderName
  76. completion:(CreateFolderCallBack)completion;
  77. /**
  78. Get Dropbox file list based on file object.
  79. @param fileData dropbox file metadata. Root folder is 'localRootFolder'
  80. @param responseBlock succeed block
  81. */
  82. - (void) getListWithFilePath:(KMServicesCloudFile *)fileData
  83. setResponseBlock:(GetFileListCallBack)responseBlock;
  84. - (KMServicesCloudFile *)cloudFolderCacheForDisPath:(NSString *)path;
  85. @end
  86. NS_ASSUME_NONNULL_END