mobilemindtec / nativescript-google

3 stars 3 forks source link

Using nativescript-google-plus and nativescript-facebook #1

Open NeerajBah opened 8 years ago

NeerajBah commented 8 years ago

I am trying to implement both G+ and FB login in my application. I am not sure how should I write the Delegate(MyDelegate) for both of them to work. Can you please help.

mobilemindtec commented 8 years ago

Hi,

On demo app has app.ios.js with delegate implementation.

votiakov commented 7 years ago

Hello @NeerajBah !

You should use both Google and Facebook sdk to handle url and then return true if one the handlers returns true.

For example as you can see from the readme of this plugin you should delegate url to google sdk like this:

    MyDelegate.prototype.applicationOpenURLSourceApplicationAnnotation = function (application, url, sourceApplication, annotation) {
        return GIDSignIn.sharedInstance().handleURLSourceApplicationAnnotation(url, sourceApplication, annotation);
    };

If you want to use both facebook and google you should do it like this:

    applicationOpenURLSourceApplicationAnnotation(application, url, sourceApplication, annotation) {
      let fcbDelegate = FBSDKApplicationDelegate.sharedInstance().applicationOpenURLSourceApplicationAnnotation(application, url, sourceApplication, annotation); // facebook login delegate
      let gglDelegate = GIDSignIn.sharedInstance().handleURLSourceApplicationAnnotation(url, sourceApplication, annotation); // google login delegate

      return fcbDelegate || gglDelegate;
    }