-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSX Support #49
OSX Support #49
Conversation
…platform compatibility via better inheritance.
|
UPD. I've refactored DropboxConnectController to get rid of those "ifdef os" madness, not it looks better a bit. |
|
thanks for this! You're right that OS X is on our roadmap but since we haven't started yet it might make sense for us to work with you on this. One high level piece of feedback: I believe that using WKWebView will create a fresh session for the user inside the application. We know that the hardest part of OAuth for users is just logging in. If you could send the user to Safari/any web brower directly then they'd leverage their existing logged in session as well have some additional comfort about where they're typing in their password. To make this work in the past we require the application associates it's self with a "db-<APP_KEY>://" URL scheme so that the web browser can trigger the application after the OAuth flow complete. I believe this is the approach our very old OS X SDK takes: https://www.dropbox.com/developers-v1/core/sdks/osx Alternatively, maybe you could just use SFSafariViewController so that the browser window can leverage the user's logged in session. In practice many users can have trouble remembering passwords and they might have things like 2FA or SSO enabled so reducing friction here is pretty valuable. That said, don't spend much time on this unless you're particularly excited. There's a chance we'll want to add this functionality entirely ourselves, though I'm optimistic we might be able to work together. Will figure out the plan for this soon. |
|
Thanks for the reply. Authentification code looks like much clearer now: //Use direct auth
if application.canOpenURL(dAuthURL(nil)) {
self.directAuth({ (nonce) -> Void in
application.openURL(self.dAuthURL(nonce))
})
//Use Browser Auth
} else if BrowserAuth.available() {
self.browserAuth(self.authURL(), redirectHandler: { (url) -> Void in
//Check for url returned
guard let redirectURL = url else { return }
//Handle it
application.openURL(redirectURL)
})
//Fallback to WebView Auth
} else {
self.webViewAuth(self.authURL(), controller: controller, redirectHandler: { (url) -> Bool in
if self.canHandleURL(url) {
application.openURL(url)
return true
} else {
return false
}
})
} |
b49e9b5
to
b4bf702
Compare
5fbad95
to
5253602
Compare
|
Fixed by ab71ab5. |
Hello, everyone.
So, this is the pull request with OSX support. Basically I don't expect you will merge it very quickly, because I pretty sure you have 'Support OSX' task in your backlog and you have a plan how to do it, but this code works good for my iOS/OSX projects and I like to share it.
I've tried to do my best to not overcode with "#if os", but some parts of code still looks ugly (as for me. For ex. DropboxConnectController), maybe you'll have some suggestions how to simplify it?
I've also prepared quick working example, please check it out:


https://github.com/Krivoblotsky/SwiftyDropboxExample
Any feedback and questions are appreciated.
Thanks.