incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From deedu...@apache.org
Subject [13/15] webworks commit: Sync BB network native code with cordova-js.
Date Tue, 03 Apr 2012 12:59:30 GMT
Sync BB network native code with cordova-js.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/commit/29219e3f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/tree/29219e3f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/diff/29219e3f

Branch: refs/heads/master
Commit: 29219e3fb4e5eaf0efce79e39cdc8ccee12a5e30
Parents: 4180bcc
Author: Drew Walters <deedubbu@apache.org>
Authored: Thu Mar 8 14:21:32 2012 -0600
Committer: Drew Walters <deedubbu@apache.org>
Committed: Thu Mar 8 14:21:32 2012 -0600

----------------------------------------------------------------------
 .../cordova/network/ConnectionInfoAction.java      |   36 +--------------
 1 files changed, 2 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-blackberry-webworks/blob/29219e3f/framework/ext/src/org/apache/cordova/network/ConnectionInfoAction.java
----------------------------------------------------------------------
diff --git a/framework/ext/src/org/apache/cordova/network/ConnectionInfoAction.java b/framework/ext/src/org/apache/cordova/network/ConnectionInfoAction.java
index 55a5e78..2a280e6 100644
--- a/framework/ext/src/org/apache/cordova/network/ConnectionInfoAction.java
+++ b/framework/ext/src/org/apache/cordova/network/ConnectionInfoAction.java
@@ -23,8 +23,6 @@ import java.util.Hashtable;
 
 import org.apache.cordova.CordovaExtension;
 import org.apache.cordova.api.PluginResult;
-import org.apache.cordova.json4j.JSONException;
-import org.apache.cordova.json4j.JSONObject;
 import org.apache.cordova.util.Logger;
 
 import net.rim.device.api.system.Application;
@@ -41,10 +39,6 @@ import net.rim.device.api.system.WLANInfo;
  * plug-in.
  */
 public class ConnectionInfoAction {
-    // Returned JSON attributes
-    private static final String EVENT = "event";
-    private static final String TYPE = "type";
-
     // Return types
     private static final String TYPE_UNKNOWN = "unknown";
     private static final String TYPE_ETHERNET = "ethernet";
@@ -104,18 +98,8 @@ public class ConnectionInfoAction {
 
         // Retrieve the current active connection type and build the return
         // result.
-        String type = getConnectionType(true, true);
-        JSONObject connectInfo = new JSONObject();
-        try {
-            connectInfo.put(TYPE, type);
-        } catch (JSONException e) {
-            Logger.error("JSONException: " + e.getMessage());
-            return new PluginResult(PluginResult.Status.JSON_EXCEPTION,
-                    "JSONException: " + e.getMessage());
-        }
-
         PluginResult result = new PluginResult(PluginResult.Status.OK,
-                connectInfo);
+                getConnectionType(true, true));
 
         // Need to keep the call back since listeners have been registered to
         // fire events on the specified call back ID.
@@ -293,22 +277,6 @@ public class ConnectionInfoAction {
      */
     private void sendResult(String type, String event) {
 
-        JSONObject connectionInfo = new JSONObject();
-        try {
-            connectionInfo.put(TYPE, type);
-            connectionInfo.put(EVENT, event);
-        } catch (JSONException e) {
-            Logger.error("JSONException: " + e.getMessage());
-            for (Enumeration callbacks = this.callbackIds.elements(); callbacks
-                    .hasMoreElements();) {
-                String callbackId = (String) callbacks.nextElement();
-                CordovaExtension.invokeErrorCallback(callbackId,
-                        new PluginResult(PluginResult.Status.JSON_EXCEPTION,
-                                "JSONException: " + e.getMessage()));
-            }
-            return;
-        }
-
         // Only send the event if it is different then the last sent event.
         synchronized (prevType) {
             if (prevType != null && prevEvent != null && prevType.equals(type)
@@ -321,7 +289,7 @@ public class ConnectionInfoAction {
         }
 
         PluginResult result = new PluginResult(PluginResult.Status.OK,
-                connectionInfo);
+                type);
 
         // Must keep the call back active for future events.
         result.setKeepCallback(true);


Mime
View raw message