From 38a8f70fb0fbf5a2307712b07b9b4f4ed80665c5 Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Wed, 5 Feb 2014 18:13:30 -0800 Subject: [PATCH 01/12] CB-5980 Incremented plugin version on dev branch. --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index d3ea3b5..5b3d869 100644 --- a/plugin.xml +++ b/plugin.xml @@ -3,7 +3,7 @@ + version="0.2.8-dev"> Network Information Cordova Network Information Plugin From d2cd2fbb638912a0362e15a313ab61ad29e4040e Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 27 Feb 2014 15:36:31 -0500 Subject: [PATCH 02/12] Add NOTICE file --- NOTICE | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 NOTICE diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..8ec56a5 --- /dev/null +++ b/NOTICE @@ -0,0 +1,5 @@ +Apache Cordova +Copyright 2012 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). From 37047348db396c3f1176d860436a03e400b7a659 Mon Sep 17 00:00:00 2001 From: Piotr Zalewa Date: Sat, 15 Mar 2014 18:44:57 -0700 Subject: [PATCH 03/12] there was an error in the object definition --- src/firefoxos/NetworkProxy.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/firefoxos/NetworkProxy.js b/src/firefoxos/NetworkProxy.js index 831706b..ec315d2 100644 --- a/src/firefoxos/NetworkProxy.js +++ b/src/firefoxos/NetworkProxy.js @@ -26,10 +26,10 @@ var cordova = require('cordova'); +var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection; module.exports = { - var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection; getConnectionInfo: function (win, fail, args) { /* @@ -57,4 +57,4 @@ module.exports = { } }; -require("cordova/firefoxos/commandProxy").add("Network", module.exports); \ No newline at end of file +require("cordova/firefoxos/commandProxy").add("Network", module.exports); From 6831f06685076dbbded4e78b2b89a09ee885f8fe Mon Sep 17 00:00:00 2001 From: Elad Katan Date: Mon, 24 Mar 2014 11:39:28 +0200 Subject: [PATCH 04/12] CB-6342 - iOS reports a cellular connection even when in Airplane mode --- src/ios/CDVConnection.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ios/CDVConnection.m b/src/ios/CDVConnection.m index 3cfdc33..cbf4d69 100644 --- a/src/ios/CDVConnection.m +++ b/src/ios/CDVConnection.m @@ -52,8 +52,14 @@ return @"none"; case ReachableViaWWAN: - return @"cellular"; - + { + BOOL isConnectionRequired = [reachability connectionRequired]; + if (isConnectionRequired) { + return @"none"; + } else { + return @"cellular"; + } + } case ReachableViaWiFi: return @"wifi"; From 69815320d1ee6054db4e116fccc0fd0ca47d10b7 Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Tue, 8 Apr 2014 16:34:37 -0700 Subject: [PATCH 05/12] CB-6422 [windows8] use cordova/exec/proxy --- src/windows8/NetworkInfoProxy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/windows8/NetworkInfoProxy.js b/src/windows8/NetworkInfoProxy.js index a95e61b..b987718 100644 --- a/src/windows8/NetworkInfoProxy.js +++ b/src/windows8/NetworkInfoProxy.js @@ -84,4 +84,4 @@ module.exports = { }; -require("cordova/windows8/commandProxy").add("NetworkStatus",module.exports); +require("cordova/exec/proxy").add("NetworkStatus",module.exports); From 44005034004559bb798f402b4ef177f5f70167d8 Mon Sep 17 00:00:00 2001 From: Rodrigo Silveira Date: Mon, 7 Apr 2014 11:32:28 -0700 Subject: [PATCH 06/12] Initial version of firefox os network information plugin --- doc/index.md | 6 +++ plugin.xml | 5 -- src/firefoxos/NetworkProxy.js | 91 +++++++++++++++++++++++------------ 3 files changed, 66 insertions(+), 36 deletions(-) diff --git a/doc/index.md b/doc/index.md index d283483..8c48ffe 100644 --- a/doc/index.md +++ b/doc/index.md @@ -37,6 +37,7 @@ wifi connection, and whether the device has an internet connection. - Windows Phone 7 and 8 - Tizen - Windows 8 +- Firefox OS # Connection @@ -108,6 +109,11 @@ eventually be removed. - Tizen can only detect a WiFi or cellular connection. - `navigator.connection.type` is set to `Connection.CELL_2G` for all cellular data. +### Firefox OS Quirks + +- Firefox OS can't detect the type of cellular network connection. + - `navigator.connection.type` is set to `Connection.CELL` for all cellular data. + # Network-related Events ## offline diff --git a/plugin.xml b/plugin.xml index 5b3d869..1baf979 100644 --- a/plugin.xml +++ b/plugin.xml @@ -23,11 +23,6 @@ xmlns:android="http://schemas.android.com/apk/res/android" - - - - - diff --git a/src/firefoxos/NetworkProxy.js b/src/firefoxos/NetworkProxy.js index ec315d2..f4e8208 100644 --- a/src/firefoxos/NetworkProxy.js +++ b/src/firefoxos/NetworkProxy.js @@ -17,44 +17,73 @@ * specific language governing permissions and limitations * under the License. * -*/ - + */ + /* - Network API overview: http://dvcs.w3.org/hg/dap/raw-file/tip/network-api/Overview.html - + Network API overview: http://www.w3.org/TR/netinfo-api/ + and http://w3c.github.io/netinfo/ */ +var cordova = require('cordova'), + Connection = require('./Connection'), + modulemapper = require('cordova/modulemapper'); -var cordova = require('cordova'); -var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection; +var origConnection = modulemapper.getOriginalSymbol(window, 'navigator.connection'); -module.exports = { - - - getConnectionInfo: function (win, fail, args) { - /* - bandwidth of type double, readonly - The user agent must set the value of the bandwidth attribute to: - 0 if the user is currently offline; - Infinity if the bandwidth is unknown; - an estimation of the current bandwidth in MB/s (Megabytes per seconds) available for communication with the browsing context active document's domain. - */ - win(connection.bandwidth); - }, - - isMetered: function (win, fail, args) { - /* - readonly attribute boolean metered - A connection is metered when the user's connection is subject to a limitation from his Internet Service Provider strong enough to request web applications to be careful with the bandwidth usage. +module.exports = { - What is a metered connection is voluntarily left to the user agent to judge. It would not be possible to give an exhaustive list of limitations considered strong enough to flag the connection as metered and even if doable, some limitations can be considered strong or weak depending on the context. - Examples of metered connections are mobile connections with a small bandwidth quota or connections with a pay-per use plan. - The user agent MUST set the value of the metered attribute to true if the connection with the browsing context active document's domain is metered and false otherwise. If the implementation is not able to know the status of the connection or if the user is offline, the value MUST be set to false. + getConnectionInfo: function(successCallback, errorCallback) { + var connection = origConnection || navigator.mozConnection, + connectionType = Connection.UNKNOWN, + bandwidth = connection.bandwidth, + metered = connection.metered, + type = connection.type; - If unable to know if a connection is metered, a user agent could ask the user about the status of his current connection. - */ - win(connection.metered); + if (type != undefined) { + // For more information see: + // https://developer.mozilla.org/en-US/docs/Web/API/Network_Information_API + + switch(type) { + case "cellular": + connectionType = Connection.CELL; + break; + case "ethernet": + connectionType = Connection.ETHERNET; + break; + case "wifi": + connectionType = Connection.WIFI; + break; + case "none": + connectionType = Connection.NONE; + break; + } + } else if (bandwidth != undefined && metered != undefined) { + /* + bandwidth of type double, readonly + The user agent must set the value of the bandwidth attribute to: + 0 if the user is currently offline; + Infinity if the bandwidth is unknown; + an estimation of the current bandwidth in MB/s (Megabytes per seconds) + available for communication with the browsing context active document's + domain. + + For more information see: + https://developer.mozilla.org/en-US/docs/Web/API/Connection + */ + + if (bandwidth === 0) { + connectionType = Connection.NONE; + } else if (metered && isFinite(bandwidth)) { + connectionType = Connection.CELL; + } else if (!metered && isFinite(bandwidth)) { + connectionType = Connection.WIFI; + } } + + setTimeout(function() { + successCallback(connectionType); + }, 0); + } }; -require("cordova/firefoxos/commandProxy").add("Network", module.exports); +require("cordova/firefoxos/commandProxy").add("NetworkStatus", module.exports); \ No newline at end of file From 8ec26ab95ec38ea3be6586760c8458adcd3fe19e Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Wed, 16 Apr 2014 16:20:06 -0400 Subject: [PATCH 07/12] CB-6460: Update license headers --- plugin.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plugin.xml b/plugin.xml index 5b3d869..84e2fe9 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,4 +1,22 @@ + Date: Thu, 17 Apr 2014 09:50:40 -0400 Subject: [PATCH 08/12] CB-6465: Add license headers to Tizen code --- src/tizen/NetworkProxy.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/tizen/NetworkProxy.js b/src/tizen/NetworkProxy.js index 1b7a89a..cd9506e 100644 --- a/src/tizen/NetworkProxy.js +++ b/src/tizen/NetworkProxy.js @@ -1,3 +1,24 @@ +/* + * + * 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. + * +*/ + var cordova = require('cordova'); var Connection = require('./Connection'); From a3e7f1a135db00b21fe8ec635ae9742f390e170e Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Thu, 17 Apr 2014 10:53:20 -0400 Subject: [PATCH 09/12] CB-6452 Updated version and RELEASENOTES.md for release 0.2.8 --- RELEASENOTES.md | 7 +++++++ plugin.xml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 6d166d2..0a81aa7 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -46,3 +46,10 @@ ### 0.2.7 (Feb 05, 2014) * Initial implementation of Tizen plugin. + +### 0.2.8 (Apr 17, 2014) +* CB-6342: [iOS] iOS reports a cellular connection even when in Airplane mode +* CB-6422: [windows8] use cordova/exec/proxy +* CB-6460: Update license headers +* CB-6465: Add license headers to Tizen code +* Add NOTICE file diff --git a/plugin.xml b/plugin.xml index 84e2fe9..34f4d29 100644 --- a/plugin.xml +++ b/plugin.xml @@ -21,7 +21,7 @@ + version="0.2.8"> Network Information Cordova Network Information Plugin From e437369c57c012953a97303dfe4383a1e99167bc Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Thu, 17 Apr 2014 11:16:03 -0400 Subject: [PATCH 10/12] CB-6452 Incremented plugin version on dev branch. --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index 34f4d29..16cd469 100644 --- a/plugin.xml +++ b/plugin.xml @@ -21,7 +21,7 @@ + version="0.2.9-dev"> Network Information Cordova Network Information Plugin From e0d3ae00b755540d163f7845ca728349f1c0ae4d Mon Sep 17 00:00:00 2001 From: Yann Lugrin Date: Wed, 26 Mar 2014 10:59:25 +0100 Subject: [PATCH 11/12] CB-6350 - Fix networkStatusForFlags return value type to work with 64-bit iOS (closes #8) Signed-off-by: Shazron Abdullah --- src/ios/CDVReachability.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ios/CDVReachability.m b/src/ios/CDVReachability.m index 89f4ec9..c60261a 100644 --- a/src/ios/CDVReachability.m +++ b/src/ios/CDVReachability.m @@ -205,7 +205,7 @@ static void CDVReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRe return NotReachable; } - BOOL retVal = NotReachable; + NetworkStatus retVal = NotReachable; if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0) { // if target host is reachable and no connection is required From c0ef6c7aeb96cc801f22f43387bcacf9e75f047f Mon Sep 17 00:00:00 2001 From: Marcel Kinard Date: Wed, 30 Apr 2014 09:33:29 -0400 Subject: [PATCH 12/12] CB-6491 add CONTRIBUTING.md --- CONTRIBUTING.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..1594d12 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,16 @@ +# Contributing to Apache Cordova + +Anyone can contribute to Cordova. And we need your contributions. + +There are multiple ways to contribute: report bugs, improve the docs, and +contribute code. + +For instructions on this, start with the +[contribution overview](http://cordova.apache.org/#contribute). + +The details are explained there, but the important items are: + - Sign and submit an Apache ICLA (Contributor License Agreement). + - Have a Jira issue open that corresponds to your contribution. + - Run the tests so your patch doesn't break existing functionality. + +We look forward to your contributions!