Skip to content

Commit 8fc3371

Browse files
committed
格式格式化
1 parent 3cd704b commit 8fc3371

File tree

6 files changed

+39
-41
lines changed

6 files changed

+39
-41
lines changed

QiniuDemo/QiniuDemo/ViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ - (void)uploadImageToQNFilePath:(NSString *)filePath {
5555
[upManager putFile:filePath key:nil token:self.token complete:^(QNResponseInfo *info, NSString *key, NSDictionary *resp) {
5656
NSLog(@"info ===== %@", info);
5757
NSLog(@"resp ===== %@", resp);
58-
} option:uploadOption];
58+
}
59+
option:uploadOption];
5960
}
6061

6162
- (void)gotoImageLibrary {

QiniuSDK/Common/QNSystem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ BOOL hasAts();
1616
BOOL allowsArbitraryLoads();
1717

1818
//iOS8判断
19-
BOOL isNotIOS8();
19+
BOOL isIOS8();
2020

2121
#endif /* QNSystem_h */

QiniuSDK/Common/QNSystem.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ BOOL allowsArbitraryLoads() {
6868
return ats.boolValue;
6969
}
7070

71-
BOOL isNotIOS8(){
71+
BOOL isIOS8() {
7272
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED)
7373
float sysVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
7474
if ((sysVersion >= 8.0) && sysVersion < 9.0) {
75-
return NO;
75+
return YES;
7676
}
7777
#endif
78-
return YES;
78+
return NO;
7979
}

QiniuSDK/Storage/QNConfiguration.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,11 @@ - (instancetype)init {
100100
_proxy = nil;
101101
_converter = nil;
102102

103-
if (hasAts() && !allowsArbitraryLoads()&& !isNotIOS8()) {
103+
if (hasAts() && !allowsArbitraryLoads() && isIOS8()) {
104104
_disableATS = NO;
105105
} else {
106106
_disableATS = YES;
107107
}
108-
109-
110108
}
111109
return self;
112110
}

QiniuSDKTests/QNFormUploadTest.m

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#import "QiniuSDK.h"
1414

1515
#import "HappyDns.h"
16-
#import "QNTestConfig.h"
1716
#import "QNSystem.h"
17+
#import "QNTestConfig.h"
1818

1919
@interface QNFormUploadTest : XCTestCase
2020

@@ -274,7 +274,7 @@ - (void)testDnsHosts {
274274
QNResolver *resolver = [[QNResolver alloc] initWithAddres:@"114.114.115.115"];
275275
QNDnsManager *dns = [[QNDnsManager alloc] init:[NSArray arrayWithObject:resolver] networkInfo:[QNNetworkInfo normal]];
276276
QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
277-
if (isNotIOS8()) {
277+
if (isIOS8()) {
278278
isNotiOS8 = YES;
279279
NSArray *ips = [QNZone zone0].up.ips;
280280
QNServiceAddress *s1 = [[QNServiceAddress alloc] init:@"http://uphosttest.qiniu.com" ips:ips];
@@ -302,8 +302,7 @@ - (void)testDnsHosts {
302302
XCTAssert(testInfo.reqId, @"Pass");
303303
if (isNotiOS8) {
304304
XCTAssert([testInfo.host isEqual:@"uphosttest.qiniu.com"], @"Pass");
305-
}else
306-
{
305+
} else {
307306
XCTAssert([testInfo.host isEqual:@"upload.qiniu.com"], @"Pass");
308307
}
309308
XCTAssert([@"FgoKnypncpQlV6tTVddq9EL49l4B" isEqualToString:testResp[@"key"]], @"Pass");

QiniuSDKTests/QNResumeUploadTest.m

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,24 @@ - (void)testCancel {
4848
QNUploadOption *opt = [[QNUploadOption alloc] initWithMime:nil progressHandler:^(NSString *key, float percent) {
4949
flag = YES;
5050
}
51-
params:@{ @"x:七牛" : @"objc",
52-
@"x:no" : @"",
53-
@"invalid" : @"invalid" }
54-
checkCrc:NO
55-
cancellationSignal:^BOOL() {
56-
return flag;
57-
}];
51+
params:@{ @"x:七牛" : @"objc",
52+
@"x:no" : @"",
53+
@"invalid" : @"invalid" }
54+
checkCrc:NO
55+
cancellationSignal:^BOOL() {
56+
return flag;
57+
}];
5858
[_upManager putFile:tempFile.path key:keyUp token:g_token complete:^(QNResponseInfo *i, NSString *k, NSDictionary *resp) {
5959
key = k;
6060
info = i;
6161
}
6262
option:opt];
63-
63+
6464
AGWW_WAIT_WHILE(key == nil, 60 * 30);
6565
NSLog(@"info %@", info);
6666
XCTAssert(info.isCancelled, @"Pass");
6767
XCTAssert([keyUp isEqualToString:key], @"Pass");
68-
68+
6969
[QNTempFile removeTempfile:tempFile];
7070
}
7171

@@ -87,7 +87,7 @@ - (void) template:(int)size {
8787
XCTAssert(info.isOK, @"Pass");
8888
XCTAssert(info.reqId, @"Pass");
8989
XCTAssert([keyUp isEqualToString:key], @"Pass");
90-
90+
9191
[QNTempFile removeTempfile:tempFile];
9292
}
9393

@@ -99,13 +99,13 @@ - (void)templateHttps:(int)size {
9999
QNUploadOption *opt = [[QNUploadOption alloc] initWithProgressHandler:^(NSString *key, float percent) {
100100
NSLog(@"progress %f", percent);
101101
}];
102-
102+
103103
QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
104104
QNServiceAddress *s = [[QNServiceAddress alloc] init:@"https://uptemp.qbox.me" ips:nil];
105105
builder.zone = [[QNZone alloc] initWithUp:s upBackup:nil];
106106
}];
107107
QNUploadManager *upManager = [[QNUploadManager alloc] initWithConfiguration:config];
108-
108+
109109
[upManager putFile:tempFile.path key:keyUp token:g_token complete:^(QNResponseInfo *i, NSString *k, NSDictionary *resp) {
110110
key = k;
111111
info = i;
@@ -116,7 +116,7 @@ - (void)templateHttps:(int)size {
116116
XCTAssert(info.isOK, @"Pass");
117117
XCTAssert(info.reqId, @"Pass");
118118
XCTAssert([keyUp isEqualToString:key], @"Pass");
119-
119+
120120
[QNTempFile removeTempfile:tempFile];
121121
}
122122

@@ -157,7 +157,7 @@ - (void)test0k {
157157
NSLog(@"info %@", info);
158158
XCTAssert(info.statusCode == kQNZeroDataSize, @"Pass");
159159
XCTAssert([keyUp isEqualToString:key], @"Pass");
160-
160+
161161
[QNTempFile removeTempfile:tempFile];
162162
}
163163

@@ -202,19 +202,19 @@ - (void)test8M {
202202

203203
- (void)testProxy {
204204
NSDictionary *proxyDict = @{
205-
@"HTTPEnable" : [NSNumber numberWithInt:1],
206-
(NSString *)kCFStreamPropertyHTTPProxyHost : @"183.136.139.16",
207-
(NSString *)kCFStreamPropertyHTTPProxyPort : @8888,
208-
};
209-
205+
@"HTTPEnable" : [NSNumber numberWithInt:1],
206+
(NSString *)kCFStreamPropertyHTTPProxyHost : @"183.136.139.16",
207+
(NSString *)kCFStreamPropertyHTTPProxyPort : @8888,
208+
};
209+
210210
QNConfiguration *config = [QNConfiguration build:^(QNConfigurationBuilder *builder) {
211211
builder.proxy = proxyDict;
212212
QNServiceAddress *s = [[QNServiceAddress alloc] init:@"http://upnono.qiniu.com" ips:nil];
213213
builder.zone = [[QNZone alloc] initWithUp:s upBackup:nil];
214214
}];
215-
215+
216216
QNUploadManager *upManager = [[QNUploadManager alloc] initWithConfiguration:config];
217-
217+
218218
int size = 600;
219219
NSURL *tempFile = [QNTempFile createTempfileWithSize:size * 1024];
220220
NSString *keyUp = [NSString stringWithFormat:@"%dkproxy", size];
@@ -225,12 +225,12 @@ - (void)testProxy {
225225
info = i;
226226
}
227227
option:nil];
228-
228+
229229
AGWW_WAIT_WHILE(key == nil, 60 * 30);
230230
NSLog(@"info %@", info);
231231
XCTAssert(info.isOK, @"Pass");
232232
XCTAssert([keyUp isEqualToString:key], @"Pass");
233-
233+
234234
[QNTempFile removeTempfile:tempFile];
235235
}
236236

@@ -242,9 +242,9 @@ - (void)testUrlConvert {
242242
QNServiceAddress *s = [[QNServiceAddress alloc] init:@"http://upnono.qiniu.com" ips:nil];
243243
builder.zone = [[QNZone alloc] initWithUp:s upBackup:nil];
244244
}];
245-
245+
246246
QNUploadManager *upManager = [[QNUploadManager alloc] initWithConfiguration:config];
247-
247+
248248
int size = 600;
249249
NSURL *tempFile = [QNTempFile createTempfileWithSize:size * 1024];
250250
NSString *keyUp = [NSString stringWithFormat:@"%dkconvert", size];
@@ -255,7 +255,7 @@ - (void)testUrlConvert {
255255
info = i;
256256
}
257257
option:nil];
258-
258+
259259
AGWW_WAIT_WHILE(key == nil, 60 * 30);
260260
NSLog(@"info %@", info);
261261
XCTAssert(info.isOK, @"Pass");
@@ -274,9 +274,9 @@ - (void)testHosts {
274274
builder.zone = [[QNZone alloc] initWithUp:s1 upBackup:s2];
275275
builder.dns = dns;
276276
}];
277-
277+
278278
QNUploadManager *upManager = [[QNUploadManager alloc] initWithConfiguration:config];
279-
279+
280280
int size = 600;
281281
NSURL *tempFile = [QNTempFile createTempfileWithSize:size * 1024];
282282
NSString *keyUp = [NSString stringWithFormat:@"%dkconvert", size];
@@ -287,7 +287,7 @@ - (void)testHosts {
287287
info = i;
288288
}
289289
option:nil];
290-
290+
291291
AGWW_WAIT_WHILE(key == nil, 60 * 30);
292292
NSLog(@"info %@", info);
293293
XCTAssert(info.isOK, @"Pass");

0 commit comments

Comments
 (0)