KMGoogleDriveManager.h 3.2 KB

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