SimplicityMobile / Simplicity

A simple way to implement Facebook and Google login in your iOS apps.
Apache License 2.0
681 stars 66 forks source link

Open app if installed in providers #16

Closed rgnlax closed 7 years ago

rgnlax commented 7 years ago

Hello, Edward.

I've little bit modified sources, and now there is an ability to open Vkontakte and Facebook apps if they are installed, if not - safari will be opened. I've created VkProvider and FbProvider with corresponding logic inside, and then Simplicity.swift and linkhandler.

edjiang commented 7 years ago

Hey @rgnlax, thanks for the pull request! I've actually thought about this a bit, so let me explain my POV on why SDKs have been using SFSafariViewController instead of opening up the native apps. I'd love to hear your feedback on whether or not its valid, and whether or not you think this PR is still useful afterwards.

Facebook has started using SFSafariViewController as the preferred method for doing FB login from iOS9+. Why? Several reasons:

  1. In iOS 9, SFSafariViewController shares cookies with the main Safari instance, which means users don't have to type in their credentials (when compared to WKWebView or UIWebView)
  2. SFSafariViewController is faster than redirecting a user to an external app, and seeing those redirects.
  3. In iOS 9, apps have to declare in Info.plist which URL Schemes it will query, to prevent advertisers / analytics tools from querying for other apps installed on the system. See link for more details. This is more setup work for a developer.
  4. iOS 9 also displays an alert view asking: "XYZ app would like to open Facebook" when you link into another application. This is yet another click for a user, vs. using a web view.

So -- Facebook is preferring SFSafariViewController in iOS9+ in their SDKs, but does use the old app linking strategy in older versions of iOS. Since iOS9 has relatively high usage right now, I don't think we really need to work hard for iOS8 and below users.

I think there's some value in offering this solution (that Facebook doesn't do in iOS 9 and below) but I'm worried that this won't help developer offer the best user experience, and also might be deprecated in the future anyways.

Thoughts?

edjiang commented 7 years ago

Looks like you're maintaining a fork for your own use @rgnlax -- feel free to respond to the thoughts I listed above, otherwise I'll close this for now =]