AnthonyLins / facebook-actionscript-api

Automatically exported from code.google.com/p/facebook-actionscript-api
0 stars 0 forks source link

Problem with Facebook.ui callbacks #447

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. We want to send 500 apprequests, 50 each time cause Facebook limitations.

2. We wait for Facebook response to send the next 50.

3. Call
Facebook.ui("apprequests", data, callback);
where the callback call again to Facebook.ui with callback

What is the expected output? What do you see instead?
The expected output would be sending all the apprequests, executting the 
callback each time Facebook responses.

What happens instead is that callback only executes once.

What version of the product are you using? On what operating system?
Doesn't matter

Please provide any additional information below.

A possible solution for this is changing, in Facebook class:

diff:

@@ -777,6 +777,8 @@

      if (callback != null) {
          openUICalls[method] = callback;
+     } else {
+         delete openUICalls[method];
      }

       if (display) {
@@ -837,13 +839,18 @@
     *
     */
    protected function handleUI( result:String, method:String ):void {
        var decodedResult:Object = result ? JSON.parse(result) : null;
        var uiCallback:Function = openUICalls[method];
        if (uiCallback === null) {
            delete openUICalls[method];
        } else {
            uiCallback(decodedResult);
-           delete openUICalls[method];
        }
    }

Original issue reported on code.google.com by alejandr...@gmail.com on 16 Jan 2013 at 12:55