Skip to content

Commit c42fdd9

Browse files
authored
Merge pull request #263 from longbai/pandora
release new version
2 parents 61aae6c + 1298bce commit c42fdd9

14 files changed

+126
-144
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ DerivedData
1919
*.hmap
2020
*.ipa
2121
*.xcuserstate
22-
22+
*.xccoverage.plist
2323

2424
# Subversion
2525
.svn

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ before_script:
1616
- export QINIU_TEST_ENV="travis"
1717

1818
script:
19-
- xcodebuild test -workspace QiniuSDK.xcworkspace -scheme QiniuSDK_iOS -configuration Release -destination 'platform=iOS Simulator,OS=11.0,name=iPhone SE'
19+
- xcodebuild test -workspace QiniuSDK.xcworkspace -scheme QiniuSDK_iOS -configuration Release -destination 'platform=iOS Simulator,OS=11.0,name=iPhone SE' -enableCodeCoverage YES
2020
- xcodebuild test -workspace QiniuSDK.xcworkspace -scheme QiniuSDK_Mac -configuration Release -destination 'platform=macOS,arch=x86_64'
2121

2222
after_success:

Qiniu.podspec

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'Qiniu'
3-
s.version = '7.1.8'
3+
s.version = '7.2.0'
44
s.summary = 'Qiniu Resource Storage SDK for iOS and Mac'
55
s.homepage = 'https://github.com/qiniu/objc-sdk'
66
s.social_media_url = 'http://weibo.com/qiniutek'
@@ -13,12 +13,11 @@ Pod::Spec.new do |s|
1313
s.source_files = "QiniuSDK/**/*.{h,m}"
1414
s.requires_arc = true
1515
s.libraries = 'z'
16-
s.dependency 'AFNetworking', '~> 3'
1716
s.dependency 'HappyDNS', '~> 0.3'
1817
s.license = { :type => "MIT", :text => <<-LICENSE
1918
The MIT License (MIT)
2019
21-
Copyright (c) 2011-2016 qiniu.com
20+
Copyright (c) 2011-2017 qiniu.com
2221
2322
Permission is hereby granted, free of charge, to any person obtaining a copy
2423
of this software and associated documentation files (the "Software"), to deal

QiniuSDK/Http/QNSessionManager.m

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// Copyright (c) 2014年 Qiniu. All rights reserved.
77
//
88

9-
109
#import "HappyDNS.h"
1110
#import "QNAsyncRun.h"
1211
#import "QNConfiguration.h"
@@ -51,24 +50,23 @@ - (instancetype)initWithProgress:(QNInternalProgressBlock)progressBlock {
5150
}
5251

5352
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task
54-
didSendBodyData:(int64_t)bytesSent
55-
totalBytesSent:(int64_t)totalBytesSent
56-
totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend {
57-
53+
didSendBodyData:(int64_t)bytesSent
54+
totalBytesSent:(int64_t)totalBytesSent
55+
totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend {
56+
5857
_progressBlock(totalBytesSent, totalBytesExpectedToSend);
5958
if (_cancelBlock && _cancelBlock()) {
6059
[_task cancel];
6160
}
62-
61+
6362
float progress = (float)totalBytesSent / totalBytesExpectedToSend;
64-
if (progress==1.0f) {
65-
self.task =nil;
63+
if (progress == 1.0f) {
64+
self.task = nil;
6665
self.cancelBlock = nil;
6766
self.progressBlock = nil;
6867
}
6968
}
7069

71-
7270
@end
7371

7472
@interface QNSessionManager ()
@@ -109,7 +107,6 @@ - (void)dealloc {
109107
}
110108
}
111109

112-
113110
- (instancetype)init {
114111
return [self initWithProxy:nil timeout:60 urlConverter:nil dns:nil];
115112
}
@@ -206,10 +203,10 @@ - (void)sendRequest2:(NSMutableURLRequest *)request
206203
QNInternalProgressBlock progressBlock2 = ^(long long totalBytesWritten, long long totalBytesExpectedToWrite) {
207204
progressBlock(totalBytesWritten, totalBytesExpectedToWrite);
208205
};
209-
QNProgessDelegate *delegate =(QNProgessDelegate *)_httpManager.delegate;
206+
QNProgessDelegate *delegate = (QNProgessDelegate *)_httpManager.delegate;
210207
delegate.progressBlock = progressBlock2;
211-
NSURLSessionUploadTask *uploadTask = [_httpManager uploadTaskWithRequest:request fromData:nil completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
212-
208+
NSURLSessionUploadTask *uploadTask = [_httpManager uploadTaskWithRequest:request fromData:nil completionHandler:^(NSData *_Nullable data, NSURLResponse *_Nullable response, NSError *_Nullable error) {
209+
213210
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
214211
double duration = [[NSDate date] timeIntervalSinceDate:startTime];
215212
QNResponseInfo *info;
@@ -234,7 +231,6 @@ - (void)sendRequest2:(NSMutableURLRequest *)request
234231
[uploadTask resume];
235232
}
236233

237-
238234
- (void)multipartPost:(NSString *)url
239235
withData:(NSData *)data
240236
withParams:(NSDictionary *)params
@@ -244,35 +240,35 @@ - (void)multipartPost:(NSString *)url
244240
withProgressBlock:(QNInternalProgressBlock)progressBlock
245241
withCancelBlock:(QNCancelBlock)cancelBlock
246242
withAccess:(NSString *)access {
247-
NSURL *URL = [[NSURL alloc]initWithString:url];
248-
NSMutableURLRequest *request = [[NSMutableURLRequest alloc]initWithURL:URL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30];
243+
NSURL *URL = [[NSURL alloc] initWithString:url];
244+
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:URL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:30];
249245
request.HTTPMethod = @"POST";
250246
NSString *boundary = @"werghnvt54wef654rjuhgb56trtg34tweuyrgf";
251247
request.allHTTPHeaderFields = @{
252-
@"Content-Type":[NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary]
253-
};
254-
NSMutableData *postData = [[NSMutableData alloc]init];
248+
@"Content-Type" : [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary]
249+
};
250+
NSMutableData *postData = [[NSMutableData alloc] init];
255251
for (NSString *paramsKey in params) {
256-
NSString *pair = [NSString stringWithFormat:@"--%@\r\nContent-Disposition: form-data; name=\"%@\"\r\n\r\n",boundary,paramsKey];
252+
NSString *pair = [NSString stringWithFormat:@"--%@\r\nContent-Disposition: form-data; name=\"%@\"\r\n\r\n", boundary, paramsKey];
257253
[postData appendData:[pair dataUsingEncoding:NSUTF8StringEncoding]];
258-
254+
259255
id value = [params objectForKey:paramsKey];
260256
if ([value isKindOfClass:[NSString class]]) {
261257
[postData appendData:[value dataUsingEncoding:NSUTF8StringEncoding]];
262-
}else if ([value isKindOfClass:[NSData class]]){
258+
} else if ([value isKindOfClass:[NSData class]]) {
263259
[postData appendData:value];
264260
}
265261
[postData appendData:[@"\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
266262
}
267-
NSString *filePair = [NSString stringWithFormat:@"--%@\r\nContent-Disposition: form-data; name=\"%@\"; filename=\"%@\"\nContent-Type:%@\r\n\r\n",boundary,@"file",key,mime];
263+
NSString *filePair = [NSString stringWithFormat:@"--%@\r\nContent-Disposition: form-data; name=\"%@\"; filename=\"%@\"\nContent-Type:%@\r\n\r\n", boundary, @"file", key, mime];
268264
[postData appendData:[filePair dataUsingEncoding:NSUTF8StringEncoding]];
269265
[postData appendData:data];
270-
[postData appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];
266+
[postData appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
271267
request.HTTPBody = postData;
272-
[request setValue:[NSString stringWithFormat:@"%lu",(unsigned long)postData.length] forHTTPHeaderField:@"Content-Length"];
273-
268+
[request setValue:[NSString stringWithFormat:@"%lu", (unsigned long)postData.length] forHTTPHeaderField:@"Content-Length"];
269+
274270
[self sendRequest:request withCompleteBlock:completeBlock withProgressBlock:progressBlock withCancelBlock:cancelBlock
275-
withAccess:access];
271+
withAccess:access];
276272
}
277273

278274
- (void)post:(NSString *)url
@@ -307,8 +303,8 @@ - (void)get:(NSString *)url
307303
QNAsyncRun(^{
308304
NSURL *URL = [NSURL URLWithString:url];
309305
NSURLRequest *request = [NSURLRequest requestWithURL:URL];
310-
311-
NSURLSessionDataTask *dataTask = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
306+
307+
NSURLSessionDataTask *dataTask = [[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData *_Nullable data, NSURLResponse *_Nullable response, NSError *_Nullable error) {
312308
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response;
313309
NSData *s = [@"{}" dataUsingEncoding:NSUTF8StringEncoding];
314310
NSDictionary *resp = nil;
@@ -327,12 +323,11 @@ - (void)get:(NSString *)url
327323
} else {
328324
info = [QNSessionManager buildResponseInfo:httpResponse withError:error withDuration:0 withResponse:s withHost:@"" withIp:@""];
329325
}
330-
326+
331327
completeBlock(info, resp);
332328
}];
333329
[dataTask resume];
334-
335-
330+
336331
});
337332
}
338333

QiniuSDK/Recorder/QNFileRecorder.m

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ + (void)removeKey:(NSString *)key
9191
NSString *path = [QNFileRecorder pathJoin:key path:dir];
9292
[[NSFileManager defaultManager] removeItemAtPath:path error:&error];
9393
if (error) {
94-
NSLog(@"%s,%@",__func__,error);
94+
NSLog(@"%s,%@", __func__, error);
9595
}
9696
}
9797

QiniuSDK/Storage/QNConfiguration.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ typedef void (^QNPrequeryReturn)(int code);
8989

9090
@interface QNZone : NSObject
9191

92-
@property (nonatomic, strong) NSArray <NSString *> * upDomainList;
93-
@property (nonatomic, strong) QNZoneInfo * zoneInfo;
92+
@property (nonatomic, strong) NSArray<NSString *> *upDomainList;
93+
@property (nonatomic, strong) QNZoneInfo *zoneInfo;
9494

9595
/**
9696
* 默认上传服务器地址列表
@@ -107,11 +107,11 @@ typedef void (^QNPrequeryReturn)(int code);
107107
@interface QNZoneInfo : NSObject
108108

109109
@property (readonly, nonatomic) long ttl;
110-
@property (readonly, nonatomic) NSMutableArray <NSString *> * upDomainsList;
111-
@property (readonly, nonatomic) NSMutableDictionary * upDomainsDic;
110+
@property (readonly, nonatomic) NSMutableArray<NSString *> *upDomainsList;
111+
@property (readonly, nonatomic) NSMutableDictionary *upDomainsDic;
112112

113113
- (instancetype)init:(long)ttl
114-
upDomainsList:(NSMutableArray <NSString *> *)upDomainsList
114+
upDomainsList:(NSMutableArray<NSString *> *)upDomainsList
115115
upDomainsDic:(NSMutableDictionary *)upDomainsDic;
116116
- (QNZoneInfo *)buildInfoFromJson:(NSDictionary *)resp;
117117

@@ -154,7 +154,7 @@ typedef void (^QNPrequeryReturn)(int code);
154154
*
155155
* @return Zone实例
156156
*/
157-
- (instancetype)initWithupDomainList:(NSArray <NSString *> *)upList;
157+
- (instancetype)initWithupDomainList:(NSArray<NSString *> *)upList;
158158

159159
/**
160160
* Zone初始化方法
@@ -163,7 +163,7 @@ typedef void (^QNPrequeryReturn)(int code);
163163
*
164164
* @return Zone实例
165165
*/
166-
+ (instancetype)createWithHost:(NSArray <NSString *> *)upList;
166+
+ (instancetype)createWithHost:(NSArray<NSString *> *)upList;
167167

168168
- (void)preQuery:(QNUpToken *)token
169169
on:(QNPrequeryReturn)ret;

0 commit comments

Comments
 (0)