123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- #import <Foundation/Foundation.h>
- #import <AppKit/AppKit.h>
- #import "KMServicesCloudFile.h"
- #import "GTLRDrive.h"
- #define KMBoxName @"Box"
- #define KMDropboxName @"Dropbox"
- extern NSString *const KMServerCloudFileManagerDownloadStateChangeNotification;
- extern NSString *const KMServerCloudFileManagerDownloadSuccessfulNotification;
- extern NSString *const KMServerCloudFileManagerDownloadFailureNotification;
- extern NSString *const KMServerCloudFileManagerUploadSuccessfulNotification;
- extern NSString *const KMServerCloudFileManagerUploadFailureNotification;
- typedef enum {
- KMNone = 0,
- KMDropbox ,
- KMGoogleDrive ,
- }KMServerType;
- typedef void(^CloudLoginCallBack)(id cloudFile, BOOL finished);
- typedef void(^CloudLogoutCallBack)(BOOL finished);
- typedef void(^CloudDeleteFileCallBack)(KMServicesCloudFile *cloudFile, BOOL finished);
- typedef void(^CreateFolderCallBack)(KMServicesCloudFile *cloudFile, BOOL finished);
- typedef void(^GetFileListCallBack)(NSArray<KMServicesCloudFile *> *fileList,KMServerType serviceType,NSError *error);
- typedef void(^CurrentProgressCallBack)(KMServicesCloudFile *cloudFile,CGFloat loadProgress);
- typedef void(^CompletionCallBack)(KMServicesCloudFile *cloudFile,BOOL finished);
- @class KMCloudOperation;
- @interface KMCloudServer : NSObject
- {
- NSMutableArray<KMCloudOperation *> *operationArr;
- NSMutableArray<KMServicesCloudFile *> *DropboxLocalFileList;
- NSMutableArray<KMServicesCloudFile *> *GoogleDriveLocalFileList;
- }
- @property (nonatomic, strong) NSMutableArray<KMServicesCloudFile *> *DropboxLocalFileList;
- @property (nonatomic, strong) NSMutableArray<KMServicesCloudFile *> *GoogleDriveLocalFileList;
- @property (nonatomic, strong) NSMutableArray<KMCloudOperation *> *operationArr;
- @property (nonatomic, readonly) KMServicesCloudFile *localRootFolder;
- @property (nonatomic, assign) KMServerType serverType;
- @property (nonatomic, assign) NSInteger index;
- @property (nonatomic, copy) NSString *accountId;
- @property (nonatomic, copy) NSString *userEmail;
- + (NSArray <KMCloudServer *>*)getAllLoginServer;
- + (BOOL)networkConnectionStatus;
- + (BOOL)isConnectionAvailable;
- - (id) initCloudWithServerType:(KMServerType)type;
- - (BOOL)isSignedIn;
- - (void) authorizedLoginCompletion:(CloudLoginCallBack)completion;
- - (void) authorizedLogoutCompletion:(CloudLogoutCallBack)completion;
- - (KMCloudOperation *)uploadCloudPath:(KMServicesCloudFile *)cloudPath
- localPath:(NSURL *)localPath
- currentConvetProgress:(CurrentProgressCallBack)currentProgress
- completion:(CompletionCallBack)completion;
- - (void) uploadCancel:(KMCloudOperation *)operation;
- - (KMCloudOperation *)downloadCloudPath:(KMServicesCloudFile *)cloudPath
- localPath:(NSURL *)localPath
- currentConvetProgress:(CurrentProgressCallBack)currentProgress
- completion:(CompletionCallBack)completion;
- - (void) downloadCancel:(KMCloudOperation *)operation;
- -(void) deleteFileWithPath:(KMServicesCloudFile *)fileData
- completion:(CloudDeleteFileCallBack)completion;
- -(void) createFolderWithPath:(KMServicesCloudFile * )fileData
- folderName:(NSString *)folderName
- completion:(CreateFolderCallBack)completion;
- - (void)getListWithFilePath:(KMServicesCloudFile *)fileData
- setResponseBlock:(GetFileListCallBack)responseBlock;
- - (NSArray<KMCloudOperation *> *) operations;
- - (KMServicesCloudFile *)cloudFolderCacheForDisPath:(NSString *)path;
- - (KMServicesCloudFile *)getUpperPathCloudFolder:(KMServicesCloudFile *)file;
- @end
- @interface KMCloudServer (Additions)
- + (BOOL)networkConnectionStatusOnceAlertWhileNetworkNotReachable;
- + (BOOL)networkConnectionStatusForAdjectiveFunctionAlertWhileNetworkNotReachable;
- @end
|