[Common] Applied some modifications from vd_fork 05/245105/1
authorPiotr Kosko <p.kosko@samsung.com>
Fri, 2 Oct 2020 06:36:28 +0000 (08:36 +0200)
committerPiotr Kosko <p.kosko@samsung.com>
Fri, 2 Oct 2020 07:00:41 +0000 (09:00 +0200)
* deprecation warninig mechanism
* systeminfo string keys

Change-Id: Iaaf87a0ab4e8a9b1d37628c21b5b6e339e81f982

24 files changed:
src/application/application_api.js
src/application/application_instance.cc
src/application/application_manager.cc
src/common/filesystem/filesystem_provider.cc
src/common/filesystem/filesystem_provider.h
src/common/filesystem/filesystem_provider_storage.cc
src/common/filesystem/filesystem_provider_storage.h
src/common/logger.h
src/content/content_instance.cc
src/content/js/manager.js
src/filesystem/filesystem_instance.cc
src/filesystem/js/file.js
src/filesystem/js/file_stream.js
src/filesystem/js/file_system_manager.js
src/push/push_instance.cc
src/sensor/sensor_service.cc
src/systeminfo/systeminfo-utils.cpp
src/systeminfo/systeminfo_api.js
src/systeminfo/systeminfo_instance.cc
src/systeminfo/systeminfo_manager.cc
src/time/time_instance.cc
src/utils/js/ut/chai.js
src/utils/js/ut/mocha.js
src/utils/utils_api.js

index 7414e12..e932192 100755 (executable)
@@ -747,10 +747,11 @@ var APPLICATION_EVENT_LISTENER = 'ApplicationEventListener';
 var applicationEventListener = new ListenerManager(native, APPLICATION_EVENT_LISTENER);
 
 ApplicationManager.prototype.addAppInfoEventListener = function() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: addAppInfoEventListener() is deprecated and will be ' +
+    privUtils_.deprecationWarn(
+        'addAppInfoEventListener() is deprecated and will be ' +
             'removed from next release. ' +
-            'Use tizen.package.setPackageInfoEventListener() instead.'
+            'Use tizen.package.setPackageInfoEventListener() instead.',
+        '2.4'
     );
 
     var args = AV.validateArgs(arguments, [
@@ -765,10 +766,11 @@ ApplicationManager.prototype.addAppInfoEventListener = function() {
 };
 
 ApplicationManager.prototype.removeAppInfoEventListener = function() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: removeAppInfoEventListener() is deprecated and will be ' +
+    privUtils_.deprecationWarn(
+        'removeAppInfoEventListener() is deprecated and will be ' +
             'removed from next release. ' +
-            'Use tizen.package.unsetPackageInfoEventListener() instead.'
+            'Use tizen.package.unsetPackageInfoEventListener() instead.',
+        '2.4'
     );
 
     var args = AV.validateArgs(arguments, [
index e709709..0a700e8 100644 (file)
@@ -185,10 +185,10 @@ void ApplicationInstance::ApplicationManagerGetAppsUsageInfo(const picojson::val
 void ApplicationInstance::ApplicationManagerAddAppInfoEventListener(const picojson::value& args,
                                                                     picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: addAppInfoEventListener() is deprecated and will be removed from next "
-      "release. "
-      "Use tizen.package.setPackageInfoEventListener() instead.");
+  DEPRECATION_WARN(
+      "addAppInfoEventListener() is deprecated and will be removed from next "
+      "release. Use tizen.package.setPackageInfoEventListener() instead.",
+      "2.4");
 
   manager_.StartAppInfoEventListener(&out);
 }
@@ -196,10 +196,10 @@ void ApplicationInstance::ApplicationManagerAddAppInfoEventListener(const picojs
 void ApplicationInstance::ApplicationManagerRemoveAppInfoEventListener(const picojson::value& args,
                                                                        picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: removeAppInfoEventListener() is deprecated and will be removed from "
-      "next release. "
-      "Use tizen.package.unsetPackageInfoEventListener() instead.");
+  DEPRECATION_WARN(
+      "removeAppInfoEventListener() is deprecated and will be removed from "
+      "next release. Use tizen.package.unsetPackageInfoEventListener() instead.",
+      "2.4");
 
   manager_.StopAppInfoEventListener();
   ReportSuccess(out);
index 4de3140..c1d84d2 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "application_manager.h"
 
-#include <glib.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <thread>
index 140b749..5de70f0 100644 (file)
@@ -66,7 +66,7 @@ VirtualStorages FilesystemProvider::GetAllStorages() {
   return provider_.GetAllStorages();
 }
 
-std::string FilesystemProvider::GetRealPath(const std::string& path_or_uri) {
+std::string FilesystemProvider::GetRealPath(const std::string& path_or_uri) const {
   ScopeLogger();
   return FilesystemProviderStorage::Create().GetRealPath(path_or_uri);
 }
index 49bbaa3..6c21fd8 100644 (file)
@@ -52,7 +52,7 @@ class FilesystemProvider {
   VirtualRoots GetVirtualPaths();
   VirtualStorages GetAllStorages();
 
-  std::string GetRealPath(const std::string& path_or_uri);
+  std::string GetRealPath(const std::string& path_or_uri) const;
   std::string GetVirtualPath(const std::string& real_path) const;
 
  private:
index 2a8116c..c48edec 100644 (file)
@@ -162,7 +162,7 @@ VirtualRoots FilesystemProviderStorage::GetVirtualPaths() {
   return virtual_paths_;
 }
 
-std::string FilesystemProviderStorage::GetRealPath(const std::string& path_or_uri) {
+std::string FilesystemProviderStorage::GetRealPath(const std::string& path_or_uri) const {
   ScopeLogger();
   std::string realpath;
   std::size_t pos = path_or_uri.find(kFileUriPrefix);
index 49095af..b8bc61d 100644 (file)
@@ -36,7 +36,7 @@ class FilesystemProviderStorage : public IFilesystemProvider {
   virtual VirtualRoots GetVirtualPaths();
   virtual VirtualStorages GetAllStorages();
 
-  std::string GetRealPath(const std::string& path_or_uri);
+  std::string GetRealPath(const std::string& path_or_uri) const;
   std::string GetVirtualPath(const std::string& real_path) const;
 
   DeviceChangeStateFun GetListener();
index 228c871..f2a1ef6 100644 (file)
@@ -112,6 +112,10 @@ int _printf_format_checker(const char* fmt, ...) {
 #define LOGGER_IF(priority, condition) \
   !(condition) ? (void)0 : LogMessageVoidify() & (LOGGER(priority))
 
+#define DEPRECATION_WARN(log, version)                          \
+  /* For public code, warning should be always shown */         \
+  LoggerW("DEPRECATION WARNING: %s", log);
+
 // This class more or less represents a particular log message.
 // You create an instance of LogMessage and then stream stuff to it.
 // When you finish streaming to it, ~LogMessage is called and the
index 24861b6..9b46159 100644 (file)
@@ -612,10 +612,10 @@ void ContentInstance::ContentManagerRemoveChangeListener(const picojson::value&
 void ContentInstance::ContentManagerSetchangelistener(const picojson::value& args,
                                                       picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: setChangeListener() is deprecated and will be removed from next "
-      "release. "
-      "Use addChangeListener() instead.");
+  DEPRECATION_WARN(
+      "setChangeListener() is deprecated and will be removed from next "
+      "release. Use addChangeListener() instead.",
+      "3.0");
   // CHECK_PRIVILEGE_ACCESS(kPrivilegeContentRead, &out);
   CHECK_PRIVILEGE_ACCESS(kPrivilegeContentWrite, &out);
 
@@ -648,10 +648,10 @@ void ContentInstance::ContentManagerSetchangelistener(const picojson::value& arg
 void ContentInstance::ContentManagerUnsetchangelistener(const picojson::value& args,
                                                         picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: unsetChangeListener() is deprecated and will be removed from next "
-      "release. "
-      "Use removeChangeListener() instead.");
+  DEPRECATION_WARN(
+      "unsetChangeListener() is deprecated and will be removed from next "
+      "release. Use removeChangeListener() instead.",
+      "3.0");
   // CHECK_PRIVILEGE_ACCESS(kPrivilegeContentRead, &out);
   CHECK_PRIVILEGE_ACCESS(kPrivilegeContentWrite, &out);
 
index 51baab3..9381846 100755 (executable)
@@ -405,9 +405,10 @@ ContentManager.prototype.removeChangeListener = function() {
 };
 
 ContentManager.prototype.setChangeListener = function(changeCallback) {
-    privUtils_.warn(
-        'DEPRECATION WARNING: setChangeListener() is deprecated and will be removed ' +
-            'from next release. Use addChangeListener() instead.'
+    privUtils_.deprecationWarn(
+        'setChangeListener() is deprecated and will be removed ' +
+            'from next release. Use addChangeListener() instead.',
+        '3.0'
     );
 
     var args = validator_.validateArgs(arguments, [
@@ -453,9 +454,10 @@ ContentManager.prototype.setChangeListener = function(changeCallback) {
 };
 
 ContentManager.prototype.unsetChangeListener = function() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: unsetChangeListener() is deprecated and will be removed ' +
-            'from next release. Use removeChangeListener() instead.'
+    privUtils_.deprecationWarn(
+        'unsetChangeListener() is deprecated and will be removed ' +
+            'from next release. Use removeChangeListener() instead.',
+        '3.0'
     );
 
     var data = {};
index 9855c50..813313a 100644 (file)
@@ -170,9 +170,10 @@ FilesystemInstance::~FilesystemInstance() {
 
 void FilesystemInstance::FileCreateSync(const picojson::value& args, picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: File.createFile() is deprecated since Tizen 5.0. Use "
-      "FileSystemManager.openFile() instead.");
+  DEPRECATION_WARN(
+      "File.createFile() is deprecated since Tizen 5.0. Use "
+      "FileSystemManager.openFile() instead.",
+      "5.0");
 
   CHECK_PRIVILEGE_ACCESS(kPrivilegeFilesystemWrite, &out);
   CHECK_EXIST(args, "location", out)
@@ -194,9 +195,10 @@ void FilesystemInstance::FileCreateSync(const picojson::value& args, picojson::o
 
 void FilesystemInstance::FileRename(const picojson::value& args, picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: File.moveTo() is deprecated since Tizen 5.0. Use "
-      "FileSystemManager.moveFile() or FileSystemManager.moveDirectory() instead.");
+  DEPRECATION_WARN(
+      "File.moveTo() is deprecated since Tizen 5.0. Use "
+      "FileSystemManager.moveFile() or FileSystemManager.moveDirectory() instead.",
+      "5.0");
 
   CHECK_PRIVILEGE_ACCESS(kPrivilegeFilesystemWrite, &out);
   CHECK_EXIST(args, "callbackId", out)
@@ -672,9 +674,10 @@ static std::vector<std::uint8_t> decode(const char* str, std::size_t len) {
 
 void FilesystemInstance::FileReadString(const picojson::value& args, picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: This method is deprecated since Tizen 5.0.Use FileHandle.readString() "
-      "or FileHandle.readStringNonBlocking() instead.");
+  DEPRECATION_WARN(
+      "This method is deprecated since Tizen 5.0.Use FileHandle.readString() "
+      "or FileHandle.readStringNonBlocking() instead.",
+      "5.0");
 
   CHECK_PRIVILEGE_ACCESS(kPrivilegeFilesystemRead, &out);
   CHECK_EXIST(args, "location", out)
@@ -706,9 +709,10 @@ void FilesystemInstance::FileReadString(const picojson::value& args, picojson::o
 
 void FilesystemInstance::FileReadBytes(const picojson::value& args, picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: This method is deprecated since Tizen 5.0. Use FileHandle.readData() "
-      "or FileHandle.readDataNonBlocking() instead.");
+  DEPRECATION_WARN(
+      "This method is deprecated since Tizen 5.0. Use FileHandle.readData() "
+      "or FileHandle.readDataNonBlocking() instead.",
+      "5.0");
 
   CHECK_PRIVILEGE_ACCESS(kPrivilegeFilesystemRead, &out);
   CHECK_EXIST(args, "location", out)
@@ -733,9 +737,10 @@ void FilesystemInstance::FileReadBytes(const picojson::value& args, picojson::ob
 
 void FilesystemInstance::FileWriteString(const picojson::value& args, picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: FileStream.write() is deprecated since Tizen 5.0. Use "
-      "FileHandle.writeString() or FileHandle.writeStringNonBlocking() instead.");
+  DEPRECATION_WARN(
+      "FileStream.write() is deprecated since Tizen 5.0. Use "
+      "FileHandle.writeString() or FileHandle.writeStringNonBlocking() instead.",
+      "5.0");
 
   CHECK_PRIVILEGE_ACCESS(kPrivilegeFilesystemWrite, &out);
   CHECK_EXIST(args, "location", out)
@@ -772,9 +777,10 @@ void FilesystemInstance::FileWriteString(const picojson::value& args, picojson::
 
 void FilesystemInstance::FileWriteBytes(const picojson::value& args, picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: FileStream.writeBytes() is deprecated since Tizen 5.0. To read and Use "
-      "FileHandle.writeData() or FileHandle.writeDataNonBlocking() instead.");
+  DEPRECATION_WARN(
+      "FileStream.writeBytes() is deprecated since Tizen 5.0. To read and Use "
+      "FileHandle.writeData() or FileHandle.writeDataNonBlocking() instead.",
+      "5.0");
 
   CHECK_PRIVILEGE_ACCESS(kPrivilegeFilesystemWrite, &out);
   CHECK_EXIST(args, "location", out)
@@ -803,10 +809,11 @@ void FilesystemInstance::FileWriteBytes(const picojson::value& args, picojson::o
 
 void FilesystemInstance::FileWriteBase64(const picojson::value& args, picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: FileStream.writeBase64() is deprecated since Tizen 5.0. Use "
+  DEPRECATION_WARN(
+      "FileStream.writeBase64() is deprecated since Tizen 5.0. Use "
       "FileHandle.writeData() or FileHandle.writeDataNonBlocking() in combination with atob() and "
-      "btoa() functions instead.");
+      "btoa() functions instead.",
+      "5.0");
 
   CHECK_PRIVILEGE_ACCESS(kPrivilegeFilesystemWrite, &out);
   CHECK_EXIST(args, "location", out)
@@ -1003,9 +1010,10 @@ void FilesystemInstance::FileSystemManagerMakeDirectory(const picojson::value& a
 void FilesystemInstance::FileSystemManagerMakeDirectorySync(const picojson::value& args,
                                                             picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: File.createDirectory() is deprecated since Tizen 5.0. Use "
-      "FileSystemManager.createDirectory() instead.");
+  DEPRECATION_WARN(
+      "File.createDirectory() is deprecated since Tizen 5.0. Use "
+      "FileSystemManager.createDirectory() instead.",
+      "5.0");
 
   CHECK_PRIVILEGE_ACCESS(kPrivilegeFilesystemWrite, &out);
   CHECK_EXIST(args, "location", out)
@@ -1025,9 +1033,10 @@ void FilesystemInstance::FileSystemManagerMakeDirectorySync(const picojson::valu
 
 void FilesystemInstance::FileReadDir(const picojson::value& args, picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: File.listFiles() is deprecated since Tizen 5.0. Use "
-      "FileSystemManager.listDirectory() instead.");
+  DEPRECATION_WARN(
+      "File.listFiles() is deprecated since Tizen 5.0. Use "
+      "FileSystemManager.listDirectory() instead.",
+      "5.0");
 
   CHECK_PRIVILEGE_ACCESS(kPrivilegeFilesystemRead, &out);
   CHECK_EXIST(args, "pathToDir", out)
@@ -1074,9 +1083,10 @@ void FilesystemInstance::FileReadDir(const picojson::value& args, picojson::obje
 
 void FilesystemInstance::FileUnlinkFile(const picojson::value& args, picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: File.deleteFile() is deprecated since Tizen 5.0. Use "
-      "FileSystemManager.deleteFile() instead.");
+  DEPRECATION_WARN(
+      "File.deleteFile() is deprecated since Tizen 5.0. Use "
+      "FileSystemManager.deleteFile() instead.",
+      "5.0");
 
   CHECK_PRIVILEGE_ACCESS(kPrivilegeFilesystemWrite, &out);
   CHECK_EXIST(args, "pathToFile", out)
@@ -1110,9 +1120,10 @@ void FilesystemInstance::FileUnlinkFile(const picojson::value& args, picojson::o
 
 void FilesystemInstance::FileRemoveDirectory(const picojson::value& args, picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: File.deleteDirectory() is deprecated since Tizen 5.0. Use "
-      "FileSystemManager.deleteDirectory() instead.");
+  DEPRECATION_WARN(
+      "File.deleteDirectory() is deprecated since Tizen 5.0. Use "
+      "FileSystemManager.deleteDirectory() instead.",
+      "5.0");
 
   CHECK_PRIVILEGE_ACCESS(kPrivilegeFilesystemWrite, &out);
   CHECK_EXIST(args, "pathToDelete", out)
@@ -1146,9 +1157,10 @@ void FilesystemInstance::FileRemoveDirectory(const picojson::value& args, picojs
 
 void FilesystemInstance::FileCopyTo(const picojson::value& args, picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: File.copyTo() is deprecated since Tizen 5.0. Use "
-      "FileSystemManager.CopyFile() or FileSystemManager.CopyDirectory() instead.");
+  DEPRECATION_WARN(
+      "File.copyTo() is deprecated since Tizen 5.0. Use "
+      "FileSystemManager.copyFile() or FileSystemManager.copyDirectory() instead.",
+      "5.0");
 
   CHECK_PRIVILEGE_ACCESS(kPrivilegeFilesystemWrite, &out);
   CHECK_EXIST(args, "callbackId", out)
index 63933cc..0e99f39 100644 (file)
@@ -60,9 +60,10 @@ function File(data) {
 }
 
 function toURI() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: File.toURI() is deprecated since Tizen 5.0. ' +
-            'Use FileSystemManager.toURI() instead.'
+    privUtils_.deprecationWarn(
+        'File.toURI() is deprecated since Tizen 5.0. ' +
+            'Use FileSystemManager.toURI() instead.',
+        '5.0'
     );
 
     xwalk.utils.checkPrivilegeAccess(xwalk.utils.privilege.FILESYSTEM_READ);
@@ -170,9 +171,10 @@ function checkFile(file, fileFilter) {
 }
 
 function listFiles() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: File.listFiles() is deprecated since Tizen 5.0. ' +
-            'Use FileSystemManager.listDirectory() instead.'
+    privUtils_.deprecationWarn(
+        'File.listFiles() is deprecated since Tizen 5.0. ' +
+            'Use FileSystemManager.listDirectory() instead.',
+        '5.0'
     );
 
     var args = validator_.validateArgs(arguments, [
@@ -263,9 +265,10 @@ function _checkEncoding(encoding) {
 }
 
 function openStream() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: File.openStream() is deprecated since Tizen 5.0. ' +
-            'Use FileHandle interface to read/write operations instead.'
+    privUtils_.deprecationWarn(
+        'File.openStream() is deprecated since Tizen 5.0. ' +
+            'Use FileHandle interface to read/write operations instead.',
+        '5.0'
     );
 
     var args = validator_.validateArgs(arguments, [
@@ -324,9 +327,10 @@ File.prototype.openStream = function() {
 };
 
 function readAsText() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: File.readAsText() is deprecated since Tizen 5.0. ' +
-            'Use FileHandle.readString() or FileHandle.readStringNonBlocking() instead.'
+    privUtils_.deprecationWarn(
+        'File.readAsText() is deprecated since Tizen 5.0. ' +
+            'Use FileHandle.readString() or FileHandle.readStringNonBlocking() instead.',
+        '5.0'
     );
 
     var args = validator_.validateArgs(arguments, [
@@ -384,10 +388,11 @@ File.prototype.readAsText = function() {
 };
 
 function copyTo() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: File.copyTo() is deprecated since Tizen 5.0. ' +
-            'Use FileSystemManager.CopyFile() or FileSystemManager.CopyDirectory() ' +
-            'instead.'
+    privUtils_.deprecationWarn(
+        'File.copyTo() is deprecated since Tizen 5.0. ' +
+            'Use FileSystemManager.copyFile() or FileSystemManager.copyDirectory() ' +
+            'instead.',
+        '5.0'
     );
 
     var args = validator_.validateArgs(arguments, [
@@ -586,10 +591,11 @@ File.prototype.copyTo = function() {
 };
 
 function moveTo() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: File.moveTo() is deprecated since Tizen 5.0. ' +
+    privUtils_.deprecationWarn(
+        'File.moveTo() is deprecated since Tizen 5.0. ' +
             'Use FileSystemManager.moveFile() or FileSystemManager.moveDirectory() ' +
-            'instead.'
+            'instead.',
+        '5.0'
     );
 
     var args = validator_.validateArgs(arguments, [
@@ -742,9 +748,10 @@ File.prototype.moveTo = function() {
 };
 
 function createDirectory() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: File.createDirectory() is deprecated since Tizen 5.0. ' +
-            'Use FileSystemManager.createDirectory() instead.'
+    privUtils_.deprecationWarn(
+        'File.createDirectory() is deprecated since Tizen 5.0. ' +
+            'Use FileSystemManager.createDirectory() instead.',
+        '5.0'
     );
 
     var args = validator_.validateArgs(arguments, [
@@ -825,9 +832,10 @@ File.prototype.createDirectory = function() {
 };
 
 function createFile() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: File.createFile() is deprecated since Tizen 5.0. ' +
-            'Use FileSystemManager.createFile() instead.'
+    privUtils_.deprecationWarn(
+        'File.createFile() is deprecated since Tizen 5.0. ' +
+            'Use FileSystemManager.createFile() instead.',
+        '5.0'
     );
 
     var args = validator_.validateArgs(arguments, [
@@ -897,9 +905,10 @@ File.prototype.createFile = function() {
 };
 
 function resolveFile() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: File.resolve() is deprecated since Tizen 5.0. ' +
-            'Use FileHandle and FileSystemManager interfaces instead.'
+    privUtils_.deprecationWarn(
+        'File.resolve() is deprecated since Tizen 5.0. ' +
+            'Use FileHandle and FileSystemManager interfaces instead.',
+        '5.0'
     );
 
     var args = validator_.validateArgs(arguments, [
@@ -962,9 +971,10 @@ File.prototype.resolve = function() {
 };
 
 function deleteDirectory() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: File.deleteDirectory() is deprecated since Tizen 5.0. ' +
-            'Use FileSystemManager.deleteDirectory() instead.'
+    privUtils_.deprecationWarn(
+        'File.deleteDirectory() is deprecated since Tizen 5.0. ' +
+            'Use FileSystemManager.deleteDirectory() instead.',
+        '5.0'
     );
 
     var args = validator_.validateArgs(arguments, [
@@ -1096,9 +1106,10 @@ File.prototype.deleteDirectory = function() {
 };
 
 function deleteFile() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: File.deleteFile() is deprecated since Tizen 5.0. ' +
-            'Use FileSystemManager.deleteFile() instead.'
+    privUtils_.deprecationWarn(
+        'File.deleteFile() is deprecated since Tizen 5.0. ' +
+            'Use FileSystemManager.deleteFile() instead.',
+        '5.0'
     );
 
     var args = validator_.validateArgs(arguments, [
index dda1f5d..38d05cc 100644 (file)
@@ -66,9 +66,10 @@ function _checkClosed(stream) {
 }
 
 function closeFileStream() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: FileStream.close() is deprecated since Tizen 5.0. ' +
-            'Use FileHandle.close() instead.'
+    privUtils_.deprecationWarn(
+        'FileStream.close() is deprecated since Tizen 5.0. ' +
+            'Use FileHandle.close() instead.',
+        '5.0'
     );
 
     this._closed = true;
@@ -91,9 +92,10 @@ function _checkWriteAccess(mode) {
 }
 
 function read() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: FileStream.read() is deprecated since Tizen 5.0. ' +
-            'Use FileHandle.readString() or FileHandle.readStringNonBlocking() instead.'
+    privUtils_.deprecationWarn(
+        'FileStream.read() is deprecated since Tizen 5.0. ' +
+            'Use FileHandle.readString() or FileHandle.readStringNonBlocking() instead.',
+        '5.0'
     );
 
     var args = validator_.validateArgs(arguments, [
@@ -197,19 +199,21 @@ function readBytes() {
 }
 
 FileStream.prototype.readBytes = function() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: FileStream.readBytes() is deprecated since Tizen 5.0. ' +
-            'Use FileHandle.readData() or FileHandle.readDataNonBlocking() instead.'
+    privUtils_.deprecationWarn(
+        'FileStream.readBytes() is deprecated since Tizen 5.0. ' +
+            'Use FileHandle.readData() or FileHandle.readDataNonBlocking() instead.',
+        '5.0'
     );
 
     return readBytes.apply(this, arguments);
 };
 
 FileStream.prototype.readBase64 = function() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: FileStream.readBase64() is deprecated since Tizen 5.0. ' +
-            'Use FileHandle.readData() or FileHandle.readDataNonBlocking() in ' +
-            'combination with atob() and btoa() functions instead.'
+    privUtils_.deprecationWarn(
+        'FileStream.readBase64() is deprecated since Tizen 5.0. ' +
+            'Use FileHandle.readData() or FileHandle.readDataNonBlocking() in combination ' +
+            'with atob() and btoa() functions instead.',
+        '5.0'
     );
 
     return base64_encode(readBytes.apply(this, arguments));
@@ -228,9 +232,10 @@ function check_characters_outside_latin1(str) {
 }
 
 function write() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: FileStream.write() is deprecated since Tizen 5.0. ' +
-            'Use FileHandle.writeString() or FileHandle.writeStringNonBlocking() instead.'
+    privUtils_.deprecationWarn(
+        'FileStream.write() is deprecated since Tizen 5.0. ' +
+            'Use FileHandle.writeString() or FileHandle.writeStringNonBlocking() instead.',
+        '5.0'
     );
 
     var args = validator_.validateArgs(arguments, [
@@ -275,9 +280,10 @@ FileStream.prototype.write = function() {
 };
 
 function writeBytes() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: FileStream.writeBytes() is deprecated since Tizen 5.0. ' +
-            'Use FileHandle.writeData() or FileHandle.writeDataNonBlocking() instead.'
+    privUtils_.deprecationWarn(
+        'FileStream.writeBytes() is deprecated since Tizen 5.0. ' +
+            'Use FileHandle.writeData() or FileHandle.writeDataNonBlocking() instead.',
+        '5.0'
     );
 
     var args = validator_.validateArgs(arguments, [
@@ -322,10 +328,11 @@ FileStream.prototype.writeBytes = function() {
 };
 
 function writeBase64() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: FileStream.writeBase64() is deprecated since Tizen 5.0. ' +
-            'Use FileHandle.writeData() or FileHandle.writeDataNonBlocking() in ' +
-            'combination with atob() and btoa() functions instead.'
+    privUtils_.deprecationWarn(
+        'FileStream.writeBase64() is deprecated since Tizen 5.0. ' +
+            'Use FileHandle.writeData() or FileHandle.writeDataNonBlocking() in combination ' +
+            'with atob() and btoa() functions instead.',
+        '5.0'
     );
 
     var args = validator_.validateArgs(arguments, [
index 37d65b4..9651bd1 100644 (file)
@@ -606,9 +606,10 @@ FileSystemManager.prototype.getDirName = function() {
 };
 
 function resolve() {
-    privUtils_.warn(
-        'DEPRECATION WARNING: FileSystemManager.resolve() is deprecated since ' +
-            'Tizen 5.0. Use FileHandle and FileSystemManager interfaces instead.'
+    privUtils_.deprecationWarn(
+        'FileSystemManager.resolve() is deprecated since Tizen 5.0. ' +
+            'Use FileHandle and FileSystemManager interfaces instead.',
+        '5.0'
     );
 
     var args = validator_.validateArgs(arguments, [
index 89c795c..6654c09 100644 (file)
@@ -54,9 +54,10 @@ PushInstance::PushInstance() {
 
 void PushInstance::PushRegisterService(const picojson::value& args, picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: registerService() is deprecated and will be removed from next release. "
-      "Use register() instead.");
+  DEPRECATION_WARN(
+      "registerService() is deprecated and will be removed from next release. "
+      "Use register() instead.",
+      "3.0");
 
   CHECK_PRIVILEGE_ACCESS(kPrivilegePush, &out);
   common::PlatformResult result = impl->registerService(args.get("callbackId").get<double>());
@@ -81,9 +82,10 @@ void PushInstance::PushRegisterApplication(const picojson::value& args, picojson
 
 void PushInstance::PushUnregisterService(const picojson::value& args, picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: unregisterService() is deprecated and will be removed from next "
-      "release. Use unregister() instead.");
+  DEPRECATION_WARN(
+      "unregisterService() is deprecated and will be removed from next "
+      "release. Use unregister() instead.",
+      "3.0");
 
   CHECK_PRIVILEGE_ACCESS(kPrivilegePush, &out);
 
@@ -110,9 +112,10 @@ void PushInstance::PushUnregisterApplication(const picojson::value& args, picojs
 
 void PushInstance::PushConnectService(const picojson::value& args, picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: connectService() is deprecated and will be removed from next release. "
-      "Use connect() instead.");
+  DEPRECATION_WARN(
+      "connectService() is deprecated and will be removed from next release. "
+      "Use connect() instead.",
+      "3.0");
 
   CHECK_PRIVILEGE_ACCESS(kPrivilegePush, &out);
 
@@ -139,9 +142,10 @@ void PushInstance::PushConnect(const picojson::value& args, picojson::object& ou
 
 void PushInstance::PushDisconnectService(const picojson::value& args, picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: disconnectService() is deprecated and will be removed from next "
-      "release. Use disconnect() instead.");
+  DEPRECATION_WARN(
+      "disconnectService() is deprecated and will be removed from next "
+      "release. Use disconnect() instead.",
+      "3.0");
 
   CHECK_PRIVILEGE_ACCESS(kPrivilegePush, &out);
 
index 217ec36..1dcc339 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "sensor_service.h"
 
-#include <glib.h>
 #include <memory>
 #include <mutex>
 #include <string>
index 4c56af8..5b43229 100644 (file)
@@ -87,8 +87,7 @@ PlatformResult SysteminfoUtils::CheckWifiSupport() {
     return ret;
   }
   if (!supported) {
-    return LogAndCreateResult(ErrorCode::NOT_SUPPORTED_ERR,
-                              "Wifi is not supported on this device");
+    return LogAndCreateResult(ErrorCode::NOT_SUPPORTED_ERR, "Wifi is not supported on this device");
   }
   return PlatformResult(ErrorCode::NO_ERROR);
 }
index c5f6138..4e4bc7a 100644 (file)
@@ -478,10 +478,11 @@ function SystemInfoStorageUnit(data) {
         isRemoveable: {
             enumerable: true,
             get: function() {
-                privUtils_.warn(
-                    'DEPRECATION WARNING: SystemInfoStorageUnit.isRemoveable is ' +
-                        'deprecated and will be removed from next release. ' +
-                        'Use SystemInfoStorageUnit.isRemovable instead.'
+                privUtils_.deprecationWarn(
+                    'SystemInfoStorageUnit.isRemoveable is is ' +
+                        'deprecated and will be removed from next release.' +
+                        'Use SystemInfoStorageUnit.isRemovable instead.',
+                    '2.1'
                 );
                 return _isRemovable;
             },
@@ -796,8 +797,9 @@ var SystemInfo = function() {};
 
 SystemInfo.prototype.getCapabilities = function() {
     privUtils_.warn(
-        'DEPRECATION WARNING: getCapabilities() is deprecated and will be removed ' +
-            'from next release. Use getCapability() instead.'
+        'getCapabilities() is deprecated and will be removed' +
+            'from next release. Use getCapability() instead.',
+        '2.3'
     );
 
     var result = native_.callSync('SystemInfoGetCapabilities', {});
index a8b5845..7a4905f 100644 (file)
@@ -77,9 +77,10 @@ SysteminfoInstance::~SysteminfoInstance() {
 void SysteminfoInstance::SystemInfoGetCapabilities(const picojson::value& args,
                                                    picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: getCapabilities() is deprecated and will be removed from next release. "
-      "Use getCapability() instead.");
+  DEPRECATION_WARN(
+      "getCapabilities() is deprecated and will be removed from next release. "
+      "Use getCapability() instead.",
+      "2.3");
 
   manager_.GetCapabilities(args, &out);
 }
index edd0020..e9b9822 100644 (file)
@@ -75,6 +75,7 @@ const std::string kPropertyIdSim = "SIM";
 const std::string kPropertyIdPeripheral = "PERIPHERAL";
 const std::string kPropertyIdMemory = "MEMORY";
 const std::string kPropertyIdCameraFlash = "CAMERA_FLASH";
+const std::string kPropertyIdNetProxyNetwork = "NET_PROXY_NETWORK";
 const std::string kPropertyIdServiceCountry = "SERVICE_COUNTRY";
 
 #define CHECK_EXIST(args, name, out)                                              \
@@ -1398,26 +1399,29 @@ PlatformResult SysteminfoManager::GetPropertyCount(const std::string& property,
                                                    unsigned long* count) {
   ScopeLogger();
 
-  if ("BATTERY" == property || "CPU" == property || "STORAGE" == property ||
-      "DISPLAY" == property || "DEVICE_ORIENTATION" == property || "BUILD" == property ||
-      "LOCALE" == property || "WIFI_NETWORK" == property || "PERIPHERAL" == property ||
-      "MEMORY" == property || "NET_PROXY_NETWORK" == property) {
+  if (kPropertyIdBattery == property || kPropertyIdCpu == property ||
+      kPropertyIdStorage == property || kPropertyIdDisplay == property ||
+      kPropertyIdDeviceOrientation == property || kPropertyIdBuild == property ||
+      kPropertyIdLocale == property || kPropertyIdWifiNetwork == property ||
+      kPropertyIdPeripheral == property || kPropertyIdMemory == property ||
+      kPropertyIdNetProxyNetwork == property) {
     *count = kDefaultPropertyCount;
-  } else if ("CELLULAR_NETWORK" == property || "SIM" == property || "NETWORK" == property) {
+  } else if (kPropertyIdCellularNetwork == property || kPropertyIdSim == property ||
+             kPropertyIdNetwork == property) {
     PlatformResult ret = SysteminfoUtils::CheckTelephonySupport();
     if (ret.IsError()) {
       *count = 0;
       if ("NETWORK" == property && SysteminfoUtils::CheckWifiSupport()) {
-      // Telephony is not supported in this case, but WiFi is still supported, thus setting
-      // counter to 1.
+        // Telephony is not supported in this case, but WiFi is still supported, thus setting
+        // counter to 1.
         *count = 1;
       }
     } else {
       *count = tapi_manager_->GetSimCount();
     }
-  } else if ("CAMERA_FLASH" == property) {
+  } else if (kPropertyIdCameraFlash == property) {
     *count = GetCameraTypesCount();
-  } else if ("ETHERNET_NETWORK" == property) {
+  } else if (kPropertyIdEthernetNetwork == property) {
     PlatformResult ret = SysteminfoUtils::CheckIfEthernetNetworkSupported();
     if (ret.IsError()) {
       *count = 0;
index f331529..65a2642 100644 (file)
@@ -7,6 +7,7 @@
 #include "common/logger.h"
 #include "common/picojson.h"
 #include "common/platform_result.h"
+#include "common/tools.h"
 
 namespace extension {
 namespace time {
@@ -244,9 +245,10 @@ void TimeInstance::TZDateToString(const picojson::value& args, picojson::object&
 void TimeInstance::TZDateGetTimezoneAbbreviation(const picojson::value& args,
                                                  picojson::object& out) {
   ScopeLogger();
-  LoggerW(
-      "DEPRECATION WARNING: getTimezoneAbbreviation() is deprecated and will be removed from next "
-      "release.");
+  DEPRECATION_WARN(
+      "getTimezoneAbbreviation() is deprecated and will be removed from next "
+      "release.",
+      "2.1");
 
   if (!args.contains("timezone") || !args.contains("timestamp")) {
     LogAndReportError(PlatformResult(ErrorCode::INVALID_VALUES_ERR, "Invalid parameter passed."),
index 78ab6e5..be4d267 100644 (file)
@@ -1,3 +1,4 @@
+/*eslint-disable */
 /*
 MIT License
 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@@ -10713,4 +10714,4 @@ module.exports = function typeDetect(obj) {
 module.exports.typeDetect = module.exports;
 
 },{}]},{},[1])(1)
-});
\ No newline at end of file
+});
index 4d7aa58..d62a2cd 100644 (file)
@@ -1,3 +1,4 @@
+/*eslint-disable */
 /*
 MIT License
 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
index 2ff6b09..28c4e34 100644 (file)
@@ -212,14 +212,26 @@ function Utils() {
 Utils.prototype.error = console.error.bind(console);
 Utils.prototype.warn = console.warn.bind(console);
 Utils.prototype.log = _enableJsLogs ? console.log.bind(console) : function() {};
+var appVersion = undefined; // Used to cache required version of an app
+
+/**
+ * @param {string} msg Message to be logged on warn level.
+ * @param {string} deprecationVersion Version from which the deprecation log must appear.
+ */
+Utils.prototype.deprecationWarn = function(msg, deprecationVersion) {
+    // For public code, warning should be always shown
+    this.warn('DEPRECATION WARNING: ' + msg);
+};
+
+Utils.prototype.assert = console.assert.bind(console);
 if (console.assert) {
     Utils.prototype.assert = console.assert.bind(console);
 } else {
     Utils.prototype.assert = function() {
         if (false === arguments[0]) {
-            console.error("Assertion failed: ", Array.prototype.slice.call(arguments, 1));
+            console.error('Assertion failed: ', Array.prototype.slice.call(arguments, 1));
         }
-    }
+    };
 }
 
 Utils.prototype.global = _global;
@@ -1353,15 +1365,19 @@ NativeManager.prototype.getErrorObject = function(result) {
  * valid_error_names should contain error names defined in the API reference
  * for the called function.
  */
-NativeManager.prototype.getErrorObjectAndValidate = function(result,
-                                                             valid_error_names,
-                                                             default_error) {
-    xwalk.utils.assert(Array.isArray(valid_error_names),
-                       "valid_error_names must be an Array. %s was passed instead",
-                       typeof valid_error_names);
+NativeManager.prototype.getErrorObjectAndValidate = function(
+    result,
+    valid_error_names,
+    default_error
+) {
+    xwalk.utils.assert(
+        Array.isArray(valid_error_names),
+        'valid_error_names must be an Array. %s was passed instead',
+        typeof valid_error_names
+    );
     var error = new WebAPIException(result.error);
     if (valid_error_names.includes(error.name)) {
-      return error;
+        return error;
     }
 
     return default_error;