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

Discussion and feedback on Construct 2

Post » Thu Aug 21, 2014 8:59 pm

@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.
www.h1k3.tech

We are here for you!
B
87
S
22
G
16
Posts: 715
Reputation: 16,785

Post » Thu Aug 21, 2014 9:03 pm

@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. :)
www.h1k3.tech

We are here for you!
B
87
S
22
G
16
Posts: 715
Reputation: 16,785

Post » Thu Aug 21, 2014 9:38 pm

@lanceal 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.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Thu Aug 21, 2014 9:47 pm

@TheWyrm

Thanks :)
www.h1k3.tech

We are here for you!
B
87
S
22
G
16
Posts: 715
Reputation: 16,785

Post » Thu Aug 21, 2014 11:23 pm

@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[i];
srv.allAchievementInfo[ achievementsInfo.data[i].id ]= achievementsInfo.data[i];
}

if ( srv.abstractToSocialGamingAchievementMap ) {
for( var i=0; i<achievementsInfo.data.length; i+=1 ) {
var serviceAchievementId= achievementsInfo.data[i].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. :)
www.h1k3.tech

We are here for you!
B
87
S
22
G
16
Posts: 715
Reputation: 16,785

Post » Tue Aug 26, 2014 8:20 am

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.
B
4
Posts: 9
Reputation: 243

Post » Tue Aug 26, 2014 9:57 am

@calimaborges Ok, sounds good. Let us know how you progress.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Tue Aug 26, 2014 2:38 pm

@calimborges

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
www.h1k3.tech

We are here for you!
B
87
S
22
G
16
Posts: 715
Reputation: 16,785

Post » Wed Aug 27, 2014 5:19 am

@lanceal, 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:
Code: Select all
 
CocoonJS.makeNativeExtensionObjectFunctionCall(this.nativeExtensionName, "init", [options], true); // Line 55 of gist

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.
B
4
Posts: 9
Reputation: 243

Post » Wed Aug 27, 2014 10:08 am

Awesome job :)
www.h1k3.tech

We are here for you!
B
87
S
22
G
16
Posts: 715
Reputation: 16,785

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 9 guests