You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2012/02/09 20:20:53 UTC

git commit: Change Reachability to PGReachability to avoid clashes with other libs

Updated Branches:
  refs/heads/master abd3fed32 -> 1bf368890


Change Reachability to PGReachability to avoid clashes with other libs


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/1bf36889
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/1bf36889
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/1bf36889

Branch: refs/heads/master
Commit: 1bf3688902c24c582986ce2ff51908aa6c2342b8
Parents: abd3fed
Author: Matthew Lanham <ma...@swanify.com>
Authored: Wed Feb 8 08:29:10 2012 +0000
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Feb 9 11:13:28 2012 -0800

----------------------------------------------------------------------
 PhoneGapLib/Classes/Connection.h   |    4 ++--
 PhoneGapLib/Classes/Connection.m   |   10 +++++-----
 PhoneGapLib/Classes/Reachability.h |   10 +++++-----
 PhoneGapLib/Classes/Reachability.m |   20 ++++++++++----------
 4 files changed, 22 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/1bf36889/PhoneGapLib/Classes/Connection.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/Connection.h b/PhoneGapLib/Classes/Connection.h
index e451791..30735dc 100644
--- a/PhoneGapLib/Classes/Connection.h
+++ b/PhoneGapLib/Classes/Connection.h
@@ -25,10 +25,10 @@
 @interface PGConnection : PGPlugin {
 	NSString* type;
 	
-	Reachability* internetReach;
+	PGReachability* internetReach;
 }
 
 @property (copy) NSString* connectionType;
-@property (retain) Reachability* internetReach;
+@property (retain) PGReachability* internetReach;
 
 @end

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/1bf36889/PhoneGapLib/Classes/Connection.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/Connection.m b/PhoneGapLib/Classes/Connection.m
index 4f55336..73f59ef 100644
--- a/PhoneGapLib/Classes/Connection.m
+++ b/PhoneGapLib/Classes/Connection.m
@@ -29,7 +29,7 @@
 
 @synthesize connectionType, internetReach;
 
-- (NSString*) w3cConnectionTypeFor:(Reachability*)reachability
+- (NSString*) w3cConnectionTypeFor:(PGReachability*)reachability
 {
 	NetworkStatus networkStatus = [reachability currentReachabilityStatus];
 	switch(networkStatus)
@@ -52,7 +52,7 @@
 			[theConnectionType isEqualToString:@"4g"];
 }
 
-- (void) updateReachability:(Reachability*)reachability
+- (void) updateReachability:(PGReachability*)reachability
 {
 	if (reachability) {
         // check whether the connection type has changed
@@ -75,9 +75,9 @@
 
 - (void) updateConnectionType:(NSNotification*)note
 {
-	Reachability* curReach = [note object];
+	PGReachability* curReach = [note object];
 
-	if (curReach != nil && [curReach isKindOfClass:[Reachability class]])
+	if (curReach != nil && [curReach isKindOfClass:[PGReachability class]])
 	{
 		[self updateReachability:curReach];
 	}
@@ -100,7 +100,7 @@
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateConnectionType:) 
 												 name:kReachabilityChangedNotification object:nil];
 	
-	self.internetReach = [Reachability reachabilityForInternetConnection];
+	self.internetReach = [PGReachability reachabilityForInternetConnection];
 	[self.internetReach startNotifier];
 	self.connectionType = [self w3cConnectionTypeFor:self.internetReach];
 	

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/1bf36889/PhoneGapLib/Classes/Reachability.h
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/Reachability.h b/PhoneGapLib/Classes/Reachability.h
index 9763308..9141297 100644
--- a/PhoneGapLib/Classes/Reachability.h
+++ b/PhoneGapLib/Classes/Reachability.h
@@ -57,24 +57,24 @@ typedef enum {
 } NetworkStatus;
 #define kReachabilityChangedNotification @"kNetworkReachabilityChangedNotification"
 
-@interface Reachability: NSObject
+@interface PGReachability: NSObject
 {
 	BOOL localWiFiRef;
 	SCNetworkReachabilityRef reachabilityRef;
 }
 
 //reachabilityWithHostName- Use to check the reachability of a particular host name. 
-+ (Reachability*) reachabilityWithHostName: (NSString*) hostName;
++ (PGReachability*) reachabilityWithHostName: (NSString*) hostName;
 
 //reachabilityWithAddress- Use to check the reachability of a particular IP address. 
-+ (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
++ (PGReachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
 
 //reachabilityForInternetConnection- checks whether the default route is available.  
 //  Should be used by applications that do not connect to a particular host
-+ (Reachability*) reachabilityForInternetConnection;
++ (PGReachability*) reachabilityForInternetConnection;
 
 //reachabilityForLocalWiFi- checks whether a local wifi connection is available.
-+ (Reachability*) reachabilityForLocalWiFi;
++ (PGReachability*) reachabilityForLocalWiFi;
 
 //Start listening for reachability notifications on the current run loop
 - (BOOL) startNotifier;

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/1bf36889/PhoneGapLib/Classes/Reachability.m
----------------------------------------------------------------------
diff --git a/PhoneGapLib/Classes/Reachability.m b/PhoneGapLib/Classes/Reachability.m
index 2c08242..2d7b530 100644
--- a/PhoneGapLib/Classes/Reachability.m
+++ b/PhoneGapLib/Classes/Reachability.m
@@ -79,7 +79,7 @@ static void PrintReachabilityFlags(SCNetworkReachabilityFlags    flags, const ch
 }
 
 
-@implementation Reachability
+@implementation PGReachability
 
 static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
 {
@@ -93,7 +93,7 @@ static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReach
         return;
     }
     
-    if (![(NSObject*) info isKindOfClass: [Reachability class]]) {
+    if (![(NSObject*) info isKindOfClass: [PGReachability class]]) {
         NSLog(@"info was wrong class in ReachabilityCallback");
         return;
     }
@@ -102,7 +102,7 @@ static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReach
 	// in case someon uses the Reachablity object in a different thread.
 	NSAutoreleasePool* myPool = [[NSAutoreleasePool alloc] init];
 	
-	Reachability* noteObject = (Reachability*) info;
+	PGReachability* noteObject = (PGReachability*) info;
 	// Post a notification to notify the client that the network reachability changed.
 	[[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: noteObject];
 	
@@ -141,9 +141,9 @@ static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReach
 	[super dealloc];
 }
 
-+ (Reachability*) reachabilityWithHostName: (NSString*) hostName;
++ (PGReachability*) reachabilityWithHostName: (NSString*) hostName;
 {
-	Reachability* retVal = NULL;
+	PGReachability* retVal = NULL;
 	SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
 	if(reachability!= NULL)
 	{
@@ -157,10 +157,10 @@ static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReach
 	return retVal;
 }
 
-+ (Reachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
++ (PGReachability*) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
 {
 	SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
-	Reachability* retVal = NULL;
+	PGReachability* retVal = NULL;
 	if(reachability!= NULL)
 	{
 		retVal= [[[self alloc] init] autorelease];
@@ -173,7 +173,7 @@ static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReach
 	return retVal;
 }
 
-+ (Reachability*) reachabilityForInternetConnection;
++ (PGReachability*) reachabilityForInternetConnection;
 {
 	struct sockaddr_in zeroAddress;
 	bzero(&zeroAddress, sizeof(zeroAddress));
@@ -182,7 +182,7 @@ static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReach
 	return [self reachabilityWithAddress: &zeroAddress];
 }
 
-+ (Reachability*) reachabilityForLocalWiFi;
++ (PGReachability*) reachabilityForLocalWiFi;
 {
 	struct sockaddr_in localWifiAddress;
 	bzero(&localWifiAddress, sizeof(localWifiAddress));
@@ -190,7 +190,7 @@ static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReach
 	localWifiAddress.sin_family = AF_INET;
 	// IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
 	localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
-	Reachability* retVal = [self reachabilityWithAddress: &localWifiAddress];
+	PGReachability* retVal = [self reachabilityWithAddress: &localWifiAddress];
 	if(retVal!= NULL)
 	{
 		retVal->localWiFiRef = YES;