@interface SASendTask : SATask
- (instancetype)initWithFileUrls:(NSArray *)urls;
@end
@interface SAReceiveTask : SATask
- (instancetype)initWithKey:(NSString *)key destDirPath:(NSString *)destDirPath;
@end
Parameters | |
---|---|
urls | The file list to send |
Parameters | |
---|---|
key | The KEY for sending files |
destDirPath | The folder path for receiving files |
@interface SATask : NSObject
- (void)start;
- (void)await;
- (void)cancel;
@end
Set your API key.
Parameters | |
---|---|
key | Your API Key. |
Start a task for sending or receiving files.
Wait until the task is finished.
Stop and cancel the running task.
@protocol SATaskDelegate <NSObject>
- (void)task:(SATask *)task transferPreparing:(SAPreparingDetailState)state;
- (void)task:(SATask *)task fileInfo:(id<SAFileInfo>) fileInfo transferring:(SATransferDetailState)state;
- (void)task:(SATask *)task transferFinished:(SAFinishedDetailState)state;
- (void)task:(SATask *)task error:(SAErrorDetailState)state;
@end
- (void)task:(SATask *)task transferPreparing:(SAPreparingDetailState)state;
typedef NS_ENUM(NSInteger, SAPreparingDetailState) {
SAPreparingDetailUndefined,
SAPreparingDetailUpdatedKey,
SAPreparingDetailUpdatedFileList,
};
- (void)task:(SATask *)task fileInfo:(id<SAFileInfo>) fileInfo transferring:(SATransferDetailState)state;
typedef NS_ENUM(NSInteger, SATransferDetailState) {
SATransferDetailTransferring,
};
- (void)task:(SATask *)task transferFinished:(SAFinishedDetailState)state;
typedef NS_ENUM(NSInteger, SAFinishedDetailState){
SAFinishedDetailUndefined,
SAFinishedDetailSuccess,
SAFinishedDetailCancel,
SAFinishedDetailError
};
- (void)task:(SATask *)task error:(SAErrorDetailState)state;
typedef NS_ENUM(NSUInteger, SAErrorDetailState) {
SAErrorDetailUndefined,
SAErrorDetailWrongAPIKey,
SAErrorDetailServer,
SAErrorDetailNoRequest,
SAErrorDetailNoExistFile,
SAErrorDetailFileNoDownloadPath,
SAErrorDetailFileNoDiskSpace,
SAErrorDetailNoExistKey,
};
- SAPreparingDetailUpdatedKey
- SAPreparingDetailUpdatedFileList
- SATransferDetailTransferring
- SATransferDetailTransferring
- ...
- SATransferDetailTransferring
- SATransferDetailTransferring
- SAFinishedDetailSuccess
- SAFinishedDetailCancel
- SAFinishedDetailError
- SAPreparingDetailUpdatedFileList
@protocol SAFileInfo <NSObject>
@property (nonatomic, readonly) NSURL *url; // File URL
@property (nonatomic, readonly) NSString *pathName; // Relative file path
@property (nonatomic, readonly) long long transferSize; // transfered file size in bytes
@property (nonatomic, readonly) long long totalSize; // file size in bytes
@end