{ "id": "120477", "key": "TIMOB-15348", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "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": [], "resolution": { "id": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2013-10-07T16:04:39.000+0000", "created": "2013-09-26T10:28:37.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "supportTeam" ], "versions": [ { "id": "15478", "description": "Release 3.1.1", "name": "Release 3.1.1", "archived": true, "released": true, "releaseDate": "2013-06-17" }, { "id": "15479", "description": "Release 3.1.2", "name": "Release 3.1.2", "archived": true, "released": true, "releaseDate": "2013-07-31" }, { "id": "15593", "description": "Release 3.1.3", "name": "Release 3.1.3", "archived": true, "released": true, "releaseDate": "2013-09-18" } ], "issuelinks": [], "assignee": { "name": "mlangston", "key": "mlangston", "displayName": "Matt Langston", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-22T21:37:43.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": "h2. Description\r\nI need to be able to 'require' a javascript module from outside the resource directory. For example at first need to download myModule.js and use the code in this newly downloaded file (to applicationDataDirectory) if it exist.\r\n\r\nh2. Example\r\n{code}\r\nvar win1 = Titanium.UI.createWindow({ \r\n title:'Tab 1',\r\n backgroundColor:'#fff'\r\n});\r\n\r\nvar remoteInclude = function () {\r\n var url = \"https://dl.dropboxusercontent.com/u/72777663/sayHello.js\";\r\n \r\n var c = Titanium.Network.createHTTPClient();\r\n c.setTimeout(10000);\r\n c.onload = onSuccess;\r\n function onSuccess()\r\n {\r\n var f = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory,'sayHello.js');\r\n f.write(c.responseData);\r\n var myModule = require(Ti.Filesystem.applicationDataDirectory+'sayHello');\r\nmyModule.sayHello('Kevin');\r\n }\r\n \r\n c.ondatastream = function(e)\r\n {\r\n Ti.API.info('Progress : '+e.progress);\r\n \r\n };\r\n c.onerror = function(e)\r\n {\r\n Ti.API.info('XHR Error ' + e.error);\r\n };\r\n c.open('GET', url);\r\n \r\n c.send();\r\n \r\n};\r\n\r\nvar but=Titanium.UI.createButton({\r\ntitle:'Require JS'\r\n});\r\n\r\nbut.addEventListener('click', function(){\r\nremoteInclude();\r\n});\r\n\r\nwin1.add(but);\r\n{code}\r\n\r\nUrl : https://dl.dropboxusercontent.com/u/72777663/sayHello.js contains below code :\r\n\r\n{code}\r\nexports.sayHello = function(name) {\r\n Ti.API.info('Hello '+name+'!');\r\nalert('Hello '+name);\r\n};\r\n\r\nexports.version = 1.4;\r\nexports.author = 'Don Thorp';\r\n{code}", "attachment": [], "flagged": false, "summary": "Android: 'require' a remotely-downloaded JavaScript module", "creator": { "name": "rsharma", "key": "rsharma", "displayName": "Rupesh Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "rsharma", "key": "rsharma", "displayName": "Rupesh Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "android", "comment": { "comments": [ { "id": "273992", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "I don't think this would be approvable by Apple.\r\n\r\n\r\nSimilar approach is used by TiShadow and TiShadow app was not approved by Apple as far as I know.\r\n\r\n\r\n\r\n\r\nCheers.", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2013-10-07T13:31:01.000+0000", "updated": "2013-10-07T13:31:01.000+0000" }, { "id": "274007", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Based on feedback, we believe this model creates security complications and would not be approved by the Apple app store. Even though this ticket is for Android, we don't wish to encourage behavior that may only work on one platform.\r\n\r\nIf there is a reason why a user may wish to invoke core outside the resources directory (but that code is not remotely downloaded), we could revisit this ticket in the future.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-07T16:04:39.000+0000", "updated": "2013-10-07T16:04:39.000+0000" }, { "id": "274009", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "As a workaround, downloaded JS code can be evaluated by using \"eval\".", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2013-10-07T16:12:59.000+0000", "updated": "2013-10-07T16:12:59.000+0000" }, { "id": "274022", "author": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "(I think :) Not really sure would Apple approve that)", "updateAuthor": { "name": "ivan.skugor", "key": "ivan.skugor", "displayName": "Ivan Skugor", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2013-10-07T16:37:30.000+0000", "updated": "2013-10-07T16:37:30.000+0000" }, { "id": "415022", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as \"Won't Fix\".", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-22T21:37:43.000+0000", "updated": "2017-03-22T21:37:43.000+0000" } ], "maxResults": 12, "total": 12, "startAt": 0 } } }