cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject git commit: Fixed Network plugin: bad ref in plugin.xml. Added connection constants + additional global to attach to. networks JS now registers its own channel and attaches itself to deviceready as a requirement before firing deviceready.
Date Mon, 17 Jun 2013 20:18:20 GMT
Updated Branches:
  refs/heads/master 54627b93a -> 8f551d6e6


Fixed Network plugin: bad ref in plugin.xml. Added connection constants + additional global
to attach to. networks JS now registers its own channel and attaches itself to deviceready
as a requirement before firing deviceready.


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/commit/8f551d6e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/tree/8f551d6e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/diff/8f551d6e

Branch: refs/heads/master
Commit: 8f551d6e634b972ccbfa76644a325d11563863bb
Parents: 54627b9
Author: Fil Maj <maj.fil@gmail.com>
Authored: Mon Jun 17 13:17:59 2013 -0700
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Mon Jun 17 13:17:59 2013 -0700

----------------------------------------------------------------------
 plugin.xml                      |  7 ++++++-
 src/android/NetworkManager.java |  1 +
 www/Connection.js               | 34 ++++++++++++++++++++++++++++++++++
 www/network.js                  |  4 +++-
 4 files changed, 44 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/blob/8f551d6e/plugin.xml
----------------------------------------------------------------------
diff --git a/plugin.xml b/plugin.xml
index e2b26af..15eab40 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -9,6 +9,11 @@ id="org.apache.cordova.core.NetworkManager"
     
     <js-module src="www/network.js" name="network">
         <clobbers target="navigator.connection" />
+        <clobbers target="navigator.network.connection" />
+    </js-module>
+
+    <js-module src="www/Connection.js" name="Connection">
+        <clobbers target="Connection" />
     </js-module>
             
     <!-- android -->
@@ -23,7 +28,7 @@ id="org.apache.cordova.core.NetworkManager"
             <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
         </config-file>
 
-        <source-file src="src/android/NetworkManager.java" target-dr="src/org/apache/cordova/core"
/>
+        <source-file src="src/android/NetworkManager.java" target-dir="src/org/apache/cordova/core"
/>
         
     </platform>
 

http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/blob/8f551d6e/src/android/NetworkManager.java
----------------------------------------------------------------------
diff --git a/src/android/NetworkManager.java b/src/android/NetworkManager.java
index 6853c8d..dd2bf31 100755
--- a/src/android/NetworkManager.java
+++ b/src/android/NetworkManager.java
@@ -22,6 +22,7 @@ import org.apache.cordova.api.CallbackContext;
 import org.apache.cordova.api.CordovaInterface;
 import org.apache.cordova.api.CordovaPlugin;
 import org.apache.cordova.api.PluginResult;
+import org.apache.cordova.CordovaWebView;
 import org.json.JSONArray;
 
 import android.content.BroadcastReceiver;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/blob/8f551d6e/www/Connection.js
----------------------------------------------------------------------
diff --git a/www/Connection.js b/www/Connection.js
new file mode 100644
index 0000000..f20a485
--- /dev/null
+++ b/www/Connection.js
@@ -0,0 +1,34 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+/**
+ * Network status
+ */
+module.exports = {
+        UNKNOWN: "unknown",
+        ETHERNET: "ethernet",
+        WIFI: "wifi",
+        CELL_2G: "2g",
+        CELL_3G: "3g",
+        CELL_4G: "4g",
+        CELL:"cellular",
+        NONE: "none"
+};

http://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information/blob/8f551d6e/www/network.js
----------------------------------------------------------------------
diff --git a/www/network.js b/www/network.js
index 63736a9..ccb8556 100644
--- a/www/network.js
+++ b/www/network.js
@@ -1,5 +1,4 @@
 /*
- *
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
  * distributed with this work for additional information
@@ -51,6 +50,9 @@ var me = new NetworkConnection();
 var timerId = null;
 var timeout = 500;
 
+channel.createSticky('onCordovaConnectionReady');
+channel.waitForInitialization('onCordovaConnectionReady');
+
 channel.onCordovaReady.subscribe(function() {
     me.getInfo(function(info) {
         me.type = info;


Mime
View raw message