mergDropboxSync

mergDropboxSync is an iOS external for interacting with a user's Dropbox account. The external enables you to upload
and download files, create folders and manage the files on the user's Dropbox account. mergDropboxSync includes the Dropbox Sync SDK for iOS by Evenflow, Inc. The Dropbox Sync SDK handles all the syncing of files for you and allows you to interact with your app directory just like a local file system. The minimum iOS version the SDK supports is 5.1.

Copyright (c) 2010 Dropbox (Evenflow, Inc.), https://getdropbox.com/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

command mergDropboxSetup pAppKey,pAppSecret

Initialises the Dropbox SDK with your Dropbox app details. Create your app at https://www.dropbox.com/developers/apps.

Parameters:

  • pAppKey - the application key for your Dropbox app
  • pAppSecret - the application secred for your Dropbox app

command mergDropboxLink

Link the user's Dropbox account with your Dropbox app. After invoking this command, a "urlWakeUp" message will be sent to the stack when the user has finished linking the app. Your stack needs to respond to this by passing the URL to mergDropboxHandleOpenURL. Note that for this to work you also need to set your app to respond to the custom URL scheme defined "db-"+your Dropbox app key, in the Standalone Application Settings.

command mergDropboxUnlink

Unlink the user's account with your Dropbox app

command mergDropboxHandleOpenURL pURL

Called after linking to update the SDK. To enable your iOS app to recieve the urlWakeUp message enter "db-"+your Dropbox app key

Parameters:

  • pURL - the url that dropbox lauches your app with after authentication

Code sample

on urlWakeUp pURL
  mergDropboxHandleOpenURL pURL
end urlWakeUp

function mergDropboxIsLinked

Checks to see if the user's account is linked to your Dropbox app. Note that when your app returns from linking the value will not be true until you have called mergDropboxHandleOpenURL.

Returns boolean

function mergDropboxCompletedFirstSync

Checks to see if the filesystem as completed the first sync and is ready to use.

Returns boolean

Code sample

on preOpenStack
   if the environment is "mobile" then
      mergDropboxSetup "yourappkey","yourappsecret","app"
      if mergDropboxIsLinked()  then
         -- change ui to allow user to unlink account
      else
         -- change ui to allow user to link account
      end if
   end if
end preOpenStack

function mergDropboxGetFolders pFolder

Get a list of folders in a folder.

Parameters:

  • pFolder - A path to the folder

Returns The list of folders

function mergDropboxGetFiles pFolder

Get a list of files in a folder.

Parameters:

  • pFolder - A path to the folder

Returns The list of folders

command mergDropboxCreateFolder pPath

Create a folder at pPath

Parameters:

  • pPath - A path to the folder

command mergDropboxDeletePath pPath

Delete a file or folder at pPath

Parameters:

  • pPath - A path to a file or folder

command mergDropboxWriteFile pFilePath,pData

Write a file. If there's already a file at pFilePath it will be overwritten.

Parameters:

  • pFilePath - A path to a file
  • pData - The data to write to the file

function mergDropboxGetFile pFilePath

Get the data for a file

Parameters:

  • pFilePath - A path to a file

Returns The data of the file

function mergDropboxGetFileStatus pFilePath

Get the current status of the file.

Parameters:

  • pFilePath - A path to a file

Returns The file status with the following items:

  • cached - true if the file is cached locally which means you should be able to use mergDropboxGetFile without considerable blocking
  • status - one of downloading,uploading or idle
  • progress - a value between 0 and 1
  • error - a description of any error related to the file

message mergDropboxUpdate

Sent to the control that called mergDropboxSetup whenever the SDK notices a change to the files in the Dropbox.