You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by no...@apache.org on 2020/06/10 19:23:13 UTC

[cordova-plugin-network-information] branch master updated: refactor: Removed all references of deprecated navigator.network (#117)

This is an automated email from the ASF dual-hosted git repository.

normanbreau pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-network-information.git


The following commit(s) were added to refs/heads/master by this push:
     new ab7c85d  refactor: Removed all references of deprecated navigator.network (#117)
ab7c85d is described below

commit ab7c85d2e7774d59705da224cefb03d6402c2c8d
Author: Norman Breau <no...@normanbreau.com>
AuthorDate: Wed Jun 10 16:23:06 2020 -0300

    refactor: Removed all references of deprecated navigator.network (#117)
---
 README.md                       | 9 +++------
 plugin.xml                      | 1 -
 src/android/NetworkManager.java | 2 +-
 tests/tests.js                  | 6 ------
 4 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/README.md b/README.md
index f58c059..4214395 100644
--- a/README.md
+++ b/README.md
@@ -92,13 +92,10 @@ function checkConnection() {
 checkConnection();
 ```
 
-### API Change
+### iOS Quirks
 
-Until Cordova 2.3.0, the `Connection` object was accessed via
-`navigator.network.connection`, after which it was changed to
-`navigator.connection` to match the W3C specification.  It's still
-available at its original location, but is deprecated and will
-eventually be removed.
+- <iOS7 can't detect the type of cellular network connection.
+    - `navigator.connection.type` is set to `Connection.CELL` for all cellular data.
 
 ### Windows Quirks
 
diff --git a/plugin.xml b/plugin.xml
index cdb991d..a05111f 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -32,7 +32,6 @@ xmlns:android="http://schemas.android.com/apk/res/android"
 
     <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">
diff --git a/src/android/NetworkManager.java b/src/android/NetworkManager.java
index 6e8ecae..8698d49 100755
--- a/src/android/NetworkManager.java
+++ b/src/android/NetworkManager.java
@@ -216,7 +216,7 @@ public class NetworkManager extends CordovaPlugin {
      * @return
      */
     private void updateConnectionInfo(NetworkInfo info) {
-        // send update to javascript "navigator.network.connection"
+        // send update to javascript "navigator.connection"
         // Jellybean sends its own info
         JSONObject thisInfo = this.getConnectionInfo(info);
         if(!thisInfo.equals(lastInfo))
diff --git a/tests/tests.js b/tests/tests.js
index 3471fff..30e590a 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -25,7 +25,6 @@
 exports.defineAutoTests = function () {
     describe('Network (navigator.connection)', function () {
         it('network.spec.1 should exist', function () {
-            expect(navigator.network && navigator.network.connection).toBeDefined();
             expect(navigator.connection).toBeDefined();
         });
 
@@ -43,10 +42,6 @@ exports.defineAutoTests = function () {
             expect(validValues[navigator.connection.type]).toBe(1);
         });
 
-        it('network.spec.3 should have the same value in deprecated and non-deprecated apis', function () {
-            expect(navigator.network.connection.type).toBe(navigator.connection.type);
-        });
-
         it('network.spec.4 should define constants for connection status', function () {
             expect(Connection.UNKNOWN).toBe('unknown');
             expect(Connection.ETHERNET).toBe('ethernet');
@@ -72,7 +67,6 @@ exports.defineManualTests = function (contentEl, createActionButton) {
 
     function printNetwork () {
         eventOutput('navigator.connection.type=' + navigator.connection.type);
-        eventOutput('navigator.network.connection.type=' + navigator.network.connection.type);
     }
 
     function onEvent (e) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org