{ "id": "173922", "key": "TIMOB-27267", "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": "20884", "name": "Release 8.2.1", "archived": false, "released": true, "releaseDate": "2019-10-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-10-04T18:23:34.000+0000", "created": "2019-07-22T16:56:13.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [], "issuelinks": [ { "id": "58824", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "175641", "key": "TIMOB-28192", "fields": { "summary": "Ti.UI.ImageView Test Suite: Titanium.UI.ImageView Acceptance TIMOB-27267 iOS only", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "priority": { "name": "None", "id": "6" }, "issuetype": { "id": "10100", "description": "This Issue Type is used to create Zephyr Test within Jira.", "name": "Test", "subtask": false } } } } ], "assignee": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-10-13T12:41:21.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": "When caching a remote image to be used inside a listview, the cached image sometimes does not get properly tinted. We noticed that it inside a list-view, but it also occurs in a normal image-view using tinted remote images.\r\n\r\nThe fix is to always check for the tint-color before setting the image again, moving it to a helper selector.\r\n\r\nTest-cases to reproduce:\r\n*1: Basic*:\r\n{code:js}\r\n/* eslint-disable strict */\r\n\r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor: '#fff'\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\n\ttitle: 'Load remote image'\r\n});\r\n\r\nvar image = Ti.UI.createImageView({\r\n\ttop: 60,\r\n\twidth: 90,\r\n\theight: 90,\r\n\ttintColor: 'red',\r\n\timage: Ti.UI.createView({ backgroundColor: 'gray', width: 270, height: 270 }).toImage()\r\n});\r\n\r\nbtn.addEventListener('click', function () {\r\n\tvar url = 'https://ss3.4sqi.net/img/categories_v2/food/breakfast_90.png';\r\n\r\n\tvar client = Ti.Network.createHTTPClient({\r\n\t\tonload: function () {\r\n\t\t\tconst blob = client.responseData;\r\n\t\t\tconst cachedFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationCacheDirectory, 'icon.png');\r\n\t\t\tcachedFile.write(blob);\r\n\r\n\t\t\timage.image = cachedFile.nativePath;\r\n\t\t},\r\n\t\tonerror: function (e) {\r\n\t\t\tTi.API.error(e.error);\r\n\t\t}\r\n\t});\r\n\r\n\tclient.open('GET', url);\r\n\tclient.send();\r\n});\r\n\r\nwin.add([ btn, image ]);\r\nwin.open();\r\n{code} \r\n\r\n*2: Advanced (list-view)*:\r\n{code:js}\r\n\r\n/* eslint-disable strict */\r\n\r\nvar win = Ti.UI.createWindow({\r\n title: 'TIMOB-27267',\r\n barColor: 'white',\r\n translucent: false,\r\n backgroundColor: '#fff'\r\n});\r\n\r\nvar nav = Ti.UI.createNavigationWindow({\r\n window: win\r\n})\r\n\r\nvar myTemplate = {\r\n childTemplates: [\r\n { // Image justified left\r\n type: 'Ti.UI.ImageView', // Use an image view for the image\r\n bindId: 'pic', // Maps to a custom pic property of the item data\r\n properties: { // Sets the image view properties\r\n width: 60,\r\n height: 60,\r\n tintColor: 'red',\r\n left: 10\r\n }\r\n },\r\n { // Title\r\n type: 'Ti.UI.Label', // Use a label for the title\r\n bindId: 'info', // Maps to a custom info property of the item data\r\n properties: { // Sets the label properties\r\n left: 75\r\n }\r\n },\r\n ]\r\n};\r\n\r\nvar list = Ti.UI.createListView({\r\n templates: { 'template': myTemplate },\r\n defaultItemTemplate: 'template'\r\n});\r\nvar section = Ti.UI.createListSection();\r\nvar cell = {\r\n pic: {\r\n image: Ti.UI.createView({ backgroundColor: 'gray', width: 60, height: 60 }).toImage() \r\n },\r\n info: {\r\n text: 'Titanium rocks!'\r\n }\r\n};\r\n\r\nsection.items = [cell];\r\nlist.sections = [section];\r\n \r\nwin.add(list);\r\nnav.open();\r\n\r\nloadImage();\r\n\r\nfunction loadImage() {\r\n var url = 'https://ss3.4sqi.net/img/categories_v2/food/breakfast_90.png';\r\n var cachedFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationCacheDirectory, 'icon.png');\r\n\r\n if (cachedFile.exists()) {\r\n console.log('EXISTS');\r\n setImage(cachedFile.nativePath);\r\n return;\r\n }\r\n\r\n\tvar client = Ti.Network.createHTTPClient({\r\n\t\tonload: function () {\r\n\t\t\tvar blob = client.responseData;\r\n cachedFile.write(blob);\r\n \r\n\t\t\tsetImage(cachedFile.nativePath);\r\n\t\t},\r\n\t\tonerror: function (e) {\r\n\t\t\tTi.API.error(e.error);\r\n\t\t}\r\n\t});\r\n \r\n\tclient.open('GET', url);\r\n\tclient.send();\r\n}\r\n\r\nfunction setImage(url) {\r\n var item = section.getItemAt(0);\r\n item.pic.image = url;\r\n\r\n section.updateItemAt(0, item);\r\n}\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: Image tintColor is not always applied if image is remote", "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, "comment": { "comments": [ { "id": "451543", "author": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR(master) - https://github.com/appcelerator/titanium_mobile/pull/11070\r\nPR(8_2_X) - https://github.com/appcelerator/titanium_mobile/pull/11233\r\n\r\n\r\n{code:java}\r\nvar win = Ti.UI.createWindow({\r\nbackgroundColor: '#fff'\r\n});\r\n\r\nvar btn = Ti.UI.createButton({\r\ntitle: 'Load remote image'\r\n});\r\n\r\nvar image = Ti.UI.createImageView({\r\ntop: 60,\r\nwidth: 90,\r\nheight: 90,\r\ntintColor: 'red',\r\nimage: Ti.UI.createView({ backgroundColor: 'gray', width: 270, height: 270 }).toImage()\r\n});\r\n\r\nbtn.addEventListener('click', function () {\r\nvar url = 'https://ss3.4sqi.net/img/categories_v2/food/breakfast_90.png';\r\n\r\nvar client = Ti.Network.createHTTPClient({\r\n onload: function () {\r\n const blob = client.responseData;\r\n const cachedFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationCacheDirectory, 'icon.png');\r\n cachedFile.write(blob);\r\n\r\n image.image = cachedFile.nativePath;\r\n },\r\n onerror: function (e) {\r\n Ti.API.error(e.error);\r\n }\r\n});\r\n\r\nclient.open('GET', url);\r\nclient.send();\r\n});\r\n\r\nwin.add([ btn, image ]);\r\n\r\nvar btn2 = Ti.UI.createButton({\r\ntitle: 'Set green tint color to image',\r\nbottom: 100\r\n});\r\n\r\nbtn2.addEventListener('click', function () {\r\nimage.tintColor = 'green'\r\n});\r\n\r\nwin.add(btn2);\r\n\r\nwin.open();\r\n{code}", "updateAuthor": { "name": "vijaysingh", "key": "vijaysingh", "displayName": "Vijay Singh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-09-20T21:20:30.000+0000", "updated": "2019-09-20T21:20:30.000+0000" }, { "id": "451630", "author": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed. Tint color applied successfully to remote images.", "updateAuthor": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-09-25T21:42:18.000+0000", "updated": "2019-09-25T21:42:18.000+0000" }, { "id": "451862", "author": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified On:\r\nMac OS: 10.14.5\r\nSDK: 8.2.1.v20191003075717, 8.3.0.v20191003144543\r\nAppc CLI: 7.1.1\r\nJDK: 1.8.0_162\r\nNode: 10.5.0\r\nStudio: 5.1.4.201909061933\r\nXcode: 11.0\r\nDevice: iPhone X(13.0), iPhone 7Plus(12.3.1)", "updateAuthor": { "name": "ssekhri", "key": "ssekhri", "displayName": "Satyam Sekhri", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-10-04T18:23:34.000+0000", "updated": "2019-10-04T18:23:34.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }