Skip to content

Commit b1bc18d

Browse files
committed
x
1 parent fd7b1bb commit b1bc18d

File tree

4 files changed

+47
-46
lines changed

4 files changed

+47
-46
lines changed

QiniuSDK/Http/QNStats.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#if TARGET_OS_IPHONE
2323
@property (nonatomic, readonly) QNReachability *wifiReach;
2424
@property (nonatomic, readonly) CTTelephonyNetworkInfo *telephonyInfo;
25-
@property (atomic, readonly) NetworkStatus reachabilityStatus;
25+
@property (atomic, readonly) QNNetworkStatus reachabilityStatus;
2626
#endif
2727

2828
@property (nonatomic,retain) NSTimer *pushTimer;

QiniuSDK/Http/QNStats.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ - (instancetype) initWithPushInterval: (int) interval
136136
usingBlock:^(NSNotification *note) {
137137
_reachabilityStatus = _wifiReach.currentReachabilityStatus;
138138

139-
if (_reachabilityStatus != NotReachable) {
139+
if (_reachabilityStatus != QNNotReachable) {
140140
[self getOutIp];
141141
}
142142
}];
@@ -203,7 +203,7 @@ - (void) pushStats {
203203
@synchronized(self) {
204204

205205
#if TARGET_OS_IPHONE
206-
if (_reachabilityStatus == NotReachable) {
206+
if (_reachabilityStatus == QNNotReachable) {
207207
return;
208208
}
209209
#endif
@@ -278,9 +278,9 @@ - (NSString *) getSIP {
278278

279279
- (NSString *) getNetType {
280280
#if TARGET_OS_IPHONE
281-
if (_reachabilityStatus == ReachableViaWiFi) {
281+
if (_reachabilityStatus == QNReachableViaWiFi) {
282282
return @"wifi";
283-
} else if (_reachabilityStatus == ReachableViaWWAN) {
283+
} else if (_reachabilityStatus == QNReachableViaWWAN) {
284284
return @"wan";
285285
}
286286
#elif TARGET_OS_MAC

QiniuSDK/QNReachability/QNReachability.h

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
/*
2-
Copyright (c) 2011, Tony Million.
3-
All rights reserved.
4-
5-
Redistribution and use in source and binary forms, with or without
6-
modification, are permitted provided that the following conditions are met:
7-
8-
1. Redistributions of source code must retain the above copyright notice, this
9-
list of conditions and the following disclaimer.
10-
11-
2. Redistributions in binary form must reproduce the above copyright notice,
12-
this list of conditions and the following disclaimer in the documentation
13-
and/or other materials provided with the distribution.
14-
15-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18-
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19-
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21-
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22-
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23-
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24-
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25-
POSSIBILITY OF SUCH DAMAGE.
2+
Copyright (c) 2011, Tony Million.
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
19+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25+
POSSIBILITY OF SUCH DAMAGE.
2626
*/
2727

2828
#import <Foundation/Foundation.h>
2929
#import <SystemConfiguration/SystemConfiguration.h>
3030

3131

32-
/**
32+
/**
3333
* Create NS_ENUM macro if it does not exist on the targeted version of iOS or OS X.
3434
*
3535
* @see http://nshipster.com/ns_enum-ns_options/
@@ -38,15 +38,16 @@
3838
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
3939
#endif
4040

41-
extern NSString *const kQNReachabilityChangedNotification;
4241

43-
typedef NS_ENUM(NSInteger, NetworkStatus) {
44-
// Apple NetworkStatus Compatible Names.
45-
NotReachable = 0,
46-
ReachableViaWiFi = 2,
47-
ReachableViaWWAN = 1
42+
typedef NS_ENUM (NSInteger, QNNetworkStatus) {
43+
// Apple NetworkStatus Compatible Names.
44+
QNNotReachable = 0,
45+
QNReachableViaWiFi = 2,
46+
QNReachableViaWWAN = 1
4847
};
4948

49+
extern NSString *const kQNReachabilityChangedNotification;
50+
5051
@class QNReachability;
5152

5253
typedef void (^NetworkReachable)(QNReachability * reachability);
@@ -55,8 +56,8 @@ typedef void (^NetworkUnreachable)(QNReachability * reachability);
5556

5657
@interface QNReachability : NSObject
5758

58-
@property (nonatomic, copy) NetworkReachable reachableBlock;
59-
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
59+
@property (nonatomic, copy) NetworkReachable reachableBlock;
60+
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
6061

6162
@property (nonatomic, assign) BOOL reachableOnWWAN;
6263

@@ -87,7 +88,7 @@ typedef void (^NetworkUnreachable)(QNReachability * reachability);
8788
// Is user intervention required?
8889
-(BOOL)isInterventionRequired;
8990

90-
-(NetworkStatus)currentReachabilityStatus;
91+
-(QNNetworkStatus)currentReachabilityStatus;
9192
-(SCNetworkReachabilityFlags)reachabilityFlags;
9293
-(NSString*)currentReachabilityString;
9394
-(NSString*)currentReachabilityFlags;

QiniuSDK/QNReachability/QNReachability.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -382,19 +382,19 @@ -(BOOL)isInterventionRequired
382382

383383
#pragma mark - reachability status stuff
384384

385-
-(NetworkStatus)currentReachabilityStatus
385+
-(QNNetworkStatus)currentReachabilityStatus
386386
{
387387
if([self isReachable])
388388
{
389389
if([self isReachableViaWiFi])
390-
return ReachableViaWiFi;
390+
return QNReachableViaWiFi;
391391

392392
#if TARGET_OS_IPHONE
393-
return ReachableViaWWAN;
393+
return QNReachableViaWWAN;
394394
#endif
395395
}
396396

397-
return NotReachable;
397+
return QNNotReachable;
398398
}
399399

400400
-(SCNetworkReachabilityFlags)reachabilityFlags
@@ -411,14 +411,14 @@ -(SCNetworkReachabilityFlags)reachabilityFlags
411411

412412
-(NSString*)currentReachabilityString
413413
{
414-
NetworkStatus temp = [self currentReachabilityStatus];
414+
QNNetworkStatus temp = [self currentReachabilityStatus];
415415

416-
if(temp == ReachableViaWWAN)
416+
if(temp == QNReachableViaWWAN)
417417
{
418418
// Updated for the fact that we have CDMA phones now!
419419
return NSLocalizedString(@"Cellular", @"");
420420
}
421-
if (temp == ReachableViaWiFi)
421+
if (temp == QNReachableViaWiFi)
422422
{
423423
return NSLocalizedString(@"WiFi", @"");
424424
}

0 commit comments

Comments
 (0)