{ "id": "62227", "key": "TIMOB-1595", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-08-15T14:43:33.000+0000", "created": "2011-04-15T02:56:57.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "module_window", "qe-review", "qe-testadded" ], "versions": [], "issuelinks": [ { "id": "19947", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "94532", "key": "TIMOB-9901", "fields": { "summary": "TiAPI: Review and clean up platform bugs and reduce bug count by 20%.", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "7", "description": "gh.issue.story.desc", "name": "Story", "subtask": false } } } } ], "assignee": { "name": "ngupta", "key": "ngupta", "displayName": "Neeraj Gupta", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-09-10T03:26:29.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}

When calling Titanium.Media.openPhotoGallery or .showCamera from\na modal windows on Android, the camera/gallery dialogs show and\noperate but my success, cancel, and error callbacks never get\ncalled so my application can't process the image. This is a problem\nfor our StatusNet Mobile social networking client, which needs to\nbe able to take or select photos from a modal message-compose\ndialog.

\n
\nvar window = Titanium.UI.createWindow({\n    title: \"Photo test\",\n    backgroundColor: 'black'\n});\nvar button = Titanium.UI.createButton({\n    left: 20,\n    right: 20,\n    top: 120,\n    height: 32,\n    title: \"Push me\"\n});\n\nbutton.addEventListener('click', function() {\n    var popoverView;\n    var arrowDirection;\n    Titanium.Media.openPhotoGallery({\n    \n        success:function(event) {\n            Titanium.API.info('Success!');\n        },\n        cancel:function()\n        {\n            Titanium.API.info('Cancel!');\n        },\n        error:function(error)\n        {\n            Titanium.API.info('Error!');\n        },\n        allowEditing:true,\n        mediaTypes:[Ti.Media.MEDIA_TYPE_VIDEO,Ti.Media.MEDIA_TYPE_PHOTO],\n    });\n});\n\nwindow.add(button);\nwindow.open({\n    modal: true\n});\n
\n

Removing the 'modal: true' makes it work just fine, and I see\noutput in the debug log when my callbacks fire.

\n

Testing current git builds of mobile, on Android 2.2 + APIs.

{html}", "attachment": [], "flagged": false, "summary": "openPhotoGallery / showCamera callbacks fail when showing modal window on Android", "creator": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "126154", "author": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Turns out this is affecting all heavyweight windows, not just\nmodals -- so that includes those with fullscreen or navBarHidden\nset as well.

\n

This is a release blocker for StatusNet Mobile, since we've\ngotten back-button navigation working in Android by using\nheavyweight windows for each level, and have also removed the\nsystem title bar by putting navBarHidden on all the windows which\nalso turns them into heavyweight windows.

\n

Assigning to our support contact; we'll also file a helpdesk\nrequest referencing this bug.

{html}", "updateAuthor": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:56:58.000+0000", "updated": "2011-04-15T02:56:58.000+0000" }, { "id": "126155", "author": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Suggested workaround from support was to call from inside the\nheavyweight window's context (so giving it a url with its own\nlittle .js file) and pass the data back to the main context through\napplication-wide events.

\n

This seems to do the job for now, though we had issues with\nwriting the blobs to temporary files (fixed in f2eca06d -- thanks\nto Marshall for that fix!)

{html}", "updateAuthor": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:56:59.000+0000", "updated": "2011-04-15T02:56:59.000+0000" }, { "id": "126156", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "{html}

The callbacks actually do get called, but not until you back out\nof that heavyweight window. (which for all intents and purposes is\nas annoying as them not getting called at all. :) )

\n

Since the workaround (giving your heavyweight window its own .js\nand putting event logic for its controls in there -- which is\nsomething I always do and recommend) is working okay for you, I'm\nbumping this down to 'medium.' We have a re-engineering of our\ncontexts already under way for a future release, so we'll have to\nsee how this use case fits in when we have that ready to test.

{html}", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-04-15T02:56:59.000+0000", "updated": "2011-04-15T02:56:59.000+0000" }, { "id": "126157", "author": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Great, thanks for looking into it!

{html}", "updateAuthor": { "name": "brionvibber", "key": "brionvibber", "displayName": "Brion Vibber", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:56:59.000+0000", "updated": "2011-04-15T02:56:59.000+0000" }, { "id": "132742", "author": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "body": "A client has reported this fixed in 1.6.2. Just tested with 1.6.2, and the original sample code works for me as well.\n\nSo... pass on both accounts.", "updateAuthor": { "name": "dtoth", "key": "dtoth", "displayName": "Dawson Toth", "active": true, "timeZone": "America/New_York" }, "created": "2011-04-26T08:12:11.000+0000", "updated": "2011-04-26T08:12:11.000+0000" }, { "id": "169843", "author": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "body": "Just ran into this bug in 1.7.3", "updateAuthor": { "name": "iotashan", "key": "iotashan", "displayName": "Shannon Hicks", "active": true, "timeZone": "America/Chicago" }, "created": "2011-10-20T10:40:24.000+0000", "updated": "2011-10-20T10:40:24.000+0000" }, { "id": "170913", "author": { "name": "floschnell", "key": "floschnell", "displayName": "Florian Schnell", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I have had this issue with 1.7.3, too.\r\nOur application is based on one window to which we add and remove views.\r\nThere is one button calling the camera attached directly to the window and another one to one of the subviews.\r\nClicking on the first one works fine, the second launches the camera but then no success callback is invoked.\r\n\r\nWorkaround for me was to change the click-callback for the second button.\r\nInstead of calling the showCamera it is now fireing a click event on the first button - which is attached to the heavy window.\r\nThought this might be helpful, also wanted to share this good feeling after hours of bug tracking!", "updateAuthor": { "name": "floschnell", "key": "floschnell", "displayName": "Florian Schnell", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-10-31T10:47:28.000+0000", "updated": "2011-10-31T10:47:28.000+0000" }, { "id": "174266", "author": { "name": "programmerdave", "key": "programmerdave", "displayName": "David Rodriguez", "active": true, "timeZone": "America/New_York" }, "body": "I'm having this problem with 1.7.5 too. The callbacks aren't called when using navBarHidden:true. Any workarounds from a single context or do I have to launch another window context without navBarHidden for this to work?\r\n\r\nThanks.", "updateAuthor": { "name": "programmerdave", "key": "programmerdave", "displayName": "David Rodriguez", "active": true, "timeZone": "America/New_York" }, "created": "2011-11-29T19:36:39.000+0000", "updated": "2011-11-29T19:36:39.000+0000" }, { "id": "177107", "author": { "name": "connysvensson", "key": "connysvensson", "displayName": "connysvensson", "active": true, "timeZone": "Europe/Berlin" }, "body": "I'm experiencing the same problem in both 1.7.5 and 1.8.0 (haven't tested in 1.8.0.1).", "updateAuthor": { "name": "connysvensson", "key": "connysvensson", "displayName": "connysvensson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2011-12-23T04:18:57.000+0000", "updated": "2011-12-23T04:18:57.000+0000" }, { "id": "178347", "author": { "name": "ziggythehamster", "key": "ziggythehamster", "displayName": "Keith Gable", "active": true, "timeZone": "America/Los_Angeles" }, "body": "We are experiencing this issue in two different apps. Changing to a lightweight window does not resolve it in one app (but does in the other). I'm going to try to switch BACK to heavyweight and add an event listener for a synthetic event on the window and then fire that synthetic event when I need to capture a photo, and see what happens. Also, in this exact app, there is a heavyweight window that functions as expected.", "updateAuthor": { "name": "ziggythehamster", "key": "ziggythehamster", "displayName": "Keith Gable", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-06T10:01:01.000+0000", "updated": "2012-01-06T10:01:01.000+0000" }, { "id": "178384", "author": { "name": "ziggythehamster", "key": "ziggythehamster", "displayName": "Keith Gable", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Firing a synthetic event on the window (appname:capturephoto and appname:choosephoto) and adding event listeners for those events on the window worked in my case.", "updateAuthor": { "name": "ziggythehamster", "key": "ziggythehamster", "displayName": "Keith Gable", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-06T12:32:52.000+0000", "updated": "2012-01-06T12:32:52.000+0000" }, { "id": "178524", "author": { "name": "rborn", "key": "rborn", "displayName": "Dan Tamas", "active": true, "timeZone": "Europe/Berlin" }, "body": "@Keith - can you elaborate a little how you overcame the issue? When do you trigger the synthetic events? Thank you.", "updateAuthor": { "name": "rborn", "key": "rborn", "displayName": "Dan Tamas", "active": true, "timeZone": "Europe/Berlin" }, "created": "2012-01-09T11:06:40.000+0000", "updated": "2012-01-09T11:06:40.000+0000" }, { "id": "178705", "author": { "name": "ziggythehamster", "key": "ziggythehamster", "displayName": "Keith Gable", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I add an event listener to win listening for my synthetic/fake events, which then opens the camera or gallery. I fire the event on win whenever I want to show the camera or gallery.", "updateAuthor": { "name": "ziggythehamster", "key": "ziggythehamster", "displayName": "Keith Gable", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-10T10:39:31.000+0000", "updated": "2012-01-10T10:39:31.000+0000" }, { "id": "178712", "author": { "name": "rborn", "key": "rborn", "displayName": "Dan Tamas", "active": true, "timeZone": "Europe/Berlin" }, "body": "@Keith - so opening the gallery through a synthetic event will trigger the success event when the photo is selected?", "updateAuthor": { "name": "rborn", "key": "rborn", "displayName": "Dan Tamas", "active": true, "timeZone": "Europe/Berlin" }, "created": "2012-01-10T10:53:47.000+0000", "updated": "2012-01-10T10:53:47.000+0000" }, { "id": "178714", "author": { "name": "ziggythehamster", "key": "ziggythehamster", "displayName": "Keith Gable", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Yes, but only if your success function is created within the synthetic event's handler function.\r\n\r\n{code}\r\nwin.addEventListener(\"blah:camera\", function () {\r\n Ti.Media.showCamera({\r\n success: function (e) {\r\n // whatever\r\n }\r\n });\r\n});\r\n{code}\r\n\r\n{code}\r\nwin.fireEvent(\"blah:camera\");\r\n{code}\r\n\r\nIt also works on iOS this way.", "updateAuthor": { "name": "ziggythehamster", "key": "ziggythehamster", "displayName": "Keith Gable", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-01-10T11:00:36.000+0000", "updated": "2012-01-10T11:00:36.000+0000" }, { "id": "178717", "author": { "name": "rborn", "key": "rborn", "displayName": "Dan Tamas", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thnx, I'll try and let you know", "updateAuthor": { "name": "rborn", "key": "rborn", "displayName": "Dan Tamas", "active": true, "timeZone": "Europe/Berlin" }, "created": "2012-01-10T11:02:55.000+0000", "updated": "2012-01-10T11:02:55.000+0000" }, { "id": "214662", "author": { "name": "jyounus", "key": "jyounus", "displayName": "Junaid Younus", "active": true, "timeZone": "Europe/London" }, "body": "Tested on a Samsung Galaxy S2 using TiSDK 2.2.0v20120814103312, unable to reproduce the issue, working fine for me. Ticket closed.", "updateAuthor": { "name": "jyounus", "key": "jyounus", "displayName": "Junaid Younus", "active": true, "timeZone": "Europe/London" }, "created": "2012-08-15T14:43:33.000+0000", "updated": "2012-08-15T14:43:33.000+0000" }, { "id": "218137", "author": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Environment used for verification -\r\nTitanium SDK: 2.2.0.v20120907162025\r\nTitanium  Studio: 2.1.3.201209071738\r\nDevice - LG-P970 Android 2.2.2\r\nMachine OS - MAC 10.8", "updateAuthor": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-09-10T03:26:29.000+0000", "updated": "2012-09-10T03:26:29.000+0000" } ], "maxResults": 18, "total": 18, "startAt": 0 } } }