From: Pawel Kaczmarczyk Date: Mon, 27 Aug 2018 08:03:57 +0000 (+0200) Subject: [Alarm] Fix printing deprecation warnings on TV profile X-Git-Tag: submit/tizen/20180920.074708^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab92b89c4bafcbcf09fc417dc0feae18f922d2ae;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Alarm] Fix printing deprecation warnings on TV profile AlarmAbsolute(date, period) constructor is not marked as deprecated on TV profile. [Verification] Tested in chrome console Change-Id: I1b3de7ad9d38c4bf4f8e55f8e8309e86b106e2f1 Signed-off-by: Pawel Kaczmarczyk --- diff --git a/src/alarm/alarm_api.js b/src/alarm/alarm_api.js index 626756df..089f6a3f 100755 --- a/src/alarm/alarm_api.js +++ b/src/alarm/alarm_api.js @@ -21,6 +21,8 @@ var privUtils_ = xwalk.utils; var native = new xwalk.utils.NativeManager(extension); +var isAlarmAbsolutePeriodDeprecated = true; + var AlarmManager = function () { Object.defineProperties(this, { PERIOD_MINUTE: { value: 60, writable: false, enumerable: true}, @@ -416,7 +418,7 @@ tizen.AlarmAbsolute = function(date, second, internal) { } else { if(!T.isNullOrUndefined(second)){ m_period = Converter.toLong(second); - if(_warningLogs.enableLog){ + if(_warningLogs.enableLog && isAlarmAbsolutePeriodDeprecated){ privUtils_.warn("This Constructor is deprecated since Tizen 4.0." + " Please consider using other constructors or other type of an alarm."); } @@ -443,14 +445,14 @@ tizen.AlarmAbsolute = function(date, second, internal) { }, period: { get: function() { - if(_warningLogs.enableLog){ + if(_warningLogs.enableLog && isAlarmAbsolutePeriodDeprecated){ privUtils_.warn('Since Tizen 4.0 constructor AlarmAbsolute(Date date, long period) ' + 'is deprecated, thus period attribute should not be used.'); } return m_period; }, set: function(v) { - if(_warningLogs.enableLog){ + if(_warningLogs.enableLog && isAlarmAbsolutePeriodDeprecated){ privUtils_.warn('Since Tizen 4.0 constructor AlarmAbsolute(Date date, long period) ' + 'is deprecated, thus period attribute should not be used.'); } @@ -532,6 +534,7 @@ var _profile = ProfileAlarm.getInstance().profile; if (_profile != 'mobile' && _profile != 'wearable') { delete AlarmManager.prototype.addAlarmNotification; delete AlarmManager.prototype.getAlarmNotification; + isAlarmAbsolutePeriodDeprecated = false; } //exports //////////////////////////////////////////////////////////////