Skip to content

Commit 759499a

Browse files
author
karisli
committed
# 5.5.4
- 支持自定义Request的Region的时候支持校验 - ACL设置增加Default有效值
1 parent d3d7bfa commit 759499a

File tree

94 files changed

+1397
-92
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1397
-92
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 5.5.4
2+
- 支持自定义Request的Region的时候支持校验
3+
- ACL设置增加Default有效值
4+
15
# 5.5.3
26
- 修复分块复制过程中,region不同可能导致的问题。
37
- 获取签名时增加超时机制,如果15秒内未能给出签名,则抛出错误。

QCloudCOSXML.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "QCloudCOSXML"
3-
s.version = "5.5.3"
3+
s.version = "5.5.4"
44
s.summary = "QCloudCOSXML 腾讯云iOS-SDK组件"
55

66
s.homepage = "https://cloud.tencent.com/"
@@ -9,12 +9,12 @@ s.version = "5.5.3"
99
s.source = { :git => "https://github.com/tencentyun/qcloud-sdk-ios.git", :tag => s.version.to_s }
1010
s.ios.deployment_target = '8.0'
1111
s.source_files = 'QCloudCOSXML/Classes/**/*'
12-
s.dependency "QCloudCore",'5.5.3'
12+
s.dependency "QCloudCore",'5.5.4'
1313
s.static_framework = true
1414

1515
s.subspec 'Transfer' do |sbt|
1616
sbt.source_files = 'QCloudCOSXML/Classes/Transfer/**/*','QCloudCOSXML/Classes/Base/*'
17-
sbt.dependency "QCloudCore",'5.5.3'
17+
sbt.dependency "QCloudCore",'5.5.4'
1818
# sbt.static_framework=true
1919
end
2020
end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// QCloudAbstractRequest+Quality.h
3+
// QCloudCOSXML
4+
//
5+
// Created by erichmzhang(张恒铭) on 2018/8/24.
6+
//
7+
8+
#import <QCloudCore/QCloudCore.h>
9+
10+
NS_ASSUME_NONNULL_BEGIN
11+
12+
@interface QCloudAbstractRequest (Quality)
13+
14+
15+
@end
16+
17+
NS_ASSUME_NONNULL_END
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//
2+
// QCloudAbstractRequest+Quality.m
3+
// QCloudCOSXML
4+
//
5+
// Created by erichmzhang(张恒铭) on 2018/8/24.
6+
//
7+
8+
#import "QCloudAbstractRequest+Quality.h"
9+
#import <objc/runtime.h>
10+
#import "QualityDataUploader.h"
11+
@implementation QCloudAbstractRequest (Quality)
12+
+ (void) load{
13+
static dispatch_once_t onceToken;
14+
dispatch_once(&onceToken, ^{
15+
[self exchangeImplementation];
16+
});
17+
}
18+
19+
+ (void)exchangeImplementation {
20+
Class class = [self class];
21+
SEL originalSelector = @selector(__notifySuccess:);
22+
SEL swizzledSelector = @selector(__quality__notifySuccess:);
23+
Method originNotifySuccessMethod = class_getInstanceMethod(class, @selector(__notifySuccess:));
24+
Method swizzedNotifySuccessMethod = class_getInstanceMethod(class, @selector(__quality__notifySuccess:));
25+
26+
method_exchangeImplementations(originNotifySuccessMethod, swizzedNotifySuccessMethod);
27+
28+
29+
Method originNotifyErrorMethod = class_getInstanceMethod(class, @selector(__notifyError:));
30+
Method swizzedNotifyErrorMethod = class_getInstanceMethod(class, @selector(__quality__notifyError:));
31+
method_exchangeImplementations(originNotifyErrorMethod, swizzedNotifyErrorMethod);
32+
33+
34+
35+
}
36+
37+
38+
- (void)__quality__notifySuccess:(id)object {
39+
[self __quality__notifySuccess:(id)object];
40+
[QualityDataUploader trackRequestSuccessWithType:self.class];
41+
}
42+
43+
- (void)__quality__notifyError:(NSError *)error {
44+
[self __quality__notifyError:error];
45+
[QualityDataUploader trackRequestFailWithError:error];
46+
}
47+
48+
49+
@end

QCloudCOSXML/Classes/Base/QCloudCOSXMLEndPoint.m

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ - (NSString *)formattedBucket:(NSString*)bucket withAPPID:(NSString*)APPID {
3636
return bucket;
3737
}
3838

39-
- (NSURL*) serverURLWithBucket:(NSString *)bucket appID:(NSString *)appID
40-
{
39+
-(NSURL *)serverURLWithBucket:(NSString *)bucket appID:(NSString *)appID regionName:(NSString *)regionName{
4140
if (self.serverURLLiteral) {
4241
return self.serverURLLiteral;
4342
}
@@ -55,7 +54,13 @@ - (NSURL*) serverURLWithBucket:(NSString *)bucket appID:(NSString *)appID
5554
}
5655

5756
NSString* formattedBucketName = [self formattedBucket:bucket withAPPID:appID];
58-
NSURL* serverURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@-%@.cos.%@.%@",scheme,formattedBucketName,appID,self.regionName,self.serviceName]];
57+
NSString *regionNametmp = nil;
58+
if (regionName) {
59+
regionNametmp = regionName;
60+
}else{
61+
regionNametmp = self.regionName;
62+
}
63+
NSURL* serverURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@://%@-%@.cos.%@.%@",scheme,formattedBucketName,appID,regionNametmp,self.serviceName]];
5964
return serverURL;
6065
}
6166

