incubator-callback-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olivier Louvignes (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-1161) Javascript callbacks are broken in 1.9/2.0 after using runOnUIThread() (ie. Facebook SSO)
Date Mon, 30 Jul 2012 18:05:34 GMT

    [ https://issues.apache.org/jira/browse/CB-1161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13425059#comment-13425059
] 

Olivier Louvignes commented on CB-1161:
---------------------------------------

Using 2.0 with a HTC Leo HD2 on 4.0.4, the first SSO callback is not working to JS:

Are you sure you have both the FacebookConnect blue log and the green console.log() for the
first login? On first SSO return (when it switch to the FB app) there is the correct callback
in java but no callback in JS. After that first initial request all other requests would use
cached accessToken & callback & thus would work, quitting the app won't clear this
cache. You can logout (even without an app id) & that will correctly clear the prefs,
the next login would be using an SSO-dialog.

You can also tweak line 138 & replace if(!this.getFacebook().isSessionValid()) { with
if(true || !this.getFacebook().isSessionValid()) { to force using an SSO authorize dialog

I'm already almost on the latest master (commit : 893ecec55e575a2be50a370f5235bded8ce934b1).
                
> Javascript callbacks are broken in 1.9/2.0 after using runOnUIThread() (ie. Facebook
SSO)
> -----------------------------------------------------------------------------------------
>
>                 Key: CB-1161
>                 URL: https://issues.apache.org/jira/browse/CB-1161
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 2.0.0
>            Reporter: Olivier Louvignes
>            Assignee: Joe Bowser
>              Labels: android, plugin
>
> I've been working on a alternative post-2.0 FacebookConnect plugin that would not require
the javascript SDK (check there : https://github.com/mgcrea/cordova-facebook-connect). But
I'm stuck after the AuthorizeDialog returns, calls to success() or sendJavascript() does not
work anymore.
> So I'm not sure if I just missed something or if something broke in 1.9 / 2.0 on this.
> The source code can be found there : https://github.com/mgcrea/cordova-facebook-connect/blob/master/Android/src/org/apache/cordova/plugins/FacebookConnect.java
> You can check the login function where the JS call is made :
> {code:java}
> final FacebookConnect me = this;
> 			this.authorizeDialogListener = new AuthorizeDialogListener(me, callbackId);
> 			this.cordova.setActivityResultCallback(this);
> 			Runnable runnable = new Runnable() {
> 				public void run() {
> 					me.getFacebook().authorize(me.cordova.getActivity(), permissions, me.authorizeDialogListener);
> 				};
> 			};
> 			this.cordova.getActivity().runOnUiThread(runnable);
> {code}
> When onActivityResult returns, JS is off :(
> {code:java}
> @Override
> 	public void onActivityResult(int requestCode, int resultCode, Intent data) {
> 		super.onActivityResult(requestCode, resultCode, data);
> 		this.getFacebook().authorizeCallback(requestCode, resultCode, data);
> 		//this.webView.sendJavascript("window.alert('test')"); //@todo not working :(
> 	}
> {code}
> Would love to get some feedback on this as I'm clearly not goog enough in Java dev to
fully understand what happens there.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message