[NetworkInformation] Code structure changed to match cordova architecture.
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Thu, 7 Apr 2016 12:43:50 +0000 (14:43 +0200)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Thu, 7 Apr 2016 12:43:50 +0000 (14:43 +0200)
Change-Id: I0bd584511e991e1f9a59abb4f998f111f336998d
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/cordova-api.gyp
src/lib/cordova_plugins.js
src/lib/plugins/cordova-plugin-network-information/tizen/Connection.js [new file with mode: 0644]
src/lib/plugins/cordova-plugin-network-information/tizen/NetworkStatus.js [moved from src/networkinformation/cordova_networkinformation_api.js with 69% similarity]
src/networkinformation/cordova_networkinformation.gyp [deleted file]
src/networkinformation/cordova_networkinformation_extension.cc [deleted file]
src/networkinformation/cordova_networkinformation_extension.h [deleted file]

index af8643b..1fc74b9 100644 (file)
@@ -11,7 +11,6 @@
         'cordova/cordova.gyp:*',
         'file/cordova_file.gyp:*',
         'globalization/cordova_globalization.gyp:*',
-        'networkinformation/cordova_networkinformation.gyp:*',
       ],
     },
   ], # end targets
index 9d4303a..ebf0716 100644 (file)
@@ -240,6 +240,19 @@ module.exports = [
         ]
     },
     {
+      "file": "plugins/cordova-plugin-network-information/tizen/NetworkStatus.js",
+      "id": "cordova-plugin-network-information.tizen.NetworkStatus",
+      "runs": true
+    },
+    {
+      "file": "plugins/cordova-plugin-network-information/tizen/Connection.js",
+      "id": "cordova-plugin-network-information.tizen.Connection",
+      "clobbers": [
+          "navigator.connection",
+          "navigator.network.connection"
+      ]
+    },
+    {
         "file": "plugins/cordova-plugin-globalization/www/GlobalizationError.js",
         "id": "cordova-plugin-globalization.GlobalizationError",
         "clobbers": [
diff --git a/src/lib/plugins/cordova-plugin-network-information/tizen/Connection.js b/src/lib/plugins/cordova-plugin-network-information/tizen/Connection.js
new file mode 100644 (file)
index 0000000..e775328
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+// TODO: remove when added to public cordova repository -> begin
+var plugin_name_type = 'cordova-plugin-network-information.tizen.Connection';
+
+cordova.define(plugin_name_type, function(require, exports, module) {
+//TODO: remove -> end
+
+var exec = require('cordova/exec');
+
+function NetworkConnection() {
+  this.type = Connection.UNKNOWN;
+  var that = this;
+  function successCallback(info) {
+    that.type = info;
+  }
+
+  function errorCallback() {
+    that.type = Connection.UNKNOWN;
+  }
+
+  function getType() {
+    exec(successCallback, errorCallback, 'NetworkStatus', 'getConnectionInfo', []);
+  }
+
+  document.addEventListener('offline', getType);
+  document.addEventListener('online', getType);
+}
+var me = new NetworkConnection();
+
+module.exports = me;
+
+//TODO: remove when added to public cordova repository -> begin
+});
+// TODO: remove -> end
@@ -90,42 +90,4 @@ console.log('Loaded cordova.networkinformation API');
 
 // TODO: remove when added to public cordova repository -> begin
 });
-
-var plugin_name_type = 'cordova-plugin-network-information.tizen.NetworkStatus.type';
-
-cordova.define(plugin_name_type, function(require, exports, module) {
 //TODO: remove -> end
-
-var exec = require('cordova/exec');
-
-function NetworkConnection() {
-  this.type = Connection.UNKNOWN;
-  var that = this;
-  function successCallback(info) {
-    that.type = info;
-  }
-
-  function errorCallback() {
-    that.type = Connection.UNKNOWN;
-  }
-
-  function getType() {
-    exec(successCallback, errorCallback, 'NetworkStatus', 'getConnectionInfo', []);
-  }
-
-  document.addEventListener('offline', getType);
-  document.addEventListener('online', getType);
-}
-var me = new NetworkConnection();
-
-module.exports = me;
-
-//TODO: remove when added to public cordova repository -> begin
-});
-
-exports = function(require) {
-  require('cordova-tizen').addPlugin('cordova-plugin-network-information.network', plugin_name, 'runs');
-  require('cordova-tizen').addPlugin('cordova-plugin-network-information.network', plugin_name_type, 'clobbers', 'navigator.connection');
-  require('cordova-tizen').addPlugin('cordova-plugin-network-information.network', plugin_name_type, 'clobbers', 'navigator.network.connection');
-};
-// TODO: remove -> end
diff --git a/src/networkinformation/cordova_networkinformation.gyp b/src/networkinformation/cordova_networkinformation.gyp
deleted file mode 100644 (file)
index e22a8d1..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-{
-  'includes':[
-    '/usr/include/webapi-plugins/src/common/common.gypi',
-  ],
-  'targets': [
-    {
-      'target_name': 'tizen_cordova_networkinformation',
-      'type': 'loadable_module',
-      'sources': [
-        'cordova_networkinformation_api.js',
-        'cordova_networkinformation_extension.cc',
-        'cordova_networkinformation_extension.h',
-      ],
-      'include_dirs': [
-        '../',
-        '<(SHARED_INTERMEDIATE_DIR)',
-      ],
-      'variables': {
-        'packages': [
-          'webapi-plugins',
-        ],
-      },
-    },
-  ],
-}
diff --git a/src/networkinformation/cordova_networkinformation_extension.cc b/src/networkinformation/cordova_networkinformation_extension.cc
deleted file mode 100644 (file)
index fdcec2e..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-#include "networkinformation/cordova_networkinformation_extension.h"
-
-// This will be generated from cordova_networkinformation_api.js
-extern const char kSource_cordova_networkinformation_api[];
-
-common::Extension* CreateExtension() {
-  return new extension::cordova::networkinformation::CordovaNetworkInformationExtension();
-}
-
-namespace extension {
-namespace cordova {
-namespace networkinformation {
-
-CordovaNetworkInformationExtension::CordovaNetworkInformationExtension() {
-  SetExtensionName("tizen.cordova.networkinformation");
-  SetJavaScriptAPI(kSource_cordova_networkinformation_api);
-}
-
-CordovaNetworkInformationExtension::~CordovaNetworkInformationExtension() {}
-
-}  // networkinformation
-}  // cordova
-}  // extension
diff --git a/src/networkinformation/cordova_networkinformation_extension.h b/src/networkinformation/cordova_networkinformation_extension.h
deleted file mode 100644 (file)
index 3168b57..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-#ifndef NETWORKINFORMATION_CORDOVA_NETWORKINFORMATION_EXTENSION_H_
-#define NETWORKINFORMATION_CORDOVA_NETWORKINFORMATION_EXTENSION_H_
-
-#include <common/extension.h>
-
-namespace extension {
-namespace cordova {
-namespace networkinformation {
-
-class CordovaNetworkInformationExtension : public common::Extension {
- public:
-  CordovaNetworkInformationExtension();
-  virtual ~CordovaNetworkInformationExtension();
-};
-
-}  // networkinformation
-}  // cordova
-}  // extension
-
-#endif // NETWORKINFORMATION_CORDOVA_NETWORKINFORMATION_EXTENSION_H_