Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIMOB-6087 Android Facebook: Make sure dialogs use current activity #782

Merged
merged 6 commits into from Nov 30, 2011
Merged

TIMOB-6087 Android Facebook: Make sure dialogs use current activity #782

merged 6 commits into from Nov 30, 2011

Conversation

billdawson
Copy link
Contributor

http://jira.appcelerator.org/browse/TIMOB-6087

Test case is the failcase described in the ticket, plus keep these points in mind: Make sure you can do test mentioned in the ticket multiple times for each runtime (v8/rhino). Also try backing out of KitchenSink and going back into it, and doing that test again.

… from FacebookModule (rather than a view proxy). Make sure dialog() runs on UI thread.

final Activity activity = TiApplication.getInstance().getCurrentActivity();
if (activity == null) {
// There should always be a current activity.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually may not be the case -- it's possible when transitioning between activities for the current activity to be null (we've seen this in other code as well). We may not be running into this currently because the KS test opens the dialog in response to a button click event, but if the dialog() method was called after calling another heavy-weight window.open(), you might run into this race condition.

For the purposes of this code, it might be better to use TiUIHelper.waitForCurrentActivity since these methods are async.. thoughts?

…FB dialog. Use our waitForCurrentActivity utility method to be safe
@marshall
Copy link
Contributor

This is better but it looks like we're using getCurrentActivity() all over the facebook module, and it could have unintended consequences...

Logout apparently needs to be called on the same "Context" object that "login" is called on, according the facebook javadoc here:
https://github.com/facebook/facebook-android-sdk/blob/master/facebook/src/com/facebook/android/Facebook.java#L416

Our current LoginButton seems to take care of this by using the Button's creation Context, but we should probably be caching the Context we login with somehow to make sure this is consistent (theoretically this won't actually do anything if the user opens a new Activity before logging out)

@marshall
Copy link
Contributor

Comments appreciated :). Functional and code review passed, request accepted

@eric34
Copy link
Contributor

eric34 commented Nov 30, 2011

Pull Accepted:
Did not see any unexplained issues using three devices: Xoom, Nexus S, Droid 3. Could not finish test on Galaxy 10.1 due to security dialog from Facebook that I could not bypass.

Tests included login and full run through Facebook tests. Used both force and do not force dialog as well as quitting and relaunching tests 3 times each device.

@ayeung
Copy link
Contributor

ayeung commented Nov 30, 2011

Code reviewed. Request Accepted

marshall added a commit that referenced this pull request Nov 30, 2011
TIMOB-6087 Android Facebook: Make sure dialogs use current activity
@marshall marshall merged commit 02b2677 into tidev:master Nov 30, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants