DBSharedApplication

Objective-C

@protocol DBSharedApplication <NSObject>

Swift

protocol DBSharedApplication : NSObjectProtocol

Protocol implemented by platform-specific builds of the Obj-C SDK for properly rendering the OAuth linking flow.

  • Presents a platform-specific error message, and halts the auth flow.

    Declaration

    Objective-C

    - (void)presentErrorMessage:(nonnull NSString *)message
                          title:(nonnull NSString *)title;

    Swift

    func presentErrorMessage(_ message: String, title: String)

    Parameters

    message

    String to display which describes the error.

    title

    String to display which titles the error view.

  • Presents a platform-specific error message, and halts the auth flow. Optional handlers may be provided for view display buttons (mainly useful in the mobile case).

    Declaration

    Objective-C

    - (void)
        presentErrorMessageWithHandlers:(nonnull NSString *)message
                                  title:(nonnull NSString *)title
                         buttonHandlers:
                             (nonnull NSDictionary<NSString *, void (^)(void)> *)
                                 buttonHandlers;

    Swift

    func presentErrorMessage(withHandlers message: String, title: String, buttonHandlers: [String : () -> Void])

    Parameters

    message

    String to display which describes the error.

    title

    String to display which titles the error view.

    buttonHandlers

    Map from button name to button handler.

  • Presents platform-specific authorization paths.

    This method is called before more generic, platform-neutral auth methods. For example, in the mobile case, the Obj-C SDK will use a direct authorization route with the Dropbox mobile app, if it is installed on the current device.

    Declaration

    Objective-C

    - (BOOL)presentPlatformSpecificAuth:(nonnull NSURL *)authURL;

    Swift

    func presentPlatformSpecificAuth(_ authURL: URL) -> Bool

    Parameters

    authURL

    Gateway url to commence auth flow.

  • Presents platform-neutral auth flow.

    Declaration

    Objective-C

    - (void)presentAuthChannel:(nonnull NSURL *)authURL
                 cancelHandler:(nonnull DBOAuthCancelBlock)cancelHandler;

    Swift

    func presentAuthChannel(_ authURL: URL, cancelHandler: @escaping DBOAuthCancelBlock)

    Parameters

    authURL

    Gateway url to commence auth flow.

    cancelHandler

    Handler for cancelling auth flow. Opens “cancel” url to signal cancellation.

  • Opens external app to handle url.

    This method opens whichever app is registered to handle the type of the supplied url, and then passes the supplied url into the newly opened app.

    Declaration

    Objective-C

    - (void)presentExternalApp:(nonnull NSURL *)url;

    Swift

    func presentExternalApp(_ url: URL)

    Parameters

    url

    Url to open with external app.

  • Checks whether there is an external app registered to open the url type.

    Declaration

    Objective-C

    - (BOOL)canPresentExternalApp:(nonnull NSURL *)url;

    Swift

    func canPresentExternalApp(_ url: URL) -> Bool

    Parameters

    url

    Url to check.

    Return Value

    Whether there is an external app registered to open the url type.

  • Presents platform-specific loading UX indicating an async operation is ongoing and potentially blocking user interaction while loading.

    Declaration

    Objective-C

    - (void)presentLoading;

    Swift

    func presentLoading()
  • Dismisses loading UX.

    Declaration

    Objective-C

    - (void)dismissLoading;

    Swift

    func dismissLoading()