You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/06/06 16:56:47 UTC

[GitHub] [cordova-plugin-network-information] breautek commented on a change in pull request #114: Android - Fixes https://github.com/apache/cordova-plugin-network-information#110

breautek commented on a change in pull request #114:
URL: https://github.com/apache/cordova-plugin-network-information/pull/114#discussion_r436283641



##########
File path: src/android/NetworkManager.java
##########
@@ -230,9 +230,44 @@ private void updateConnectionInfo(NetworkInfo info) {
 
             sendUpdate(connectionType);
             lastInfo = thisInfo;
+        } else {
+            LOG.d(LOG_TAG, "Networkinfo state didn't change, there is no event propagated to the javascript side.");
         }
     }
 
+    private boolean connectionInfoDiffersFromLastInfo(JSONObject thisInfo) {
+        // JSONObject.equals does not work, so the equals is done explicit for every key in the object
+        if(lastInfo == null) {
+            return thisInfo != null;
+        }
+
+        if(thisInfo == null) {
+            return true;
+        }
+
+        if (valueInJSONObjectDiffersForKey(thisInfo , lastInfo, "type")) {
+            return true;
+        }
+
+        return valueInJSONObjectDiffersForKey(thisInfo , lastInfo, "extraInfo");
+    }
+
+    private boolean valueInJSONObjectDiffersForKey(JSONObject firstObject, JSONObject secondObject, String key) {

Review comment:
       As long as this doesn't affect the `PluginResult` responses, then I don't have any objection. But do you think it's necessary to be as a part of a bugfix PR, or should that change be a separate refactor PR?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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