Coder Social home page Coder Social logo

Comments (32)

nodrock avatar nodrock commented on May 18, 2024

Yes, there are some minor changes. Old API had reauthorize* methods, but new FB APIs don't need this (you simply use loginWith* with new set of permissions. I also renamed openSessionWith(Read|Publish)Permissions methods to logInWith(Read|Publish)Permissions because that are the names in new FB APIs. Then there is new accessToken getter which returns FBAccessToken instance and profile getter which returns FBProfile. So there is no need to do FB graph API call to path "/me" to get userID (it's in FBAccessToken with permissions and declinedPermissions). Name, surname and other stuffs are in FBProfile. Method for closing session closeSessionAndClearTokenInformation() is simply called logOut() now ;)

from ane-facebook.

nodrock avatar nodrock commented on May 18, 2024

Also I didn't have enough time to reimplement open graph APIs so there is only shareLinkDialog() for now. I am working on appInviteDialog now because I need it ;) then there will be time for open graphs.

from ane-facebook.

j3k0 avatar j3k0 commented on May 18, 2024

Thanks for the details! Looking forward for more updates.

from ane-facebook.

nodrock avatar nodrock commented on May 18, 2024

I will add full changelog to release on monday ;)

from ane-facebook.

j3k0 avatar j3k0 commented on May 18, 2024

If this can help, here's the list of errors I see on my project that used to compile using Freshplanet's version... A wiki page documenting the alternative for each would be very helpful!

Error: Access of possibly undefined property logEnabled through a reference with static type com.freshplanet.ane.AirFacebook:Facebook.
                                fb.logEnabled = CONFIG::DEBUG;
                                   ^

Error: Incorrect number of arguments.  Expected no more than 1.
                                fb.init(FACEBOOK_APP_ID, false);
                                                         ^

Error: Access of possibly undefined property isSessionOpen through a reference with static type com.freshplanet.ane.AirFacebook:Facebook.
                        if (!fb.isSessionOpen) {
                                ^

Error: Access of possibly undefined property expirationTimestamp through a reference with static type com.freshplanet.ane.AirFacebook:Facebook.
                                log(this, "expires " + fb.expirationTimestamp);
                                                          ^

Error: Call to a possibly undefined method openSessionWithReadPermissions through a reference with static type com.freshplanet.ane.AirFacebook:Facebook.
                                fb.openSessionWithReadPermissions(FACEBOOK_READ_PERMISSIONS, handleOpenSession);
                                   ^

Error: Call to a possibly undefined method openSessionWithReadPermissions through a reference with static type com.freshplanet.ane.AirFacebook:Facebook.
                        fb.openSessionWithReadPermissions(FACEBOOK_READ_PERMISSIONS, handleOpenSession);
                           ^

Error: Call to a possibly undefined method openSessionWithReadPermissions through a reference with static type com.freshplanet.ane.AirFacebook:Facebook.
                        fb.openSessionWithReadPermissions(FACEBOOK_READ_PERMISSIONS, handleOpenSession);
                           ^

Error: Call to a possibly undefined method closeSessionAndClearTokenInformation through a reference with static type com.freshplanet.ane.AirFacebook:Facebook.
            Facebook.getInstance().closeSessionAndClearTokenInformation();
                                   ^

Error: Call to a possibly undefined method reauthorizeSessionWithPublishPermissions through a reference with static type com.freshplanet.ane.AirFacebook:Facebook.
                fb.reauthorizeSessionWithPublishPermissions(FACEBOOK_POST_PERMISSIONS, callback);
                   ^

Error: Implicit coercion of a value of type com.freshplanet.ane.AirFacebook:FBAccessToken to an unrelated type String.
            return fb.accessToken;
                      ^

Error: Call to a possibly undefined method dialog through a reference with static type com.freshplanet.ane.AirFacebook:Facebook.
            Facebook.getInstance().dialog('apprequests', params, callback);
                                   ^

from ane-facebook.

nodrock avatar nodrock commented on May 18, 2024

Hi I made first lines of migration guide. Watch it here:
https://github.com/nodrock/ANE-Facebook/wiki/Migration-guide-from-FreshPlanet-ANE

from ane-facebook.

j3k0 avatar j3k0 commented on May 18, 2024

Thanks. Got it to compile with the following changes:

-                       Facebook.getInstance().logEnabled = CONFIG::DEBUG;
+                       Facebook.logEnabled = CONFIG::DEBUG;
+                       Facebook.nativeLogEnabled = CONFIG::DEBUG;

-                       fb.init(FACEBOOK_APP_ID, false);
+                       fb.init("fb" + FACEBOOK_APP_ID);

-                       if (!fb.isSessionOpen) {
+                       if (!fb.accessToken) {

-                       fb.openSessionWithReadPermissions(FACEBOOK_READ_PERMISSIONS, handleOpenSession);
+                       fb.logInWithReadPermissions(FACEBOOK_READ_PERMISSIONS, handleOpenSession);

-            Facebook.getInstance().closeSessionAndClearTokenInformation();
+            Facebook.getInstance().logOut();

-                fb.reauthorizeSessionWithPublishPermissions(FACEBOOK_POST_PERMISSIONS, callback);
+                fb.logInWithPublishPermissions(FACEBOOK_POST_PERMISSIONS, callback);

-            return fb.accessToken;
+            return fb.accessToken != null ? fb.accessToken.tokenString : null;

-            Facebook.getInstance().dialog('apprequests', params, callback);
+            throw new Error("not implemented!");

Also not to forgot AIR app's -app.xml file.

Well.. It's not starting. Got an error that apparently arise when Facebook app is installed (?) Immediately when that app starts....

W/dalvikvm(16449): threadid=1: thread exiting with uncaught exception (group=0x41fa0700)
E/AndroidRuntime(16449): FATAL EXCEPTION: main
E/AndroidRuntime(16449): java.lang.RuntimeException: Unable to get provider com.facebook.FacebookContentProvider: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookContentProvider" on path: DexPathList[[zip file "/data/app/air.xxx.apk"],nativeLibraryDirectories=[/data/app-lib/air.xxx, /vendor/lib, /system/lib]]
E/AndroidRuntime(16449):    at android.app.ActivityThread.installProvider(ActivityThread.java:5066)
E/AndroidRuntime(16449):    at android.app.ActivityThread.installContentProviders(ActivityThread.java:4669)
E/AndroidRuntime(16449):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4609)
E/AndroidRuntime(16449):    at android.app.ActivityThread.access$1300(ActivityThread.java:153)
E/AndroidRuntime(16449):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1329)
E/AndroidRuntime(16449):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(16449):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(16449):    at android.app.ActivityThread.main(ActivityThread.java:5287)
E/AndroidRuntime(16449):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(16449):    at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime(16449):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
E/AndroidRuntime(16449):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)
E/AndroidRuntime(16449):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(16449): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.FacebookContentProvider" on path: DexPathList[[zip file "/data/app/air.xxx.apk"],nativeLibraryDirectories=[/data/app-lib/air.xxx, /vendor/lib, /system/lib]]
E/AndroidRuntime(16449):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
E/AndroidRuntime(16449):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
E/AndroidRuntime(16449):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
E/AndroidRuntime(16449):    at android.app.ActivityThread.installProvider(ActivityThread.java:5051)
E/AndroidRuntime(16449):    ... 12 more
W/ActivityManager(  499):   Force finishing activity air.xxx/.AppEntry

Seen that?

from ane-facebook.

nodrock avatar nodrock commented on May 18, 2024

You can remove FacebookContentProvider from application descriptor if you don't have sharing of images implemented (and it is not implemented in my ANE yet so you don't have it ;) ). Then it should compile.

FB documentation reference:
Note that this ContentProvider is only necessary if an application wishes to attach images, etc., that are stored in memory and do not have another way to be referenced by a content URI. For images obtained from, e.g., the Camera or Gallery, that already have a content URI associated with them, use of this class is not necessary.

from ane-facebook.

nodrock avatar nodrock commented on May 18, 2024

EDIT: sorry it should be as it is. I am not sure why it is not working.

And you have probably mistake in application descriptor.
com.facebook.FacebookContentProvider{YOUR_FB_APPLICATION_ID}
instead of
com.facebook.app.FacebookContentProvider{YOUR_FB_APPLICATION_ID}

I have to fix README

from ane-facebook.

j3k0 avatar j3k0 commented on May 18, 2024

Thanks for your answert. I actually copy-pasted this line from the README.md file and double checked with Facebook doc. Seemed right, however removing this line allows to start the app.

But now...

I/air.xxx(17107): [AirFacebook][AS3] ERROR - Extension context is null. Please check if extension.xml is setup correctly.

Sorry if I'm sending too much issues!

from ane-facebook.

nodrock avatar nodrock commented on May 18, 2024

It's ok. Actually you are the first one who is testing it. So I am grateful for feedback. Which version of AIR SDK do you use?

from ane-facebook.

j3k0 avatar j3k0 commented on May 18, 2024

Air SDK 16

from ane-facebook.

j3k0 avatar j3k0 commented on May 18, 2024

And testing on Android 4.

Side note, you added a SWC binary. Is it mandatory? Sidn't include it... there was no such thing with Freshplanet's ANE.

from ane-facebook.

nodrock avatar nodrock commented on May 18, 2024

Do you have <extensionID>com.freshplanet.AirFacebook</extensionID> in your application descriptor?
Do you test it on device?

from ane-facebook.

nodrock avatar nodrock commented on May 18, 2024

You don't need swc. It is there only for me :)

from ane-facebook.

j3k0 avatar j3k0 commented on May 18, 2024
  <extensions>
    <extensionID>com.freshplanet.AirFacebook</extensionID>
  </extensions>

