{ "id": "153307", "key": "TIMOB-20015", "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-11-20T03:20:05.000+0000", "created": "2015-11-19T04:31:31.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "qe-5.2.0" ], "versions": [], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2016-01-22T00:42:29.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 macros for deprecating an API are misleading and need to be unified:\r\n\r\n{code}\r\n#define DEPRECATED_REPLACED(api,in,newapi) \\\r\nDebugLog(@\"[WARN] Ti%@.%@ DEPRECATED in %@, in favor of %@.\",@\"tanium\",api,in,newapi);\r\n {code}\r\nThis macro expects {{DEPRECATED_REPLACED(@\"Calendar.requestAuthorization\", @\"5.1.0\", @\"Titanium.Calendar.requestContactsPermissions\");}}\r\n\r\nNote, that the Titanium prefix is added by the macro in the deprecated API, but needs to be added manually in the replaced API. The approach is to clean this up and unify all usages, so that we call {{DEPRECATED_REPLACED(@\"Calendar.requestAuthorization\", @\"5.1.0\", @\"Titanium.Calendar.requestContactsPermissions\");}} which generated a proper Ti-prefixed warning for all API's. ", "attachment": [], "flagged": false, "summary": "iOS: Improve deprecation macros", "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": 525, "state": "closed", "name": "2015 Sprint 23 SDK", "startDate": "2015-11-07T01:30:15.519Z", "endDate": "2015-11-21T01:30:00.000Z", "completeDate": "2015-11-23T02:54:27.887Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "370886", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/7476\r\n\r\nI also created a test case to check every possible macro by calling 2 properties that internally call the macros:\r\n{code:javascript}\r\nTi.UI.createWindow({\r\n\tbackgroundColor: \"#fff\"\r\n}).open();\r\n\r\nTi.API.info(\"\\n\\nWarnings following:\\n\");\r\n\r\n// -- Please run this code and verify the console logs with the logs below.\r\n\r\n/**\r\n\t\t\tDeprecated -> Removed warnings\r\n*/\r\n\r\n// Expected log: [WARN] Ti.Media.AUDIO_HEADPHONES DEPRECATED in 3.4.2: REMOVED in 3.6.0\r\nvar a = Ti.Media.AUDIO_HEADPHONES;\r\n\r\n// Expected log: [WARN] Ti.UI.iOS.COLOR_SCROLLVIEW_BACKGROUND DEPRECATED in 3.4.2: REMOVED in 3.6.0\r\nvar b = Ti.UI.iOS.COLOR_SCROLLVIEW_BACKGROUND;\r\n\r\n\r\n/**\r\n\t\t\tDeprecated -> Replaced -> Removed warnings\r\n*/\r\n\r\n// Expected log: [WARN] Ti.Media.audioLineType DEPRECATED in 3.4.2, in favor of Ti.Media.currentRoute: REMOVED in 3.6.0\r\nvar c = Ti.Media.audioLineType;\r\n\r\n// Expected log: [WARN] Ti.UI.iPhone.StatusBar.OPAQUE_BLACK DEPRECATED in 3.4.2, in favor of Ti.UI.iPhone.StatusBar.LIGHT_CONTENT: REMOVED in 3.6.0\r\nvar d = Ti.UI.iPhone.StatusBar.OPAQUE_BLACK;\r\n\r\n\r\n/**\r\n\t\t\tDeprecated -> Replaced warnings\r\n*/\r\n\r\n// Expected log: [WARN] Ti.UI.iOS.ATTRIBUTE_FONT DEPRECATED in 3.6.0, in favor of Ti.UI.ATTRIBUTE_FONT\r\nvar e = Ti.UI.iOS.ATTRIBUTE_FONT;\r\n\r\n// Expected log: [WARN] Ti.UI.iOS.ANIMATION_CURVE_LINEAR DEPRECATED in 2.1.0, in favor of Ti.UI.ANIMATION_CURVE_LINEAR\r\nvar f = Ti.UI.iOS.ANIMATION_CURVE_LINEAR;\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-11-19T21:45:49.000+0000", "updated": "2015-11-19T21:45:49.000+0000" }, { "id": "370931", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "CR done. APPROVED!", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-11-20T03:20:05.000+0000", "updated": "2015-11-20T03:20:05.000+0000" }, { "id": "374946", "author": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "body": "Ran the demo code provided by [~hans123] and received the following:\r\n\r\n{code:java}\r\nJan 20 09:52:34 SAMWISE keyboardType[552] : [WARN] Ti.Media.AUDIO_HEADPHONES DEPRECATED in 3.4.2: REMOVED in 3.6.0\r\nJan 20 09:52:34 SAMWISE keyboardType[552] : [WARN] Ti.UI.iOS.COLOR_SCROLLVIEW_BACKGROUND DEPRECATED in 3.4.2: REMOVED in 3.6.0\r\nJan 20 09:52:34 SAMWISE keyboardType[552] : [WARN] Ti.Media.audioLineType DEPRECATED in 3.4.2, in favor of Ti.Media.currentRoute: REMOVED in 3.6.0\r\nJan 20 09:52:34 SAMWISE keyboardType[552] : [WARN] Ti.UI.iPhone.StatusBar.OPAQUE_BLACK DEPRECATED in 3.4.2, in favor of Ti.UI.iPhone.StatusBar.LIGHT_CONTENT: REMOVED in 3.6.0\r\nJan 20 09:52:34 SAMWISE keyboardType[552] : [WARN] Ti.UI.iOS.ANIMATION_CURVE_LINEAR DEPRECATED in 2.1.0, in favor of Ti.UI.ANIMATION_CURVE_LINEAR\r\n{code}\r\n\r\nAccording to the demo, the message {{[WARN] Ti.UI.iOS.ATTRIBUTE_FONT DEPRECATED in 3.6.0, in favor of Ti.UI.ATTRIBUTE_FONT}} should be present as {{e = Ti.UI.iOS.ATTRIBUTE_FONT}} is called, however it is not present when run with SDK {{5.2.0.v20160114021251}}\r\n", "updateAuthor": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "created": "2016-01-20T18:00:21.000+0000", "updated": "2016-01-20T18:03:28.000+0000" }, { "id": "374948", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Interesting. I just tried {{var e = Ti.UI.iOS.ATTRIBUTE_FONT;}} and got {{\\[WARN] Ti.UI.iOS.ATTRIBUTE_FONT DEPRECATED in 3.6.0, in favor of Ti.UI.ATTRIBUTE_FONT}} using the 5_2_X branch. Anyway, it is possible that the constant is only available in conjunction with the {{Ti.UI.AttributedString}} proxy. \r\n\r\nLong story short: Can you test the following (all words except the last should be times, the logs should state the warning):\r\n\r\n{code:javascript}\r\nvar win = Titanium.UI.createWindow({\r\n backgroundColor: '#ddd',\r\n});\r\n\r\nwin.open();\r\n\r\nvar text = 'Bacon ipsum dolor Appcelerator Titanium rocks! sit amet fatback leberkas salami sausage tongue strip steak.';\r\n\r\nvar attr = Titanium.UI.iOS.createAttributedString({\r\n text: text,\r\n attributes: [{\r\n type: Titanium.UI.iOS.ATTRIBUTE_FONT,\r\n\tvalue: \"Times\",\r\n range: [0, text.length - 6]\r\n }]\r\n});\r\n\r\nvar label = Titanium.UI.createLabel({\r\n left: 20,\r\n right: 20,\r\n height: Titanium.UI.SIZE,\r\n attributedString: attr\r\n});\r\n\r\nwin.add(label);\r\n{code}", "updateAuthor": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "created": "2016-01-20T18:11:25.000+0000", "updated": "2016-01-20T18:25:55.000+0000" }, { "id": "374952", "author": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "body": "As per the above comment on the matter, using the demo code successfully returns the following:\r\n{code:java}\r\n// Some comments here\r\n[WARN] Ti.UI.iOS.ATTRIBUTE_FONT DEPRECATED in 3.6.0, in favor of Ti.UI.ATTRIBUTE_FONT\r\n[WARN] Ti.UI.iOS.createAttributedString() DEPRECATED in 3.6.0, in favor of Ti.UI.createAttributedString()\r\n{code}\r\n\r\nVerified as fixed, Tested on:\r\niPhone 6s Plus Device (9.2) & iPhone 6 Plus Device (8.4) \r\nMac OSX El Capitan 10.11 (15A284)\r\nTi SDK: 5.2.0.v20160114021251\r\nAppc NPM: 4.2.3-1\r\nApp CLI: 5.2.0-228 \r\nXcode 7.2\r\nNode v4.2.3\r\n\r\n*Closing Ticket.*\r\n", "updateAuthor": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "created": "2016-01-20T18:30:13.000+0000", "updated": "2016-01-20T18:30:13.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }