{ "id": "126261", "key": "MOD-1866", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10034", "key": "MOD", "name": "Appcelerator Modules", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-07-18T10:45:37.000+0000", "created": "2014-02-11T12:29:50.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "community" ], "versions": [], "issuelinks": [], "assignee": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-07-18T10:45:37.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14521", "name": "Facebook" } ], "description": "I am using the Facebook module and button for authentication. I have event listeners for the login and logout activities. I am using the listeners to show or hide a button that allows you to publish to FB. It also has an alert tied to it i.e. alert(\"logged out\");. The FB button works fine for the FIRST login and logout. Subsequent logouts do not seem to fire the eventlistener as the alert does not state \"logged out\" and the button remains visible. Is that a bug?\r\n", "attachment": [], "flagged": false, "summary": "Facebook: Logout event does not seem to fire if multiple requests are made", "creator": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "MAC OSX Studio 3.2x", "comment": { "comments": [ { "id": "292612", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I am curious why you need your own event listeners for login and logout activities. \n\nhttp://docs.appcelerator.com/titanium/latest/#!/api/Modules.Facebook.LoginButton\n\nThe Login Button created by Modules.Facebook.createLoginButton. This is a Facebook-themed button that does not require a click event handler or any listeners. Click events on the button are automatically handled by the Facebook module.\n\nThe button changes its label to reflect the current state of the Facebook session. For example, if the user is already logged in, this button will show \"Logout\".", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-12T07:29:16.000+0000", "updated": "2014-02-12T07:29:16.000+0000" }, { "id": "292653", "author": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The primary reason is to dictate the visibility of a button that allows you to post to FB. If logged in, show it, if not, don't. This is also consistent with your examples from the updated FB module found here: http://docs.appcelerator.com/titanium/latest/#!/api/Modules.Facebook (and shown below) where you encourage developers to listen for login and logout events. The lack of a click listener won't help with any application flow that is predicated on the logged status (in / out). As an update to this ticket I am using the button on a view. I can't tell from the documentation if that is contributing to the issue (I can't see why it would). I should also add that as an additional test I called the getLoggedIn status and could see states being returned consistent with what they should have been based on the FB button state. In other words, if I was logged out the FB button returns to the correct state and getLoggedIn shows false (the buttons appearance is correct for both states). However, the listener for the logout does not appear to fire. I think those event listeners are useful - unless there is another way to accomplish what I am trying to do without them.\r\n\r\n\r\nExamples\r\nAuthorize\r\n\r\nShows official Facebook dialog for logging in the user and prompting the user to approve your requested permissions. Listen for the module's login event to determine whether the request succeeded.\r\n\r\nvar fb = require('facebook');\r\nfb.appid = FACEBOOK_APP_ID;\r\nfb.permissions = ['publish_stream']; // Permissions your app needs\r\nfb.forceDialogAuth = true;\r\nfb.addEventListener('login', function(e) {\r\n if (e.success) {\r\n alert('Logged In');\r\n } else if (e.error) {\r\n alert(e.error);\r\n } else if (e.cancelled) {\r\n alert(\"Canceled\");\r\n }\r\n});\r\nfb.authorize();\r\n\r\nLogout\r\n\r\nLogout the user and forget the authorization token. The logout event is fired after the user is logged out.\r\n\r\nfb.addEventListener('logout', function(e) {\r\n alert('Logged out');\r\n});\r\nfb.logout();", "updateAuthor": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-12T10:51:53.000+0000", "updated": "2014-02-12T10:52:50.000+0000" }, { "id": "292744", "author": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "body": "More information for this ticket. I have found that if I close the window with the Facebook button and re-open it the logout event listener will fire. However, it will not fire if I keep the window open. The window in question that contains the view container for the button is being opened in a modal state. Steps to replicate:\n\n1. Make a window that launches another modal window from a UI control\n2. Create the window that opens in modal mode from the first screen\n3. Add a view\n4. Add a \"back\" button that closes the modal window to the view\n5. Add a FB button to the view\n6. Add a button to the view with visibility set to fb.getLoggedIn.\n7. Add event listeners for FB login and logout with code to change the visibility of the button to true if logged in and false if logged out.\n8. Optional: add alert messages for \"login\" and \"logout\" to the FB event listeners. \n\nYou should see that the logout listener will not fire unless you close the modal window and reopen it.\n ", "updateAuthor": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-12T18:55:42.000+0000", "updated": "2014-02-12T18:55:42.000+0000" }, { "id": "292861", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thank you for providing additional information and detailed steps. We would need a complete runnable test case to make sure that we can reproduce and diagnose the exact same problem you are encountering.", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-13T03:54:53.000+0000", "updated": "2014-02-13T03:54:53.000+0000" }, { "id": "292891", "author": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "body": "You mean you need me to code the steps to reproduce the issue and send you the code?", "updateAuthor": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-13T11:27:07.000+0000", "updated": "2014-02-13T11:27:07.000+0000" }, { "id": "292905", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Yes, please.", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-13T15:09:51.000+0000", "updated": "2014-02-13T15:09:51.000+0000" }, { "id": "292983", "author": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Sorry, forgot to post this earlier. It is pulled together from a another code base but I tested it and can replicate (you can ignore some of the names of the controls for that reason and any extra comments I may have forgotten to delete). \n\nPlease tell me when you have downloaded the project from so I can delete it: https://www.dropbox.com/sh/zpc3vn5el2mtad4/PjUYiRZv3v\n\nAlso please substitute the FB app ID for your own in the code and in the TIAPP.xml file.\n\nIt should work as intended a few times. However, keep doing it with multiple login and logouts and you should notice the eventlistener seems to stop working.", "updateAuthor": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-13T21:12:20.000+0000", "updated": "2014-02-13T21:12:20.000+0000" }, { "id": "293193", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~jaymefishman] Thanks for providing the sample test case. I have downloaded it. You can remove your project now.", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-14T17:14:52.000+0000", "updated": "2014-02-14T17:14:52.000+0000" }, { "id": "293317", "author": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Great, can you please confirm if you can replicate the issue when you run it?", "updateAuthor": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-14T23:18:55.000+0000", "updated": "2014-02-14T23:18:55.000+0000" }, { "id": "293857", "author": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hello, just checking to see if you could replicate the error? It took me a bit of time to code the example and it is a blocking issue for me. Please let me know.\n\nRegards.\nJayme", "updateAuthor": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-20T01:06:50.000+0000", "updated": "2014-02-20T01:06:50.000+0000" }, { "id": "293903", "author": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Moving this ticket to engineering as I can reproduce the issue with the provided test case on iOS platform. Both Login and Logout events fire correctly first time but do not fire next time onward. If you close the window then Login and Logout events fire again but that is most likely because they are being treated as first login and logout.", "updateAuthor": { "name": "ragrawal", "key": "ragrawal", "displayName": "Ritu Agrawal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-20T06:54:08.000+0000", "updated": "2014-02-20T06:54:08.000+0000" }, { "id": "294101", "author": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Glad you could replicate. I think that is a big issue for the FB module.", "updateAuthor": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-21T11:11:20.000+0000", "updated": "2014-02-21T11:11:20.000+0000" }, { "id": "294105", "author": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "body": "One last question - I assume you don't know of a clever workaround for this do you? I can't think of one but would welcome a suggestion.", "updateAuthor": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-21T12:45:27.000+0000", "updated": "2014-02-21T12:45:27.000+0000" }, { "id": "294769", "author": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Do you have a projected fix date for this issue?", "updateAuthor": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-26T12:21:13.000+0000", "updated": "2014-02-26T12:21:13.000+0000" }, { "id": "294916", "author": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Just checking back on this as it does not look to have a priority assigned to it. However, it is a blocking functionality loss for the FB module.", "updateAuthor": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-02-27T13:08:53.000+0000", "updated": "2014-02-27T13:08:53.000+0000" }, { "id": "299312", "author": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Can I get an update on this issue? It has been pending since start of Feb and I don't think it has been started. Meanwhile, it really limits the use of the Facebook module.", "updateAuthor": { "name": "jaymefishman", "key": "jaymefishman", "displayName": "Jayme Fishman", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-03-31T12:36:13.000+0000", "updated": "2014-03-31T12:36:13.000+0000" }, { "id": "390892", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Fixed in Ti.Facebook 5.0 and later.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-07-18T10:45:37.000+0000", "updated": "2016-07-18T10:45:37.000+0000" } ], "maxResults": 17, "total": 17, "startAt": 0 } } }