[Alarm] Fix printing deprecation warnings on TV profile 65/187665/1
authorPawel Kaczmarczyk <p.kaczmarczy@samsung.com>
Mon, 27 Aug 2018 08:03:57 +0000 (10:03 +0200)
committerPawel Kaczmarczyk <p.kaczmarczy@samsung.com>
Mon, 27 Aug 2018 09:08:28 +0000 (11:08 +0200)
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 <p.kaczmarczy@samsung.com>
src/alarm/alarm_api.js

index 626756df887f8f4df4f9e64ae0b9b813cb6b2180..089f6a3fb900e63b352549d9ff594e10b5645bbc 100755 (executable)
@@ -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 //////////////////////////////////////////////////////////////