dropbox / SwiftyDropbox

Swift SDK for the Dropbox API v2.
MIT License
671 stars 207 forks source link

Allow for using a custom transport client after handling dauth #405

Closed julianlocke closed 3 months ago

julianlocke commented 3 months ago

In some cases, the correct way to customize the behavior of the SDK network stack is to supply your own transport client. There is an API for this through DropboxClientsManager.setupWithAppKey( which SDK users call on app initialization.

This is sufficient for all situations but the session in which dauth is performed. On initialization prior to dauth, there is no user access token or authorized client, so the custom implementation is discarded. The existing dauth url handler API doesn't allow for a custom transport client, and calls setupAuthorizedClient without one, so currently the default transport client is used until the app is restarted.

This change allows for a custom transport client to be included in the handle redirect URL flow. This is the smallest possible change to achieve this, but down the line we should weigh pulling the customization all out into a transport client configuration object instead as the objc SDK does.