pc035860 / angular-easyfb

Super easy AngularJS + Facebook JavaScript SDK.
MIT License
440 stars 69 forks source link

Support Apache Cordova Facebook Plugin #16

Closed pc035860 closed 10 years ago

pc035860 commented 10 years ago

https://github.com/phonegap/phonegap-facebook-plugin http://docs.phonegap.com/en/1.0.0/phonegap_events_events.md.html

pc035860 commented 10 years ago

Deferred due to no immediate requirements.

wzr1337 commented 10 years ago

I'd e interested in using the cordova plugin with easyfb for an app that I am working on.

I'll try to replace the remote with the local address first, maybe that is already all I need to do

pc035860 commented 10 years ago

Reopen time!

Gonna make some commits tomorrow.

pc035860 commented 10 years ago

Hi @wzr1337 ,

I just pushed some code to develop. Here's an example: http://plnkr.co/edit/ynZkaB?p=preview

To work with the cordova facebook plugin example:

<!-- facebook js sdk -->
<script src="facebook-js-sdk.js"></script>
// angular config phase
.config(function ($FBProvider) {
  $FBProvider.setInitParams({
    appId: "{APP ID}", 
    nativeInterface: CDV.FB, 
    useCachedDialogs: false 
  });

  $FBProvider.setLoadSDKFunction(function ($document, $fbAsyncInit) {
    // No more async fb js sdk loading here, it's covered in the HTML

    $document.on('deviceready', function () {
      $fbAsyncInit();
    });
  });
})

If you feel confused about how $FBProvider.setLoadSDKFunction() works, check out the default function here: https://github.com/pc035860/angular-easyfb/blob/develop/angular-easyfb.js#L65

I don't have any device to test for the cordova framework for now. I'll try to test it next week. If you have it tried in your app, please let me know if it works.

wzr1337 commented 10 years ago

Thanks,

I will try it out this evening.. I'll keep you posted

On Saturday, February 22, 2014, Robin Fan notifications@github.com wrote:

Hi @wzr1337 https://github.com/wzr1337 ,

I just pushed some code to develop. Here's an example: http://plnkr.co/edit/ynZkaB?p=preview

To work with the cordova facebook plugin examplehttps://github.com/phonegap/phonegap-facebook-plugin/blob/master/example/Simple/index.html :

// angular config phase.config(function ($FBProvider) { $FBProvider.setInitParams({ appId: "{APP ID}", nativeInterface: CDV.FB, useCachedDialogs: false }); $FBProvider.setLoadSDKFunction(function ($document, $fbAsyncInit) { // No more async fb js sdk loading here, it's covered in the HTML ``` $document.on('deviceready', function () { $fbAsyncInit(); }); ``` });}) If you feel confused about how $FBProvider.setLoadSDKFunction() works, check out the default function here: https://github.com/pc035860/angular-easyfb/blob/develop/angular-easyfb.js#L65 I don't have any device to test for the cordova framework for now. I'll try to test it next week. If you have it tried in your app, please let me know if it works. — Reply to this email directly or view it on GitHubhttps://github.com/pc035860/angular-easyfb/issues/16#issuecomment-35798960 .

Register on http://zwoup.com for the next Generation Shopping List on your smartphone.

wzr1337 commented 10 years ago

I seem to have no luck here.

I set up a project, installed the plugin and added your plunkr files to the www folder. I can not say if $fbInitAsync() is being called successfully, because $FB.$$ready remains false.

If I then click on "login()", I get a blank screen an nothing more. The only output I get in the console is:

2014-02-22 21:38:07.482 HelloCordova[41724:70b] Resetting plugins due to page load.
2014-02-22 21:38:07.761 HelloCordova[41724:70b] Finished load of: https://m.facebook.com/dialog/oauth?app_id=352423428164607&client_id=352423428164607&display=touch&domain=&e2e=%7B%7D&locale=en_US&origin=2&redirect_uri=http%3A%2F%2Fstatic.ak.facebook.com%2Fconnect%2Fxd_arbiter.php%3Fversion%3D40%23cb%3Df85f70edc%26domain%3D%26origin%3Dfile%253A%252F%252F%252Ff23be2416c%26relation%3Dopener%26frame%3Dfca316da&response_type=token%2Csigned_request&scope=email%2Cuser_likes&sdk=joey

The URL being called looks pretty weird.. I assume I get back an error from facebook that is not displayed anywhere.. Do you know how I could debug the repsonse?

wzr1337 commented 10 years ago

Got it running, your sample missed to include:

<!-- cordova -->
<script src="cordova.js"></script>
<!-- cordova facebook plugin -->
<script src="cdv-plugin-fb-connect.js"></script>

I posted the adapted sample here:

http://plnkr.co/edit/d19s0Gm0WeAki2pYKdgp

pc035860 commented 10 years ago

@wzr1337 Thanks a lot!

Sorry I didn't make it clear. I was actually hoping to test with the official simple example available at https://github.com/phonegap/phonegap-facebook-plugin/blob/master/example/Simple/index.html, whose initialization was via calling FB.init() in deviceready event handler.

Anyway, it'll be available in the next release since it works! Really appreciated!

scripta55 commented 8 years ago

does this still work? i see on issue 34 (https://github.com/pc035860/angular-easyfb/issues/34) it became a problem after the rewrite...