AnthonyLins / facebook-actionscript-api

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

Suggestion: CancelLogin screen for FacebookMobile.as #378

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. set up a button in a View that when clicked will Create a StageWebView, Call 
FacebookMobile.login(...)
2. Click this button once, to get a login window
3. Navigate to another view (e.g. navigator.popToFirstView() )

OR

3. Click the button a 2nd time.

What is the expected output? What do you see instead?
expected that on changing views, there is some (optional) way to cancel the 
login request.
OR
expected that when clicking login again, the first unfinished login request 
will be cancelled.

Instead, the login window persists, over the entire application
OR
the login window/StageWebView (once you enter your password 2x - once for each 
stageWebView) persists, showing only "Success" but is not disposed/hidden. 

What version of the product are you using? On what operating system?
MAC OSX Flash Builder 4.5, API version 1.8.1 (the latest)

Please provide any additional information below.

Suggest that you add a cancel login feature.  Here's how I quickly did it 
(probably a better, way, but that's for you to decide):

1.Add the following method to FacebookMobile.as:

public static function cancelLogin():void
        {
            getInstance().cancelLogin();
        }

2. add the subsequent protected function:

protected function cancelLogin():void
        {
            if (loginWindow)
            {
                loginWindow.closeLogin();
            }
        }

3. Add the following function to MobileLoginWindow.as:

public function closeLogin():void
        {

            if (webView)
            {
                webView.removeEventListener(Event.COMPLETE, handleLocationChange);
                webView.removeEventListener(LocationChangeEvent.LOCATION_CHANGE, handleLocationChange);
                //loginCallback(null, FacebookDataUtils.getURLVariables(webView.location).error_reason);
                userClosedWindow =  true;
                webView.dispose();
                webView=null;

            }
        }

I commented out the loginCallback, because it's unecessary (and actually throws 
an error) but you can see plainly that I cannibalized it from handleLogin.

Hope to see this in a future version. 

Thanks!

-Strack

Original issue reported on code.google.com by str...@gmail.com on 16 Nov 2011 at 10:23