@@ -71,7 +76,6 @@ - (void)setRegionName:(QCloudRegion)regionName {
7176
}
7277
_regionName = regionName;
7378
}
74-
7579
- (id)copyWithZone:(NSZone *)zone {
7680
QCloudCOSXMLEndPoint* endpoint = [super copyWithZone:nil];
7781
endpoint.regionName = self.regionName;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// QCloudCOSXML+Quality.h
3+
// QCloudCOSXML
4+
//
5+
// Created by erichmzhang(张恒铭) on 2018/8/23.
6+
//
7+
8+
9+
#import <Foundation/Foundation.h>
10+
#import "QCloudCOSXMLService.h"
11+
@interface QCloudCOSXMLService (Quality)
12+
13+
@end
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//
2+
// QCloudCOSXML+Quality.m
3+
// QCloudCOSXML
4+
//
5+
// Created by erichmzhang(张恒铭) on 2018/8/23.
6+
//
7+
8+
#import "QCloudCOSXMLService+Quality.h"
9+
#import <objc/runtime.h>
10+
#import <QCloudCore/MTA.h>
11+
#import <QCloudCore/MTAConfig.h>
12+
#import <QCloudCore/MTACrashReporter.h>
13+
#import <QCloudCore/QualityAssuranceDefine.h>
14+
#import <QCloudCore/QCloudCore.h>
15+
#import <QCloudCore/QCloudLogger.h>
16+
@implementation QCloudCOSXMLService (Quality)
17+
18+
+ (void)load {
19+
static dispatch_once_t onceToken;
20+
dispatch_once(&onceToken, ^{
21+
[self changeImplementation];
22+
});
23+
24+
}
25+
26+
+ (void) changeImplementation {
27+
Class class = object_getClass((id)self);
28+
Method originMethod = class_getClassMethod(class, @selector(registerDefaultCOSXMLWithConfiguration:));
29+
Method replacedMethod = class_getClassMethod(class, @selector(Quality_registerDefaultCOSXMLWithConfiguration:));
30+
method_exchangeImplementations(originMethod, replacedMethod);
31+
32+
}
33+
34+
+ (QCloudCOSXMLService*) Quality_registerDefaultCOSXMLWithConfiguration:(QCloudServiceConfiguration*)configuration {
35+
id result = [self Quality_registerDefaultCOSXMLWithConfiguration:configuration];
36+
[self initMTA];
37+
return result;
38+
}
39+
40+
41+
+ (void) initMTA {
42+
QCloudLogDebug(@"Quality assurence service start");
43+
TACMTAConfig* config = [TACMTAConfig getInstance];
44+
config.reportStrategy = kQAUploadStrategy;
45+
[TACMTA startWithAppkey:kQAccount];
46+
}
47+
@end

QCloudCOSXML/Classes/Base/QCloudCOSXMLService.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@
6565
@param withAuthorization 是否需要签名,如果是私有读的Bucket,那么该URL需要带上签名才能访问
6666
@return object URL
6767
*/
68-
- (NSString*)getURLWithBucket:(NSString*)bucket object:(NSString*)object withAuthorization:(BOOL)withAuthorization;
68+
- (NSString*)getURLWithBucket:(NSString*)bucket object:(NSString*)object withAuthorization:(BOOL)withAuthorization regionName:(NSString *)regionName;
6969

7070
@end

QCloudCOSXML/Classes/Base/QCloudCOSXMLService.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ + (QCloudCOSXMLService*) registerCOSXMLWithConfiguration:(QCloudServiceConfigura
100100
[QCloudCOSXMLServiceCache() setObject:cosxmlService forKey:key];
101101
return cosxmlService;
102102
}
103-
- (NSString*)getURLWithBucket:(NSString *)bucket object:(NSString *)object withAuthorization:(BOOL)withAuthorization {
103+
- (NSString*)getURLWithBucket:(NSString *)bucket object:(NSString *)object withAuthorization:(BOOL)withAuthorization regionName:(NSString*)regionName {
104104
NSParameterAssert(bucket);
105105
NSParameterAssert(object);
106106
__block NSMutableString* resultURL = [[NSMutableString alloc] init];
107-
NSString* bucketURL = [[self.configuration.endpoint serverURLWithBucket:bucket appID:self.configuration.appID] absoluteString];
107+
NSString* bucketURL = [[self.configuration.endpoint serverURLWithBucket:bucket appID:self.configuration.appID regionName:regionName] absoluteString];
108108
[resultURL appendString:bucketURL];
109109
[resultURL appendFormat:@"/%@",object];
110110
if (withAuthorization) {

QCloudCOSXML/Classes/Base/QCloudCOSXMLServiceUtilities.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
#import <Foundation/Foundation.h>
1010
#import <QCloudCore/QCloudCore.h>
11-
FOUNDATION_EXTERN NSString* QCloudCOSXMLObjectLocation(QCloudEndPoint* endpoint , NSString* appID,NSString* bucket, NSString* object);
11+
FOUNDATION_EXTERN NSString* QCloudCOSXMLObjectLocation(QCloudEndPoint* endpoint , NSString* appID,NSString* bucket, NSString* object,NSString *regionName);

0 commit comments

Comments
 (0)