{ "id": "153403", "key": "TIMOB-20055", "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": "16997", "name": "Release 5.2.0", "archived": false, "released": true, "releaseDate": "2016-02-23" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-12-21T16:50:40.000+0000", "created": "2015-11-23T23:32:24.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [], "versions": [ { "id": "14826", "description": "Release 5.1.0-remaining iOS9 features, Android M features", "name": "Release 5.1.0", "archived": false, "released": true, "releaseDate": "2015-11-20" } ], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2016-01-22T22:56:49.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": "The current {{Ti.UI.iOS.PreviewContent}} implementation works. But to make it even more efficient related to memory management, I refactored a few parts:\r\n- Remove manual properties of {{TiUIiOSPreviewContext}} inside the {{TiPreviewingDelegate}} and access them through the {{previewContext}} property (since the delegate is not public and it keeps the object dependencies clean)\r\n- Release some properties that have not been released before\r\n- Add missing code docs in the {{TiPreviewingDelegate}} header file\r\n- Change counter index from {{int}} to {{NSUInteger}} and remove unused {{actionGroupIndex}} property that have been used during testing\r\n- Enable ARC in all related files (!)\r\n\r\nDemo code (should work exactly like before):\r\n{code:javascript}\r\nvar actions = [];\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor: \"white\"\r\n});\r\n\r\n// The view to be previewed while popping.\r\nvar previewView = Ti.UI.createView({\r\n backgroundColor: \"blue\"\r\n});\r\n\r\n// The window to be opened after popping the preview.\r\nvar detailWindow = Ti.UI.createWindow({\r\n backgroundColor: \"yellow\"\r\n});\r\n\r\ndetailWindow.add(Ti.UI.createLabel({\r\n text: \"You made it!\"\r\n}));\r\n\r\n// The actions to be added to the preview context.\r\nvar action = Ti.UI.iOS.createPreviewAction({\r\n title: \"Preview Action\",\r\n style: Ti.UI.iOS.PREVIEW_ACTION_STYLE_DEFAULT\r\n});\r\n\r\naction.addEventListener(\"click\", function(e) {\r\n alert(\"Title: \" + e.title + \" / Style: \" + e.style+\" / Index: \" + e.index);\r\n});\r\n\r\nvar subAction = Ti.UI.iOS.createPreviewAction({\r\n title: \"Preview Subaction\"\r\n})\r\n\r\nsubAction.addEventListener(\"click\", function(e) {\r\n alert(\"Title: \" + e.title + \" / Style: \" + e.style+\" / Subindex: \" + e.index);\r\n});\r\n\r\nvar actionGroup = Ti.UI.iOS.createPreviewActionGroup({\r\n title: \"More actions...\",\r\n style: Ti.UI.iOS.PREVIEW_ACTION_STYLE_DESTRUCTIVE,\r\n actions: [subAction]\r\n});\r\n\r\nactions.push(action);\r\nactions.push(actionGroup);\r\n\r\n// Create the preview context\r\nvar context = Ti.UI.iOS.createPreviewContext({\r\n preview: previewView,\r\n actions: actions, // Can have both Ti.UI.iOS.PreviewAction + Ti.UI.iOS.PreviewActionGroup\r\n contentHeight: 300 // When unspecified, we use the available height\r\n});\r\n\r\n// Fired after popping the preview\r\ncontext.addEventListener(\"pop\", function(e) {\r\n detailWindow.open();\r\n});\r\n\r\n// Assign the preview context\r\nvar button = Ti.UI.createButton({\r\n previewContext: context, // Will be ignored on unsupported devices\r\n title : \"Open Window!\",\r\n backgroundColor: \"#A6171C\",\r\n width: 200,\r\n height: 50,\r\n tintColor: \"#fff\"\r\n});\r\n\r\nwin.add(button);\r\nwin.open();\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: Refactor previewContext to be more memory-efficient", "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": 529, "state": "closed", "name": "2015 Sprint 24 SDK", "startDate": "2015-11-21T01:30:12.670Z", "endDate": "2015-12-05T01:30:00.000Z", "completeDate": "2015-12-07T03:57:17.094Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "371273", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/7487", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-11-23T23:34:23.000+0000", "updated": "2015-11-23T23:34:23.000+0000" }, { "id": "371554", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "CR and FT passed! PR Merged!", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-11-27T02:11:38.000+0000", "updated": "2015-11-27T02:11:38.000+0000" }, { "id": "373325", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Improvements to prevent the preview view on peek, if the preview is set to null. Use case: We want the preview only be shown in a tableview, if the cell contains an image to be previewed. This improvements make that possible. Before, a blank preview would have been shown.\r\n\r\nPR master: https://github.com/appcelerator/titanium_mobile/pull/7594\r\nPR 5_2_X: https://github.com/appcelerator/titanium_mobile/pull/7595", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-12-21T00:01:57.000+0000", "updated": "2015-12-21T00:01:57.000+0000" }, { "id": "375189", "author": { "name": "jlongton", "key": "jlongton", "displayName": "Josh Longton", "active": true, "timeZone": "Europe/London" }, "updateAuthor": { "name": "jlongton", "key": "jlongton", "displayName": "Josh Longton", "active": true, "timeZone": "Europe/London" }, "created": "2016-01-22T22:56:43.000+0000", "updated": "2016-01-22T22:56:43.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }