Giter Site home page Giter Site logo

a-why-not-fork-repositories-good-luck / sendanywhere-ios-ui-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from estmob/sendanywhere-ios-ui-sdk

0.0 1.0 0.0 91.9 MB

License: MIT License

Shell 24.70% Ruby 1.62% C 34.47% Objective-C 29.09% Swift 10.11%

sendanywhere-ios-ui-sdk's Introduction

SendAnywhere

Version License Platform Twitter Facebook

The simplest way to Send files Anywhere

Prequisites

Please issue your API key from following link first: https://send-anywhere.com/web/page/api

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like SendAnywhereSDK in your projects. You can install it with the following command:

$ gem install cocoapods

Podfile

To integrate SendAnywhereSDK into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target 'TargetName' do
pod 'SendAnywhereSDK'
end

Then, run the following command:

$ pod install

Requirements

Minimum iOS Target iOS 8

Troubleshooting

If you have any problem or questions with Send Anywhere iOS SDK, please create new issue(https://github.com/estmob/SendAnywhere-iOS-UI-SDK/issues) or contact to our customer center(https://send-anywhere.zendesk.com).

Usage

First look at the source code of the provided demo.

Initialization

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        SendAnywhere.withKey("INPUT_YOUR_API_KEY")
        return true
}

Show a Send file UI.

do {
    let viewController = try sa_showSendView(withFiles: [fileURL])
} catch let error {

}

Show a Receive file UI.

do {
    let viewController = try sa_showReceiveView()
} catch let error {

}

If you want to download file of specific type.

// If you want to download files of document type.
SendAnywhere.sharedInstance().downloadFileFilter = [.document]

// If you want to download files of image type.
SendAnywhere.sharedInstance().downloadFileFilter = [.image]

// If you want to download files of audio type.
SendAnywhere.sharedInstance().downloadFileFilter = [.audio]

// If you want to download files of media type.
SendAnywhere.sharedInstance().downloadFileFilter = [.image, .video, .audio]

// If you want to download files of custom file pattern.
SendAnywhere.sharedInstance().customFilePattern = "((.+)(\\.(?i)(jpg|jpeg|png|gif))$)"

Send files without UI.

if let fileInfo = SAFileInfo(fileName: <fileName>, path: <filePath>, size: <fileSize>, time: <fileTime>, data: <fileData> or nil) {
    if let command = SASendCommand.makeInstance() {
        command.setParamWith([fileInfo], mode: PAPRIKA_TRANSFER_DIRECT)
        command.addPrepareObserver(<observer>)
        command.execute(completion: nil)
    }    
}

Receive files without UI.

key : 6 digit (ex. 348477)

if let command = SAReceiveCommand.makeInstance() {
    command.transferType = .receive
    command.addErrorObserver(<observer>)
    command.addPrepareObserver(<observer>)
    command.addNotifyObserver(<observer>)
    command.execute(withKey: key)
}

Transfer notification delegate.

Delegate description
SACommandPrepareDelegate update authtoken, update device id
SACommandNotifyDelegate command start, finish
SACommandErrorDelegate command error
SATransferPrepareDelegate fileListUpdated,keyUpdated etc
SATransferNotifyDelegate transfer start, progress, finish etc
SATransferErrorDelegate transfer error
SAReceiveErrorDelegate receive error (key not exists, no disk space etc)

Global notification delegate.

public protocol SAGlobalCommandNotifyDelegate : NSObjectProtocol {

    optional public func willGlobalCommandStart(_ sender: SACommand!)

    optional public func didGlobalCommandFinish(_ sender: SACommand!)

    optional public func didGlobalTransferFileListUpdated(_ sender: SATransferCommand!)

    optional public func willGlobalTransferStart(_ sender: SATransferCommand!)

    optional public func willGlobalTransferFileStart(_ sender: SATransferCommand!)

    optional public func didGlobalTransferFileFinish(_ sender: SATransferCommand!, fileIndex: Int, filePath: String!)

    optional public func didGlobalTransferFinish(_ sender: SATransferCommand!)

    optional public func didGlobalTransferError(_ sender: SATransferCommand!)
}

License

SendAnywhereSDK is available under the MIT license. See the LICENSE file for more info.

sendanywhere-ios-ui-sdk's People

Contributors

dustmob avatar doeazler 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.