{ "id": "104454", "key": "TIMOB-11673", "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": "14700", "description": "2012 Sprint 25", "name": "2012 Sprint 25", "archived": true, "released": true, "releaseDate": "2012-12-17" }, { "id": "14699", "description": "2012 Sprint 25 Core", "name": "2012 Sprint 25 Core", "archived": true, "released": true, "releaseDate": "2012-12-17" }, { "id": "14784", "description": "2012 Sprint 25 API", "name": "2012 Sprint 25 API", "archived": true, "released": true, "releaseDate": "2012-12-17" } ], "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2012-12-04T00:54:01.000+0000", "created": "2012-11-06T16:52:53.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-27T20:37:23.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": "h1. Problem description\r\nWhenever a require function is called, the network change event listener is broken.\r\n\r\nh1. Steps to reproduce\r\nCreate 3 files: app.js, win.js and view.js\r\n\r\n*app.js*\r\n{code}\r\n(function() {\r\n var Window = require('win');\r\n\tnew Window().open();\r\n})();\r\n{code}\r\n\r\n*win.js*\r\n{code}\r\nfunction ApplicationWindow() {\r\n var view = require('view'); // just requiring, we are not even invoking the function\r\n \r\n var self = Ti.UI.createWindow({\r\n backgroundColor:'#ffffff',\r\n navBarHidden:true,\r\n exitOnClose:true\r\n });\r\n \r\n return self;\r\n}\r\nmodule.exports = ApplicationWindow;\r\n{code}\r\n\r\n*view.js*\r\n{code}\r\nfunction SimpleView() {\r\n var view = Ti.UI.createView({\r\n backgroundColor:'red',\r\n width: 100,\r\n height: 100\r\n });\r\n \r\n return view;\r\n}\r\n\r\nmodule.exports = SimpleView;\r\n{code}\r\n\r\n\r\nNow, there are 3 scenarios; use this simple listener code:\r\n{code}\r\nTitanium.Network.addEventListener('change', function(e) {\r\n alert('Status changed:' + e.networkType);\r\n});\r\n{code}\r\n\r\n1. add the network listener code in app.js or win.js: it will only be fired ONCE [BUG]\r\n2. add the listener code in view.js: everything is ok\r\n3. add the listener code in win.js and remove the require('view') from it: everything is ok\r\n", "attachment": [], "flagged": false, "summary": "Android: require breaks the network change event listener", "creator": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Android 2.3\r\nAndroid 4\r\nSDK 2.1.3", "comment": { "comments": [ { "id": "227024", "author": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "body": "- I've tested back with 2.1.2, 2.1.1 and 2.1.0: same results.\n- I've tested with 2.0.2: the listener is not called even once.\n- However, testing with v3.0.0.20121026170116 seems to be working. Was this addressed in the release?\n\nBelow a simpler test case:\n\napp.js\n{code}\n(function() {\n Titanium.Network.addEventListener('change', function(e) {\n alert('Status changed:' + e.networkType);\n });\n\n var Window = require('win');\n new Window().open();\n})();\n{code}\n\nwin.js\n{code}\nfunction ApplicationWindow() {\n var self = Ti.UI.createWindow({\n backgroundColor:'#ffffff',\n navBarHidden:true,\n exitOnClose:true\n });\n \n return self;\n}\nmodule.exports = ApplicationWindow;\n{code}", "updateAuthor": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "created": "2012-11-12T18:41:46.000+0000", "updated": "2012-11-12T18:41:46.000+0000" }, { "id": "229749", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with latest master and 3_0_X. The two test cases both pass. Mark the ticket as Cannot Reproduce.", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-12-04T00:52:45.000+0000", "updated": "2012-12-04T00:52:45.000+0000" }, { "id": "415926", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as I am unable to reproduce this issue with the following environment;\r\nPixel (7.1)\r\nMacOS 10.11.6 (15G31)\r\nStudio 4.8.1.201612050850\r\nTi SDK 6.0.3 GA\r\nAppc NPM 4.2.8\r\nAppc CLI 6.1.0\r\nTi CLI 5.0.11\r\nAlloy 1.9.5\r\nArrow 1.10.1\r\nXcode 8.2 (8C38)\r\nNode v4.6.0\r\nJava 1.7.0_80", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-27T20:37:23.000+0000", "updated": "2017-03-27T20:37:23.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }