Skip to content

Commit 671bfd4

Browse files
author
karisli
committed
# 5.7.5
- 5.7.5:增加crc检验\- 新增background优先级\- 修复iOS14频繁弹出剪贴板的问题\- 支持上传时添加盲水印\- 修复list多版本文件bug\- 增加截屏接口
1 parent abf7448 commit 671bfd4

File tree

240 files changed

+6638
-1820
lines changed

Some content is hidden

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

240 files changed

+6638
-1820
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# 5.7.5
2+
- 增加crc检验
3+
- 新增background优先级
4+
- 修复iOS14频繁弹出剪贴板的问题
5+
- 支持上传时添加盲水印
6+
- 修复list多版本文件bug
7+
- 增加截屏接口
8+
19
# 5.7.4
210
一些修复
311

QCloudCOSXML.podspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Pod::Spec.new do |s|
22
s.name = "QCloudCOSXML"
33

4-
s.version = "5.7.4"
4+
s.version = "5.7.5"
55

66
s.summary = "QCloudCOSXML 腾讯云iOS-SDK组件"
77

@@ -17,15 +17,15 @@ s.version = "5.7.4"
1717
s.default_subspec = 'Default'
1818
s.subspec 'Default' do |default|
1919
default.source_files = 'QCloudCOSXML/Classes/**/*','Models/request.model','QCloudCOSXML/Classes/QCloudCOSXML/*'
20-
default.dependency "QCloudCore",'5.7.4'
20+
default.dependency "QCloudCore",'5.7.5'
2121
end
2222
s.subspec 'Slim' do |slim|
2323
slim.source_files = 'QCloudCOSXML/Classes/**/*','Models/request.model','QCloudCOSXML/Classes/QCloudCOSXML/*'
24-
slim.dependency "QCloudCore/WithoutMTA",'5.7.4'
24+
slim.dependency "QCloudCore/WithoutMTA",'5.7.5'
2525
end
2626
s.subspec 'Transfer' do |transfer|
2727
transfer.source_files = 'QCloudCOSXML/Classes/*','QCloudCOSXML/Classes/Transfer/**/*','QCloudCOSXML/Classes/Base/*'
28-
transfer.dependency "QCloudCore/WithoutMTA",'5.7.4'
28+
transfer.dependency "QCloudCore/WithoutMTA",'5.7.5'
2929
end
3030

3131
end

QCloudCOSXML/Classes/Base/QCloudCOSXMLEndPoint.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@
1010
#pragma clang diagnostic push
1111
#pragma clang diagnostic ignored "-Wobjc-property-synthesis"
1212

13+
/**
14+
QCloudServiceConfiguration 类的 endpoint 参数
15+
*/
16+
1317
@interface QCloudCOSXMLEndPoint : QCloudEndPoint
1418
/**
15-
服务地域名称,可用的服务地域名称请查看官网https://www.qcloud.com/document/product/436/6224中提供的地域,这里填入官网里提供的地域简称,例如ap-beijing-1等。
19+
* 服务地域名称,可用的服务地域名称请查看官网https://www.qcloud.com/document/product/436/6224
20+
* 中提供的地域,这里填入官网里提供的地域简称,例如ap-beijing等。
1621
*/
1722
@property (nonatomic, copy) QCloudRegion regionName;
1823
@property (nonatomic,assign)BOOL isPrefixURL;
@@ -23,7 +28,9 @@
2328

2429
/**
2530
自定义域名:http://bucketname.suffix
26-
*/
31+
未指定该参数,该存储桶host为 http://bucketname.****
32+
指定该参数为testsuffix,该存储桶host为 http://bucketname.testsuffix.****
33+
*/
2734
@property (nonatomic, copy) NSString *suffix;
2835
@end
2936

QCloudCOSXML/Classes/Base/QCloudCOSXMLService.h

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,39 @@
3131
#import <QCloudCore/QCloudCore.h>
3232

3333
NS_ASSUME_NONNULL_BEGIN
34+
35+
/**
36+
QCloudCOSXMLService 是对所有接口请求发起的封装;通过QCloudCOSXMLService实例来发起网络请求
37+
38+
详情请查看:https://cloud.tencent.com/document/product/436/11280
39+
40+
41+
配置QCloudCOSXMLService
42+
1:实例化 QCloudServiceConfiguration 对象:
43+
44+
QCloudServiceConfiguration* configuration = [QCloudServiceConfiguration new];
45+
configuration.appID = @"APPID" //腾讯云账号的 APPID;
46+
47+
2:实例化 QCloudCOSXMLService 对象:
48+
49+
+ (QCloudCOSXMLService*) registerDefaultCOSXMLWithConfiguration
50+
:(QCloudServiceConfiguration*)configuration;
51+
52+
3:实例化 QCloudCOSTransferManagerService 对象:
53+
54+
+ (QCloudCOSTransferMangerService*) registerDefaultCOSTransferMangerWithConfiguration
55+
:(QCloudServiceConfiguration*)configuration;
56+
57+
使用步骤:
58+
59+
1:实例并初始化好要使用的request;
60+
61+
2:使用[QCloudCOSXMLService defaultCOSXML] 获取到 QCloudCOSXMLService实例;
62+
63+
3:调用对应发起请求的方法:如get****,post****,put****,delete****,
64+
65+
*/
66+
3467
@interface QCloudCOSXMLService : QCloudService
3568
#pragma hidden super selectors
3669
- (int) performRequest:(QCloudBizHTTPRequest *)httpRequst NS_UNAVAILABLE;
@@ -67,10 +100,12 @@ NS_ASSUME_NONNULL_BEGIN
67100
+ (void) removeCOSXMLWithKey:(NSString*)key;
68101

69102
/**
70-
根据Bukcet, Object来生成可以直接访问的URL。如果您的Bucket是私有读的话,那么访问的时候需要带上签名,反之则不需要。
103+
根据Bukcet, Object来生成可以直接访问的URL。如果您的Bucket是私有读的话,那么访问的时候需要带上签名,
104+
反之则不需要。
71105
72106
73-
需要注意的是,如果通过该接口来生成带签名的URL的话,因为签名可能是在服务器生成的,该方法是同步方法,可能因为网络请求阻塞,建议不要在主线程里调用。
107+
需要注意的是,如果通过该接口来生成带签名的URL的话,因为签名可能是在服务器生成的,该方法是同步方法,
108+
可能因为网络请求阻塞,建议不要在主线程里调用。
74109
75110
此外, 传入的Object需要是URLEncode后的结果。
76111

QCloudCOSXML/Classes/Base/QCloudLogManager.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,27 @@
99

1010
NS_ASSUME_NONNULL_BEGIN
1111

12+
/**
13+
QCloudCOSXML 日志管理类
14+
*/
1215
@interface QCloudLogManager : NSObject
16+
/**
17+
是否显示日志信息
18+
*/
19+
@property (nonatomic,assign)BOOL shouldShowLog;
1320
+ (instancetype) sharedInstance;
1421

22+
/**
23+
已经产生的日志
24+
*/
1525
- (NSArray *)currentLogs;
26+
27+
/**
28+
根据日志路径读取日志
29+
@params path 日志路径
30+
*/
1631
- (NSString *) readLog:(NSString *)path;
32+
- (BOOL)shouldShowLog;
1733
@end
1834

1935
NS_ASSUME_NONNULL_END

QCloudCOSXML/Classes/Base/QCloudLogManager.m

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -125,38 +125,36 @@ + (instancetype) sharedInstance {
125125
- (instancetype) init {
126126
self = [super init];
127127

128-
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onHandleAppBecomeActive:) name:UIApplicationDidBecomeActiveNotification object:nil];
128+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onHandleDidFinishLaunching:) name:UIApplicationDidFinishLaunchingNotification object:nil];
129129
return self;
130130
}
131131

132132
- (void)dealloc {
133133
[[NSNotificationCenter defaultCenter] removeObserver:self];
134134
}
135-
- (void) onHandleAppBecomeActive :(NSNotification *)notification {
136-
135+
- (void) onHandleDidFinishLaunching :(NSNotification *)notification {
136+
if (!self.shouldShowLog) {
137+
return;
138+
}
139+
// 如果剪贴板没有数据则不进行读取,减少ios14 剪贴板弹框次数
140+
if (@available(iOS 10.0, *)) {
141+
if (![[UIPasteboard generalPasteboard] hasStrings]) {
142+
return;
143+
}
144+
}
137145
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
138-
//
139146
NSString *currentPasteBoardContent = [UIPasteboard generalPasteboard].string;
140147
if ([currentPasteBoardContent isEqualToString:@"##qcloud-cos-log-ispct##"]) {
141148
[UIPasteboard generalPasteboard].string = @"";
142149
dispatch_async(dispatch_get_main_queue(), ^{
143150
[self showLogs];
144151
});
145-
152+
146153
}
147154
});
148155
}
149156

150157

151-
- (BOOL) shouldShowLogs {
152-
NSString *currentPasteBoardContent = [UIPasteboard generalPasteboard].string;
153-
if ([currentPasteBoardContent isEqualToString:@"##qcloud-cos-log-ispct##"]) {
154-
return YES;
155-
}
156-
return NO;
157-
}
158-
159-
160158
- (NSArray *)currentLogs {
161159
NSString *directoryPath = [QCloudLogger sharedLogger].logDirctoryPath;
162160
NSArray *content = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:directoryPath error:nil];
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
//
2+
// QCloudPutObjectWatermarkInfo.h
3+
// Pods-QCloudCOSXMLDemo
4+
//
5+
// Created by garenwang on 2020/6/4.
6+
//
7+
8+
#import <Foundation/Foundation.h>
9+
@class QCloudPicOperationRule;
10+
11+
NS_ASSUME_NONNULL_BEGIN
12+
13+
typedef NS_ENUM(NSUInteger, QCloudPicOperationRuleEnum) {
14+
QCloudPicOperationRuleHalf = 1, /// 抗攻击性强,但提取水印需原图 使用场景:小图(640x640以下)使用
15+
QCloudPicOperationRuleFull, /// 提取方便,提取水印仅需水印图,无需对比原图 使用场景:批量添加,批量校验
16+
QCloudPicOperationRuleText, /// 可直接将文字信息添加至图片中 使用场景:终端信息添加
17+
};
18+
19+
/**
20+
图片添加盲水印接口 参数类
21+
包含水印规则,水印类型,水印参数
22+
*/
23+
@interface QCloudPicOperations : NSObject
24+
25+
26+
/// 是否返回原图信息。0表示不返回原图信息,1表示返回原图信息,默认为0
27+
@property (nonatomic,assign)BOOL is_pic_info;
28+
29+
30+
/// 处理规则,一条规则对应一个处理结果(目前最多支持五条规则),不填则不进行图片处理
31+
@property (nonatomic,copy)NSArray <QCloudPicOperationRule *> * rule;
32+
33+
-(NSString *)getPicOperationsJson;
34+
35+
@end
36+
37+
/**
38+
给图片添加水印规则
39+
*/
40+
@interface QCloudPicOperationRule : NSObject
41+
42+
/// 处理结果的文件路径名称,如以/开头,则存入指定文件夹中,否则,存入原图文件存储的同目录
43+
@property (nonatomic,copy)NSString * fileid;
44+
45+
/// 处理参数,参见数据万象图片处理 API。 若按指定样式处理,则以style/开头,后加样式名,如样式名为“test”,
46+
/// 则 rule 字段为style/test
47+
@property (nonatomic,copy)NSString * rule;
48+
49+
/// 盲水印类型,有效值:1 半盲;2 全盲;3 文字
50+
@property (nonatomic,assign)QCloudPicOperationRuleEnum type;
51+
52+
/**
53+
盲水印图片地址,需要经过 URL 安全的 Base64 编码。 当 type 为1或2时必填,type 为3时无效。
54+
指定的水印图片必须同时满足如下 3 个条件:
55+
1. 盲水印图片与原图片必须位于同一个对象存储桶下;
56+
2. URL 需使用数据万象源站域名(不能使用 CDN 加速、COS 源站域名),例如
57+
examplebucket-1250000000.image.myqcloud.com属于 CDN 加速域名,不能在水印 URL 中使用;
58+
3. URL 必须以http://开始,不能省略http头,
59+
也不能填https头,例如examplebucket-1250000000.picsh.myqcloud.com/shuiyin_2.png,
60+
https://examplebucket-1250000000.picsh.myqcloud.com/shuiyin_2.png
61+
就是非法的水印 URL。
62+
*/
63+
@property (nonatomic,copy)NSString * imageURL;
64+
65+
/**
66+
盲水印文字,需要经过 URL 安全的 Base64 编码。当 type 为3时必填,type 为1或2时无效。
67+
*/
68+
@property (nonatomic,copy)NSString * text;
69+
70+
/// 只对全盲水印(type=2)有效。level 的取值范围为{1,2,3},默认值为1,level
71+
/// 值越大则图片受影响程度越大、盲水印效果越好。
72+
@property (nonatomic,assign)NSInteger level;
73+
74+
@end
75+
76+
NS_ASSUME_NONNULL_END
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
//
2+
// QCloudPutObjectWatermarkInfo.m
3+
// Pods-QCloudCOSXMLDemo
4+
//
5+
// Created by garenwang on 2020/6/4.
6+
//
7+
8+
#import "QCloudPicOperations.h"
9+
#import <QCloudCore/QCloudLogger.h>
10+
#import <QCloudCore/QCloudCore.h>
11+
#import "NSString+RegularExpressionCategory.h"
12+
13+
@implementation QCloudPicOperations
14+
15+
-(NSString *)getPicOperationsJson{
16+
if ([self getRules] == nil) {
17+
return nil;
18+
}
19+
20+
NSDictionary *dicOperations = @{@"is_pic_info":_is_pic_info ? @(1):@(0),@"rules":[self getRules]};
21+
QCloudLogInfo(@"水印生成成功————%@",[dicOperations qcloud_modelToJSONString]);
22+
return [dicOperations qcloud_modelToJSONString];
23+
}
24+
25+
-(NSArray *)getRules{
26+
NSMutableArray * rules = [NSMutableArray arrayWithCapacity:0];
27+
for (QCloudPicOperationRule * item in _rule) {
28+
if (item.rule == nil ) {
29+
return nil;
30+
}
31+
32+
if (item.fileid == nil) {
33+
QCloudLogError(@"[%@]QCloudPicOperationRule的fileid不能为空",self.class);
34+
return nil;
35+
}
36+
37+
[rules addObject:@{@"fileid":item.fileid,@"rule":item.rule}];
38+
}
39+
if (rules.count > 5) {
40+
return [rules subarrayWithRange:NSMakeRange(0, 5)];
41+
}
42+
return rules.copy;
43+
}
44+
45+
@end
46+
47+
@implementation QCloudPicOperationRule
48+
49+
-(NSString *)rule{
50+
// 直接指定rule;若无指定,则按照用户输入生成rule;
51+
if (_rule != nil) {
52+
return _rule;
53+
}
54+
55+
if (_type == 0 || _type > 3) {
56+
QCloudLogError(@"水印类型错误");
57+
return nil;
58+
}
59+
60+
NSMutableString * strRule = [NSMutableString stringWithString:@"watermark/3/type"];
61+
62+
[strRule appendFormat:@"/%ld",_type];
63+
64+
if (_type == QCloudPicOperationRuleFull || _type == QCloudPicOperationRuleHalf) {
65+
if (_imageURL == nil) {
66+
QCloudLogError(@"[%@]生成水印错误————半盲和全盲水印必须指定图片链接",self.class);
67+
return nil;
68+
}
69+
NSData *data = [_imageURL dataUsingEncoding:NSUTF8StringEncoding];
70+
NSString* base64ImageUrl = [data base64EncodedStringWithOptions:0];
71+
[strRule appendFormat:@"/image/%@",base64ImageUrl];
72+
if (_type == QCloudPicOperationRuleFull) {
73+
if (_level < 1) {
74+
[strRule appendString:@"/level/1"];
75+
}else if (_level > 3) {
76+
[strRule appendString:@"/level/3"];
77+
}else{
78+
[strRule appendFormat:@"/level/%ld",_level];
79+
}
80+
}
81+
}else{
82+
if (_text == nil) {
83+
QCloudLogError(@"[%@]文本型水印请传入水印文字",self.class);
84+
return nil;
85+
}
86+
87+
if (![_text matchesRegularExpression:@"[a-zA-Z0-9]+"]) {
88+
QCloudLogError(@"[%@]文本型水印的文本仅支持[a-zA-Z0-9]",self.class);
89+
return nil;
90+
}
91+
92+
[strRule appendFormat:@"/text/%@",_text];
93+
}
94+
95+
return strRule;
96+
}
97+
98+
99+
@end
100+
101+

QCloudCOSXML/Classes/Base/select/QCloudInputSerialization.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
#import "QCloudSerializationJSON.h"
3333

3434
NS_ASSUME_NONNULL_BEGIN
35+
/**
36+
描述待检索对象的格式
37+
*/
3538
@interface QCloudInputSerialization : NSObject
3639
/**
3740
描述待检索对象的压缩格式:

QCloudCOSXML/Classes/Base/select/QCloudOutputSerialization.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
#import "QCloudSerializationJSON.h"
3232

3333
NS_ASSUME_NONNULL_BEGIN
34+
/**
35+
描述检索结果的输出格式
36+
*/
3437
@interface QCloudOutputSerialization : NSObject
3538
/**
3639
描述在CSV对象格式下所需的文件参数。

0 commit comments

Comments
 (0)