{ "id": "171768", "key": "TIMOB-26113", "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": "19882", "name": "Release 8.0.0", "archived": false, "released": true, "releaseDate": "2019-03-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-11-14T15:35:52.000+0000", "created": "2018-06-08T14:34:40.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [ { "id": "20115", "name": "Release 7.3.0", "archived": false, "released": true, "releaseDate": "2018-08-17" } ], "issuelinks": [ { "id": "56589", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "outwardIssue": { "id": "171713", "key": "TIMOB-26077", "fields": { "summary": "iOS: Ti.UI.convertUnits returns incorrect values for 3x resolution devices", "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" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "56592", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "inwardIssue": { "id": "171769", "key": "TIMOB-26114", "fields": { "summary": "Android: Ti.UI.convertUnits doesn't handle the special case of input values as percentages", "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": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "56591", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "171766", "key": "TIMOB-26112", "fields": { "summary": "Windows: Implement Ti.UI.convertUnits", "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": "Medium", "id": "3" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } }, { "id": "56590", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "171715", "key": "TIMOB-26078", "fields": { "summary": "Windows: Remove Ti.UI.currentWindow", "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" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false } } } } ], "assignee": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "updated": "2018-11-21T15:02:02.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": "Looks like iOS does not consult ti.ui.defaultunit property for converting when input units aren't specified. It assumes \"dp\", which is the default value placed in tiapp.xml.", "attachment": [], "flagged": false, "summary": "iOS: Ti.UI.convertUnits does not consult ti.ui.defaultunit property", "creator": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "environment": null, "closedSprints": [ { "id": 1093, "state": "closed", "name": "2018 Sprint 23", "startDate": "2018-11-04T23:35:52.006Z", "endDate": "2018-11-18T23:35:00.000Z", "completeDate": "2018-11-19T05:30:34.338Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "438319", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~cwilliams] This ticket says \"In Review\", but thats probably because it was cloned from another one (TIMOB-26077)? We will take a look.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-06-12T01:47:54.000+0000", "updated": "2018-06-12T01:47:54.000+0000" }, { "id": "438320", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "So after looking into this a bit, there is one thing I am wondering about before digging deeper: The method only allows strings, so using it as {{Ti.UI.convertUnits(20, Ti.UI.UNIT_PX)}} will cause a type error and {{Ti.UI.convertUnits('20', Ti.UI.UNIT_PX)}} works fine. \r\n\r\nAfter that, the issue is [here|https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiDimension.m#L75], where we check for string types before even getting the chance to check for the ti.ui.defaultunit (which is only checked for Number types right now). I would look into Android to see how they prioritize input types and change our implementation based on that. \r\n\r\n*EDIT*: Found a solution that passes all local tests, adding a PR now. Will take the chance to add unit-tests for the API as well.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-06-12T02:04:43.000+0000", "updated": "2018-06-12T02:12:56.000+0000" }, { "id": "438321", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/10101\r\n\r\nUnit-Tests coming after CR.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-06-12T02:17:36.000+0000", "updated": "2018-06-12T02:17:36.000+0000" }, { "id": "443540", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "https://github.com/appcelerator/titanium_mobile/pull/10462", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2018-11-13T21:57:52.000+0000", "updated": "2018-11-13T21:57:52.000+0000" }, { "id": "443817", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "*Closing ticket* Verified fix in SDK version {{8.0.0.v20181120171602}}. Tested using the following test case: \r\n{code:java}\r\nconst logicalDensityFactor = Ti.Platform.displayCaps.logicalDensityFactor;\r\nconst dpi = Ti.Platform.displayCaps.dpi;\r\n// When ti.ui.defaultunit is px, test value as Number and String\r\nTi.API.info('should be roughly 2.54: ' + Ti.UI.convertUnits(dpi + '', Ti.UI.UNIT_CM));\r\nTi.API.info('should be roughly 2.54: ' + Ti.UI.convertUnits(dpi, Ti.UI.UNIT_CM));\r\nTi.API.info('should be roughly 1: ' + Ti.UI.convertUnits(logicalDensityFactor + '', Ti.UI.UNIT_DIP));\r\nTi.API.info('should be roughly 1: ' + Ti.UI.convertUnits(logicalDensityFactor, Ti.UI.UNIT_DIP));\r\nTi.API.info('should be exactly 1: ' + Ti.UI.convertUnits(dpi + '', Ti.UI.UNIT_IN));\r\nTi.API.info('should be exactly 1: ' + Ti.UI.convertUnits(dpi, Ti.UI.UNIT_IN));\r\nTi.API.info('should be roughly 25.4: ' + Ti.UI.convertUnits(dpi + '', Ti.UI.UNIT_MM));\r\nTi.API.info('should be roughly 25.4: ' + Ti.UI.convertUnits(dpi, Ti.UI.UNIT_MM));\r\n\r\n// When ti.ui.defaultunit is in, test value as Number and String\r\nTi.API.info('should be roughly 2.54: ' + Ti.UI.convertUnits('1', Ti.UI.UNIT_CM));\r\nTi.API.info('should be roughly 2.54: ' + Ti.UI.convertUnits(1, Ti.UI.UNIT_CM));\r\nTi.API.info('should be roughly ' + (dpi / logicalDensityFactor) + ': ' + Ti.UI.convertUnits('1', Ti.UI.UNIT_DIP));\r\nTi.API.info('should be roughly ' + (dpi / logicalDensityFactor) + ': ' + Ti.UI.convertUnits(1, Ti.UI.UNIT_DIP));\r\nTi.API.info('should be roughly ' + dpi + ': ' + Ti.UI.convertUnits('1', Ti.UI.UNIT_PX));\r\nTi.API.info('should be roughly ' + dpi + ': ' + Ti.UI.convertUnits(1, Ti.UI.UNIT_PX));\r\n{code}\r\n\r\n*Note** Made sure to change {{ti.ui.defaultunit}} in the {{tiapp.xml}} to the correct unit being tested. \r\n\r\n*Test Environment*\r\n{code:java}\r\nAPPC Studio: 5.1.0.201808080937\r\niPhone 6 Sim (iOS 12.1)\r\nAPPC CLI: 7.0.6\r\nOperating System Name: Mac OS Mojave\r\nOperating System Version: 10.14.1\r\nNode.js Version: 8.9.1\r\nXcode 10.1\r\n{code}\r\n\r\n", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-11-21T15:01:48.000+0000", "updated": "2018-11-21T15:01:48.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }