Giter Site home page Giter Site logo

sendanywhere-ios-sdk's Introduction

SendAnywhere-IOS-SDK

Task Constructor

@interface SASendTask : SATask
- (instancetype)initWithFileUrls:(NSArray *)urls;
@end

@interface SAReceiveTask : SATask
- (instancetype)initWithKey:(NSString *)key destDirPath:(NSString *)destDirPath;
@end

SASendTask

Parameters
urls The file list to send

ReceiveTask

Parameters
key The KEY for sending files
destDirPath The folder path for receiving files

Public method

@interface SATask : NSObject
- (void)start;
- (void)await;
- (void)cancel;
@end

static void init(String key)

Set your API key.

Parameters
key Your API Key.

void start()

Start a task for sending or receiving files.

void await()

Wait until the task is finished.

void cancel()

Stop and cancel the running task.

Delegate for 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

Delegate for prepared transfering

- (void)task:(SATask *)task transferPreparing:(SAPreparingDetailState)state;
typedef NS_ENUM(NSInteger, SAPreparingDetailState) {
    SAPreparingDetailUndefined, 
    SAPreparingDetailUpdatedKey,
    SAPreparingDetailUpdatedFileList,
    
};

Delegate for transfering

- (void)task:(SATask *)task fileInfo:(id<SAFileInfo>) fileInfo transferring:(SATransferDetailState)state;
typedef NS_ENUM(NSInteger, SATransferDetailState) {
    SATransferDetailTransferring,
};

Delegate for finished transfering

- (void)task:(SATask *)task transferFinished:(SAFinishedDetailState)state;
typedef NS_ENUM(NSInteger, SAFinishedDetailState){
    SAFinishedDetailUndefined,
    SAFinishedDetailSuccess,
    SAFinishedDetailCancel,
    SAFinishedDetailError
};

Delegate for error

- (void)task:(SATask *)task error:(SAErrorDetailState)state;
typedef NS_ENUM(NSUInteger, SAErrorDetailState) {
    SAErrorDetailUndefined,
    SAErrorDetailWrongAPIKey,
    SAErrorDetailServer,
    SAErrorDetailNoRequest,
    SAErrorDetailNoExistFile,
    SAErrorDetailFileNoDownloadPath,
    SAErrorDetailFileNoDiskSpace,
    SAErrorDetailNoExistKey,
};

Flow Step

  • SAPreparingDetailUpdatedKey
    • SAPreparingDetailUpdatedFileList
      • SATransferDetailTransferring
      • SATransferDetailTransferring
      • ...
      • SATransferDetailTransferring
      • SATransferDetailTransferring
        • SAFinishedDetailSuccess
        • SAFinishedDetailCancel
        • SAFinishedDetailError

File Information

@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

sendanywhere-ios-sdk's People

Contributors

jlso avatar sleephi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.