{ "id": "98082", "key": "ALOY-135", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "14177", "description": "2012 Sprint 20", "name": "2012 Sprint 20", "archived": true, "released": true, "releaseDate": "2012-10-08" }, { "id": "14176", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": false, "released": true, "releaseDate": "2012-12-13" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-09-26T15:22:45.000+0000", "created": "2012-07-26T11:36:02.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [], "issuelinks": [], "assignee": null, "updated": "2018-03-07T22:26:07.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "12329", "name": "Runtime", "description": "Generic bucket for uncategorized runtime issues" }, { "id": "12326", "name": "XML", "description": "View XML and parsing" } ], "description": "h2. problem\r\n\r\nRight now managing paths that relate to encapsulated assets and libs in a widget is a bit unwieldily. For example, let's say you have a widget structure that looks like this:\r\n\r\n* com.domain.widget\r\n** assets\r\n*** android \r\n**** images\r\n***** someimage.png\r\n*** iphone\r\n**** images\r\n***** someimage.png\r\n***** someimage@2x.png\r\n** controllers\r\n*** widget.js\r\n** lib\r\n*** somemodule.js\r\n** views\r\n*** widget.xml\r\n** widget.json\r\n\r\nHere's some sample code from widget.js that would make use of those (ugly) encapsulated paths\r\n\r\n{code:javascript}\r\nvar mod = require('com.domain.widget/somemodule');\r\nvar iv = Ti.UI.createImageView({\r\n image: 'images/com.domain.widget/someimage.png',\r\n});\r\n{code}\r\n\r\nSo like I mentioned, doable but ugly. It would benefit developers to have a shorthand method for defining asset and lib paths.\r\n\r\nh2. Possible Solution\r\n\r\nWe could use something like *WPATH()* wrapped around all paths in a widget to take care of proper pathing.\r\n\r\n{code:javascript}\r\nvar mod = require(WPATH('somemodule'));\r\nvar iv = Ti.UI.createImageView({\r\n image: WPATH('images/someimage.png'),\r\n});\r\n{code}\r\n\r\n", "attachment": [], "flagged": false, "summary": "Improve widget asset and lib path handling", "creator": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "209752", "author": { "name": "rmcmahon", "key": "rmcmahon", "displayName": "Russell McMahon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Let's discuss this a bit more I think of WPATH as a constant but maybe a Alloy function call like getResource(...) and from the javascript argument somehow get the path. How does Android do it? I thought they grabbed resources using some kind of wrapper correct. ", "updateAuthor": { "name": "rmcmahon", "key": "rmcmahon", "displayName": "Russell McMahon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-26T14:01:21.000+0000", "updated": "2012-07-26T14:01:21.000+0000" }, { "id": "209756", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "What would be the advantages of the Alloy.getResource() method? I ask mainly because that would have to be performed at runtime, where WPATH (or any other name) could be done at compile time, potentially improving performance. \r\n\r\nI don't understand your questions as it relates to Android. Android doesn't have to worry about encapsulation. The reason the widgets assets and libraries are structured as such is to ensure that they don't conflict with any other installed widgets in your project.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-26T14:06:18.000+0000", "updated": "2012-07-26T14:06:18.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }