{ "id": "170341", "key": "TIMOB-25522", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "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": "20115", "name": "Release 7.3.0", "archived": false, "released": true, "releaseDate": "2018-08-17" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-05-21T12:14:00.000+0000", "created": "2017-11-16T13:05:24.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "demo_app" ], "versions": [], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2018-06-12T17:28:10.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "In a production app, there are many cases where the developer would like to know the navigation-window context he/she is currently in. For example, when going through a set of windows to select a configuration, the developer calls \"openWindow(nextWindow)) to open the next window (\"push it\") into the current context.\r\n\r\nRight now, developers either store a global reference, e.g. \r\n{code:js}\r\nAlloy.Globals.navWindow = nav;\r\n{code}\r\n-> [BAD] \r\nor pass the navigation-window to each new window being created, e.g. \r\n{code:js}\r\nAlloy.createController('nextWindow', { \r\n navigationWindow: nav \r\n});\r\n{code}\r\n-> [BAD]\r\n\r\nI am proposing a solution where the developer can reference the current navigation-window using the \"navigationWindow\" instance property. See the following test-case for an example:\r\n{code:js}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar nav = Ti.UI.iOS.createNavigationWindow({\r\n window: win\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n title: 'Open next window'\r\n});\r\n\r\nbtn.addEventListener('click', function() {\r\n win.navigationWindow.openWindow(Ti.UI.createWindow({\r\n title: 'Next Window!',\r\n backgroundColor: 'green'\r\n }));\r\n});\r\n\r\nwin.add(btn);\r\nnav.open();\r\n{code}\r\nWhile the developer could still just use the \"nav\" property, it will get more complex when using a multi-level application which scope changes during the navigation-flow. Ideally, once we move the navigation-window to the universal {{Ti.UI.NavigationWindow}} namespace, we could expose the same for Android (cc [~jquick]) and Windows (cc [~kiguchi]).\r\n\r\nRequirements of this API:\r\n* Return existing references only, no copies\r\n* Make the property read-only\r\n* Only return a navigation-window if one exists, error else", "attachment": [], "flagged": false, "summary": "iOS: Expose navigation-window instance property to Ti.UI.Window", "creator": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "closedSprints": [ { "id": 1028, "state": "closed", "name": "2018 Sprint 09 SDK", "startDate": "2018-04-22T22:53:08.928Z", "endDate": "2018-05-06T22:53:00.000Z", "completeDate": "2018-05-07T00:02:15.883Z", "originBoardId": 114 }, { "id": 1018, "state": "closed", "name": "2018 Sprint 07 SDK", "startDate": "2018-03-25T21:59:36.637Z", "endDate": "2018-04-08T21:59:00.000Z", "completeDate": "2018-04-08T17:55:14.467Z", "originBoardId": 114 }, { "id": 1034, "state": "closed", "name": "2018 Sprint 10 SDK", "startDate": "2018-05-07T00:03:21.636Z", "endDate": "2018-05-21T00:03:00.000Z", "completeDate": "2018-05-20T20:54:58.928Z", "originBoardId": 114 }, { "id": 1035, "state": "closed", "name": "2018 Sprint 11 SDK", "startDate": "2018-05-20T20:57:43.542Z", "endDate": "2018-06-03T20:57:00.000Z", "completeDate": "2018-06-04T15:13:14.425Z", "originBoardId": 114 }, { "id": 1021, "state": "closed", "name": "2018 Sprint 08 SDK", "startDate": "2018-04-08T17:57:36.122Z", "endDate": "2018-04-22T17:57:00.000Z", "completeDate": "2018-04-22T22:51:19.120Z", "originBoardId": 114 }, { "id": 1008, "state": "closed", "name": "2018 Sprint 06 SDK", "startDate": "2018-03-11T22:18:04.396Z", "endDate": "2018-03-25T22:18:00.000Z", "completeDate": "2018-03-25T21:52:36.683Z", "originBoardId": 216 } ], "comment": { "comments": [ { "id": "430816", "author": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "body": "I would think we could leverage {{Ti.UI.iOS}} namespace or {{Ti.UI.iOS.NavigationWindow}} namespace for now when considering it is iOS specific component and there's no equivalent on Android/Windows. Maybe {{Ti.UI.iOS.currentNavigationWindow}} or {{Ti.UI.iOS.NavigationWindow.current}} property sounds better for me. \r\n\r\nOr in case we want to make it cross-platform {{Ti.UI.currentNavigationWindow}} property like we are doing in {{Ti.UI.currentWindow}} and {{Ti.UI.currentTab}} in this case?\r\n\r\n", "updateAuthor": { "name": "kiguchi", "key": "kota", "displayName": "Kota Iguchi", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-11-16T13:34:21.000+0000", "updated": "2017-11-16T13:34:21.000+0000" }, { "id": "430903", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Actually, [Ti.UI.currentWindow|http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI-property-currentWindow] should be removed from the docs, since it requires the \"url\" property of the window to be set, which was deprecated in 2.x and removed in 6. For [Ti.UI.currentTab|http://docs.appcelerator.com/platform/latest/#!/api/Titanium.UI-property-currentTab], it's different, because there can only be one TabGroup opened at the same time, so the value is consistent. For the navigation-window, there can be more navigation-windows that hold different window instances in different contexts (e.g. home-screen und settings that are presented modally, like in my sample-app [studentenfutter-app|https://github.com/hansemannn/studentenfutter-app]). \r\n\r\nThat's why I choose \"navigationWindow\" to be consistent with the native naming-conventions (self.navigationController) and it could easily be adapted to other platforms as well once we support navigation-flows on those. If Windows does not support that natively (I'd wonder why these days), we could do Android first to have a (partial 2/3) parity. That effort is tracked in TIMOB-24582.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-11-17T09:29:55.000+0000", "updated": "2017-11-17T09:29:55.000+0000" }, { "id": "431024", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/9608\r\nPR (7_1_X): https://github.com/appcelerator/titanium_mobile/pull/9848\r\n\r\nTo be reviewed after we have some more time post 7.0.0.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-11-20T10:43:50.000+0000", "updated": "2018-02-16T16:41:25.000+0000" }, { "id": "437736", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed: Waiting For Jenkins build to pass.", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-05-17T15:42:56.000+0000", "updated": "2018-05-17T15:42:56.000+0000" }, { "id": "438355", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket. Fix can be seen in SDK Version: 7.3.0.v20180607210411\r\n\r\nTest and other information can be found at: \r\nhttps://github.com/appcelerator/titanium_mobile/pull/9608", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-06-12T17:28:02.000+0000", "updated": "2018-06-12T17:28:02.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }