Why facebook sdk won't work with ejecta and cocoonJS?

  • TheWyrm My email is actually on a different laptop so I wasn't sure how to get the file to you. So I sent it via facebook messaging. Please review your inbox,probably your other/spam folder for the zip file.

  • TheWyrm,

    Thatis the fully licensed version in addition to the cocoonjs features currently in the works. So please make sure not to share with anyone.

  • Don't worry I wouldn't ever do something like that. I'll give it a test on Google Play first and we'll go from there. FYI I can test all the platforms for you at some point since I am distributing my games to as many as possible. That includes iOS, Android, Blackberry, Windows phone and Tizen. Your work is appealing to me for that reason because I need plugins that also work cross platform. Anyway, I'll give it whirl and let you know.

  • TheWyrm

    Thanks

  • calimaborges Ok my first attempt didnt work but I think I might know why now. I didn't use any of the cocoonjsfeatures(so I didn't take into account webview versus canvas) If your plugin worked up until recently then it could be a couple of things related to Facebook upgrading its api to 2.0. First the sdk file no longer ends in an all.js, instead it should be the following //connect.facebook.net/en_US/sdk.js so an sdk.js. Finally the fb.init function has been changed. The channel file is no longer necessary and a new item called version is included.

    FB.init({

    appId : parseInt(list1),

    xfbml : xfbmlvar,

    cookie : cookievar,

    status : statusvar,

    frictionlessRequests : frictionvar,

    version : 'v2.0'

    });

    notice the version has been set to v2.0 not just 2.0.

    Another issue is how you are grabbing achievement information. You should remove it because it requires an app access token for that request. You don't have that saved so it's going to fail when you call it.

    FB.api(srv.applicationID + '/achievements', function(achievementsInfo) {

    if (!achievementsInfo.error) {

    srv.allAchievementInfo = {};

    for (var i = 0; i < achievementsInfo.data.length; i++) {

    var achievementInfo = achievementsInfo.data;

    srv.allAchievementInfo[ achievementsInfo.data.id ]= achievementsInfo.data;

    }

    if ( srv.abstractToSocialGamingAchievementMap ) {

    for( var i=0; i<achievementsInfo.data.length; i+=1 ) {

    var serviceAchievementId= achievementsInfo.data.id;

    if ( !srv.abstractToSocialGamingAchievementMapInverse[ serviceAchievementId ] ) {

    console.log(" service achievement '"+serviceAchievementId+"' has no abstract couterpart.");

    }

    }

    }

    Those are the only glaring items I can find atm. Please try those changes in your plugin.

  • Well still nothing. Did those changes but the error remains.

    I have an idea though. In the past I had to embed CocoonJS_Social_Facebook.js inside my runtime.js in order for it to work (I believe it wasn't being included if I didn't do that). But now, I noticed it is really outdated. So, I will try to embed the new version (https://bitbucket.org/ludei/cocoon_coco ... s?at=2.0.2), do the necessary adjustments and see how it goes.

  • calimaborges Ok, sounds good. Let us know how you progress.

  • In the advanced settings on your developer.facebook.com app there is one addition setting you need to set. Set embedded browser oauth to enabled as it states here:https://developers.facebook.com/docs/facebook-login/security

  • , even with this modification it kept not working.

    Good news though, I managed to login and get the session object. I believe the real problem was the migration from CocoonJS 1.4* to 2.*. Somethings changed when dealing with Cocoon's native calls to Facebook . Some more hours of coding and I will have it working.

    If you are curious of what I have done until now, here it is: https://gist.github.com/calimaborges/97 ... 5718223968

    It is just a login test though...

    The CocoonJS.Social.FacebookEvent and CocoonJS.Social.FacebookExtension classes were copied from: https://bitbucket.org/ludei/cocoon_coco ... acebook.js

    Although, I won't use this wrappers anymore, since they actually consider that CocoonJS might not be available. Instead I will just make the native calls, like:

     
    CocoonJS.makeNativeExtensionObjectFunctionCall(this.nativeExtensionName, "init", [options], true); // Line 55 of gist
    [/code:l5mrb32z]
    By doing this I will give Construct 2's user the responsibility to check if CocoonJS is enabled. If it is than use my plugin, else use Construct 2's native Facebook extension.
  • Awesome job

  • calimaborges

    Yah I bet, when it comes to cocoonjs I haven't got a clue. I just recently realized you need to use something called a webview. Lol, glad you got it working. people are going to absolutely love you.

  • calimaborges

    Awesome! Is your plugin ready to be tested? If so I'll give it ago.

    If all goes well it maybe worth integrating your work into the official opensource plugin => https://github.com/ludei/Construct-2-plugin. So many people have been asking for this feature so it will really help out a lot of people. Thank you!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • He is awesome. Round of applause. I don't think it's officially ready from the sounds of it. Just the session data means the user access token and such. He needs to build in the extra features. I don't mind helping with that but he'll need to translate it to cocoonjs because that whole system is over my head. Lol

  • Thank you! =)

    It is not ready yet. I plan to work on it tonight. If nothing creepy happens I will probably have most features working by tomorrow morning.

  • Just made a push to github (https://github.com/calimaborges/constru ... ded-plugin)

    It is not ready yet. Here is a status list of what should and shouldn't work:

    On Facebook ready: it is implemented using setTimeout for now to maintain compatibility (very bad, I know). This trigger will disappear in the future.

    Is logged in to Facebook: OK

    Request login: OK

    On Facebook login succeeded: OK

    On Facebook login failed: OK (but prints error on console. I will investigate why.)

    Request logout: OK

    On Facebook logout: OK

    -----

    Request user score: Not implemented yet

    On score received: Not implemented yet

    Submit score of int(n): Not implemented yet

    On score submit success: Not implemented yet

    Request Facebook scoreboard: Not implemented yet

    On score info arrived: Not implemented yet

    I plan to complete most of the not implemented features tomorrow.

    I created readme.md file with some very basic instructions.

    I also added a capx example file. You should be able to open it fill the App ID, export it to Cocoon and test it into a Custom CocoonJS Launcher with Ludei's compile properties and Facebook properly configured for it.

    If you have any trouble testing it or if you have any suggestions please talk to me.

    Thank you.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)