Fixed callback/callback-ios#23 - on app resume, it always throws either an 
offline/online event even though the online state never changed


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/334fecb6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/334fecb6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/334fecb6

Branch: refs/heads/master
Commit: 334fecb6f9932953c08c930cb130578d9ba0e498
Parents: 3c87427
Author: shazron <shaz...@gmail.com>
Authored: Fri Nov 25 16:03:19 2011 -0800
Committer: shazron <shaz...@gmail.com>
Committed: Fri Nov 25 16:03:19 2011 -0800

----------------------------------------------------------------------
 PhoneGapLib/Classes/Connection.m |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/334fecb6/PhoneGapLib/Classes/Connection.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/Connection.m b/PhoneGapLib/Classes/Connection.m
index a916ada..68cf220 100644
--- a/PhoneGapLib/Classes/Connection.m
+++ b/PhoneGapLib/Classes/Connection.m
@@ -43,7 +43,13 @@
 - (void) updateReachability:(Reachability*)reachability
 {
        if (reachability) {
-               self.connectionType = [self w3cConnectionTypeFor:reachability];
+        // check whether the connection type has changed
+        NSString* newConnectionType = [self w3cConnectionTypeFor:reachability];
+        if ([newConnectionType isEqualToString:self.connectionType]) { // the 
same as before, remove dupes
+            return;
+        } else {
+            self.connectionType = [self w3cConnectionTypeFor:reachability];
+        }
        }
        
        NSString* js = nil;

Reply via email to