From f27b34c2a90b4e620a30a6688ce94bb9f5dc083b Mon Sep 17 00:00:00 2001 From: Marcel Kinard Date: Fri, 30 May 2014 11:52:33 -0400 Subject: [PATCH 1/6] CB-6809 Add license to CONTRIBUTING.md --- CONTRIBUTING.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1594d12..f7dbcab 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,24 @@ + + # Contributing to Apache Cordova Anyone can contribute to Cordova. And we need your contributions. From 1cec040b30084a02ce052278a13eda9c7d9d46d0 Mon Sep 17 00:00:00 2001 From: Max Woghiren Date: Tue, 3 Jun 2014 17:08:16 -0400 Subject: [PATCH 2/6] Cached extra info to better detect changes. --- src/android/NetworkManager.java | 43 +++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/src/android/NetworkManager.java b/src/android/NetworkManager.java index e2ac500..4c54b81 100755 --- a/src/android/NetworkManager.java +++ b/src/android/NetworkManager.java @@ -24,6 +24,8 @@ import org.apache.cordova.CordovaPlugin; import org.apache.cordova.PluginResult; import org.apache.cordova.CordovaWebView; import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; import android.content.BroadcastReceiver; import android.content.Context; @@ -75,7 +77,7 @@ public class NetworkManager extends CordovaPlugin { ConnectivityManager sockMan; BroadcastReceiver receiver; - private String lastStatus = ""; + private JSONObject lastInfo = null; /** * Constructor. @@ -104,7 +106,7 @@ public class NetworkManager extends CordovaPlugin { @Override public void onReceive(Context context, Intent intent) { // (The null check is for the ARM Emulator, please use Intel Emulator for better results) - if(NetworkManager.this.webView != null) + if(NetworkManager.this.webView != null) updateConnectionInfo(sockMan.getActiveNetworkInfo()); } }; @@ -126,7 +128,12 @@ public class NetworkManager extends CordovaPlugin { if (action.equals("getConnectionInfo")) { this.connectionCallbackContext = callbackContext; NetworkInfo info = sockMan.getActiveNetworkInfo(); - PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, this.getConnectionInfo(info)); + String connectionType = ""; + try { + connectionType = this.getConnectionInfo(info).get("type").toString(); + } catch (JSONException e) { } + + PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, connectionType); pluginResult.setKeepCallback(true); callbackContext.sendPluginResult(pluginResult); return true; @@ -161,13 +168,17 @@ public class NetworkManager extends CordovaPlugin { private void updateConnectionInfo(NetworkInfo info) { // send update to javascript "navigator.network.connection" // Jellybean sends its own info - String thisStatus = this.getConnectionInfo(info); - if(!thisStatus.equals(lastStatus)) + JSONObject thisInfo = this.getConnectionInfo(info); + if(!thisInfo.equals(lastInfo)) { - sendUpdate(thisStatus); - lastStatus = thisStatus; + String connectionType = ""; + try { + connectionType = thisInfo.get("type").toString(); + } catch (JSONException e) { } + + sendUpdate(connectionType); + lastInfo = thisInfo; } - } /** @@ -176,7 +187,7 @@ public class NetworkManager extends CordovaPlugin { * @param info the current active network info * @return a JSONObject that represents the network info */ - private String getConnectionInfo(NetworkInfo info) { + private JSONObject getConnectionInfo(NetworkInfo info) { String type = TYPE_NONE; if (info != null) { // If we are not connected to any network set type to none @@ -187,8 +198,19 @@ public class NetworkManager extends CordovaPlugin { type = getType(info); } } + String extraInfo = info.getExtraInfo(); + Log.d("CordovaNetworkManager", "Connection Type: " + type); - return type; + Log.d("CordovaNetworkManager", "Connection Extra Info: " + extraInfo); + + JSONObject connectionInfo = new JSONObject(); + + try { + connectionInfo.put("type", type); + connectionInfo.put("extraInfo", extraInfo); + } catch (JSONException e) { } + + return connectionInfo; } /** @@ -247,3 +269,4 @@ public class NetworkManager extends CordovaPlugin { return TYPE_UNKNOWN; } } + From fea5674007cc5157a42c6705f7e46befd1574121 Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Thu, 5 Jun 2014 12:43:41 -0700 Subject: [PATCH 3/6] updated notice file to include missing license --- NOTICE | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NOTICE b/NOTICE index 8ec56a5..fb19cbd 100644 --- a/NOTICE +++ b/NOTICE @@ -3,3 +3,6 @@ Copyright 2012 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). + +This product includes software developed by Apple Inc. License can be found in the header of the affected files. (src/ios/CDVReachability.h, src/ios/CDVReachability.m) + From be5875f9d9824bf41ddc8b9771a704f1e8719e9a Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Thu, 5 Jun 2014 13:39:43 -0700 Subject: [PATCH 4/6] CB-6877 Updated version and RELEASENOTES.md for release 0.2.9 --- RELEASENOTES.md | 9 +++++++++ plugin.xml | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 0a81aa7..dc21f3b 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -53,3 +53,12 @@ * CB-6460: Update license headers * CB-6465: Add license headers to Tizen code * Add NOTICE file + +### 0.2.9 (Jun 05, 2014) +* updated notice file to include missing license +* Cached extra info to better detect changes. +* CB-6809 Add license to CONTRIBUTING.md +* CB-6491 add CONTRIBUTING.md +* CB-6350 - Fix networkStatusForFlags return value type to work with 64-bit iOS (closes #8) +* Initial version of firefox os network information plugin +* there was an error in the object definition diff --git a/plugin.xml b/plugin.xml index 994cc94..d49c27b 100644 --- a/plugin.xml +++ b/plugin.xml @@ -21,7 +21,7 @@ + version="0.2.9"> Network Information Cordova Network Information Plugin From f4ffab9c71c767d31c2e1157303ba98a40446a16 Mon Sep 17 00:00:00 2001 From: Steven Gill Date: Thu, 5 Jun 2014 13:40:50 -0700 Subject: [PATCH 5/6] CB-6877 Incremented plugin version. --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index d49c27b..c6ae743 100644 --- a/plugin.xml +++ b/plugin.xml @@ -21,7 +21,7 @@ + version="0.2.10-dev"> Network Information Cordova Network Information Plugin From a5e9631258691890f08d94bc784f96aa304c2868 Mon Sep 17 00:00:00 2001 From: Ian Clelland Date: Tue, 10 Jun 2014 09:50:56 -0400 Subject: [PATCH 6/6] CB-6907: android: Don't crash on startup if no networks available --- src/android/NetworkManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/android/NetworkManager.java b/src/android/NetworkManager.java index 4c54b81..aa4e161 100755 --- a/src/android/NetworkManager.java +++ b/src/android/NetworkManager.java @@ -189,6 +189,7 @@ public class NetworkManager extends CordovaPlugin { */ private JSONObject getConnectionInfo(NetworkInfo info) { String type = TYPE_NONE; + String extraInfo = ""; if (info != null) { // If we are not connected to any network set type to none if (!info.isConnected()) { @@ -197,8 +198,8 @@ public class NetworkManager extends CordovaPlugin { else { type = getType(info); } + extraInfo = info.getExtraInfo(); } - String extraInfo = info.getExtraInfo(); Log.d("CordovaNetworkManager", "Connection Type: " + type); Log.d("CordovaNetworkManager", "Connection Extra Info: " + extraInfo);