[TIMOB-20015] iOS: Improve deprecation macros
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-11-20T03:20:05.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.2.0 |
Components | iOS |
Labels | qe-5.2.0 |
Reporter | Hans Knöchel |
Assignee | Hans Knöchel |
Created | 2015-11-19T04:31:31.000+0000 |
Updated | 2016-01-22T00:42:29.000+0000 |
Description
The macros for deprecating an API are misleading and need to be unified:
#define DEPRECATED_REPLACED(api,in,newapi) \
DebugLog(@"[WARN] Ti%@.%@ DEPRECATED in %@, in favor of %@.",@"tanium",api,in,newapi);
This macro expects DEPRECATED_REPLACED(@"Calendar.requestAuthorization", @"5.1.0", @"Titanium.Calendar.requestContactsPermissions");
Note, 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.
PR: https://github.com/appcelerator/titanium_mobile/pull/7476 I also created a test case to check every possible macro by calling 2 properties that internally call the macros:
CR done. APPROVED!
Ran the demo code provided by [~hans123] and received the following:
According 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 ase = Ti.UI.iOS.ATTRIBUTE_FONT
is called, however it is not present when run with SDK5.2.0.v20160114021251
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 theTi.UI.AttributedString
proxy. Long story short: Can you test the following (all words except the last should be times, the logs should state the warning):As per the above comment on the matter, using the demo code successfully returns the following:
Verified as fixed, Tested on: iPhone 6s Plus Device (9.2) & iPhone 6 Plus Device (8.4) Mac OSX El Capitan 10.11 (15A284) Ti SDK: 5.2.0.v20160114021251 Appc NPM: 4.2.3-1 App CLI: 5.2.0-228 Xcode 7.2 Node v4.2.3 *Closing Ticket.*