[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 7414e12f2915b8a245a8746ef36b1dd0a6847f00..e9321922f88290b2e2bfe0576eb811423930438e 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 e709709768074b1a2ae08bd4911478c77bf2c710..0a700e85f1d44a42f6189eb8dd6d2e677013933b 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 4de3140f6495a25eee0e629805b6436f51002b65..c1d84d29d920a9d883b37bd82750a10f115f6684 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "application_manager.h"
 
-#include <glib.h>
 #include <sys/stat.h>
 #include <unistd.h>
 #include <thread>
index 140b749644481d5fd7b8459c436c7e242ce0891c..5de70f0bd820491e4b86e04536ff26efab3fe394 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 49bbaa3e56d7ee8d379d9eea69637134a7a9e8d0..6c21fd8ed61b8552d3a218b0facddd08638e568e 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 2a8116ca307acbdbb16e1b4a09d8f98eaec14ad3..c48edec57803ce920b4fb41c6eb4495948925d22 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 49095af56b3a0654174cd109ba15f5083d88afdf..b8bc61db605aa98919aaf58c652007ad40744e58 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 228c871b5a72c76818a2cfd9ed0ff50078bae1cf..f2a1ef6541dd9e92ae519faac3acabf4b7aea97a 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 24861b618dc76d7bbb748642b069a19cba29aa73..9b46159c77ac82e31463fd4169d84abc185424fa 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 51baab3ba45ff7b33888f78b4e6657090b893b2b..93818461766659d9de1a094117a416261785b851 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 9855c502673e0e5de3ece6be71788979eccc7813..813313a52330b53640e0f2f806443055f443edca 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 63933cce534ea9a0ac2de3d85014dc8e0126c5b0..0e99f390273fd4bd035faec48c397287d0281572 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 dda1f5de9cbf6de3a7f4f30063a363b1c5abd6ba..38d05cc9c2f8e4f9bb7f4842423c17f4cc7b8624 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 37d65b4a353cf5272d6af6bb9d341ef7d7ea70fc..9651bd1ecd2f8fe04820e419fb3b48edb8c9d074 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 89c795c72a2ddca63b586f0b1e532eab4702924a..6654c09944cc11147755f7f140e3e5d24a83ee73 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 217ec36ec76130be35ed62497e34dcb53b4bfa30..1dcc339deb061fe33d6d8e671e918e74baa615a4 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "sensor_service.h"
 
-#include <glib.h>
 #include <memory>
 #include <mutex>
 #include <string>
index 4c56af852e09a12677cef93ada66e1ec292b5bf9..5b432294df10195084064c8bd20f2cf8e4fea86e 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 c5f6138759ac74608b25a6c990ec3bd89637a084..4e4bc7ac5ec138865ace00aaf7f2410e13569f36 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 a8b5845dba1b27e3620b1c452dc2946b246bed0d..7a4905fd6f86bceb4c10f6ba513fe22ecaf9c0ba 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 edd00204c0e90a9b4b0c2646c74eb729c997cce5..e9b9822d23253e4f9b78f3fdff6e7e740d343883 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 f331529f6a3544b2e38f1f97691d29d2fd485d6b..65a26422791bcd893ffa1337226801504c3ffdd5 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 78ab6e5619562ffb5ad198ce3842d295df779ea9..be4d26745c66a2b3e52710bafb72c512b950ba0a 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 4d7aa581d1fec6b66f2ccacda7cb2d5020fade3b..d62a2cd1f013e6a43be0c07b36a1a15d6496ec80 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 2ff6b09cb246d241439adde9037eb1b59004fad4..28c4e347665f4526382ee01ca37b37539c78054c 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;