Testing on device. I saw that extension is only compiled for ARM.

from ane-facebook.

j3k0 avatar j3k0 commented on May 18, 2024

Included SWC's library just to test, didn't change anything...

from ane-facebook.

nodrock avatar nodrock commented on May 18, 2024

ARM should be ok. As you can see here http://help.adobe.com/en_US/air/extensions/WS901d38e593cd1bac-3004221412afa24c001-8000.html#WS901d38e593cd1bac14557ab012afe6a6fb0-7ff9

We had some similar issue on AIR 17 but not on AIR 16 so I am curious what this can be.

from ane-facebook.

j3k0 avatar j3k0 commented on May 18, 2024

Content of APK:

├── AndroidManifest.xml
├── META-INF
│   ├── CERT.RSA
│   ├── CERT.SF
│   └── MANIFEST.MF
├── assets
│   ├── META-INF
│   │   └── AIR
│   │       ├── application.xml
│   │       └── extensions
│   │           └── com.freshplanet.AirFacebook
│   │               ├── META-INF
│   │               │   └── ANE
│   │               │       ├── Android-ARM
│   │               │       │   ├── android-support-v4.jar
│   │               │       │   ├── annotations.jar
│   │               │       │   ├── bolts-android-1.2.0.jar
│   │               │       │   ├── library.swf
│   │               │       │   └── platform.xml
│   │               │       └── extension.xml
│   │               ├── catalog.xml
│   │               └── library.swf
[...]

from ane-facebook.

j3k0 avatar j3k0 commented on May 18, 2024

I see you changed required AIR SDK from 15 to 16, a347cd9

Was that necessary? Or is it worth I try rolling it back to 15?

from ane-facebook.

nodrock avatar nodrock commented on May 18, 2024

You can try it but I don't think it will help.
I forgot my Android devices in office so I can dive deep into this issue tomorrow. I have only iOS device here so I am unable to test it somehow. When there were any problems with creating context it was always somehow related with Java version. Could you please try this version? http://www.filedropper.com/airfacebook

from ane-facebook.

j3k0 avatar j3k0 commented on May 18, 2024

Thanks for the new ANE. Will check right away and let you know.

from ane-facebook.

nodrock avatar nodrock commented on May 18, 2024

EDIT: sorry made a mistake this link please: http://www.filedropper.com/airfacebook_1

from ane-facebook.

j3k0 avatar j3k0 commented on May 18, 2024

Same with airfacebook_1

from ane-facebook.

j3k0 avatar j3k0 commented on May 18, 2024

Gosh this is frustrating ;)

from ane-facebook.

nodrock avatar nodrock commented on May 18, 2024

Now I found out that I built ANE with AIR 18. Is it possible for you to try using AIR 18 for compiling your project? Or I can try to build you ANE with AIR 16.

from ane-facebook.

j3k0 avatar j3k0 commented on May 18, 2024

OK! Well, I'd rather not upgrade right now... If possible to build with AIR 16 it would be perfect, also useful to provide to others, right?

from ane-facebook.

nodrock avatar nodrock commented on May 18, 2024

Ok so as last try today I am sending you build with AIR 16. Let me know if it is working. http://www.filedropper.com/airfacebook_2

from ane-facebook.

j3k0 avatar j3k0 commented on May 18, 2024

Thanks a lot for Sunday support. Will let you know of course.

from ane-facebook.

j3k0 avatar j3k0 commented on May 18, 2024

Same thing... Extension context is null

Well, I'll try upgrading AIR SDK see how it goes.

from ane-facebook.

nodrock avatar nodrock commented on May 18, 2024

I found the problem. New Facebook Android SDK need Java 1.7 so I updated build to use this Java. But if you use ANE build with Java 1.7 in AIR 16 app context is not created. I tried to modify FB SDK to work with Java 1.6 but then there are some problems with linkage:
...
06-29 11:13:52.703: W/dalvikvm(6366): Unable to resolve superclass of Lcom/facebook/FacebookActivity; (219)
06-29 11:13:52.703: W/dalvikvm(6366): Link of class 'Lcom/facebook/FacebookActivity;' failed
...
Maybe there will be some way to override this but I am not going to. (Mainly because I expect that newer FB SDKs will use other Java 1.7 features and it may be impossible to make it backward compatible with 1.6) I can send you patch witch modifications that I have made but you have to finish it.

Result: I am going to add note about using AIR 18 only when using this ANE.

I hope you will have no problems to update AIR 16 to AIR 18 in your project (we had a lot of issues with AIR 17 but none with AIR 18 yet).
Thank you for your participation

patch: https://gist.github.com/nodrock/40ee14fd20cbed3d451c

from ane-facebook.

nodrock avatar nodrock commented on May 18, 2024

I am closing this issue. This ANE has support from AIR >=18.

Link to migration guide: https://github.com/nodrock/ANE-Facebook/wiki/Migration-guide-from-FreshPlanet-ANE

from ane-facebook.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.