Skip to content

Commit b04fdaf

Browse files
author
garenwang
committed
fix:uikit修复
1 parent dd698c1 commit b04fdaf

File tree

3 files changed

+46
-47
lines changed

3 files changed

+46
-47
lines changed

QCloudCOSXML/Classes/CI/request/QCloudGetFilePreviewHtmlRequest.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#import <Foundation/Foundation.h>
3333
#import <QCloudCore/QCloudCore.h>
3434
#import "QCloudGetFilePreviewHtmlResult.h"
35-
#import <UIKit/UIKit.h>
3635
NS_ASSUME_NONNULL_BEGIN
3736

3837
/**
@@ -103,7 +102,7 @@ NS_ASSUME_NONNULL_BEGIN
103102
/**
104103
水印 RGBA(颜色和透明度)
105104
*/
106-
@property (strong, nonatomic)UIColor * htmlfillstyle;
105+
@property (strong, nonatomic)NSString * htmlfillstyle;
107106

108107
/**
109108
水印文字样式 bold 20px Serif 默认

QCloudCOSXML/Classes/CI/request/QCloudGetFilePreviewHtmlRequest.m

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ - (BOOL)buildRequestData:(NSError *__autoreleasing *)error {
104104
[self.requestData setQueryStringParamter:[self base64EncodeString:self.htmlwaterword] withKey:@"htmlwaterword"];
105105

106106
if (self.htmlfillstyle != nil) {
107-
[self.requestData setQueryStringParamter:[self colorToString:self.htmlfillstyle] withKey:@"htmlfillstyle"];
107+
[self.requestData setQueryStringParamter:self.htmlfillstyle withKey:@"htmlfillstyle"];
108108
}
109109

110110
if (self.htmlfront != nil) {
@@ -157,50 +157,50 @@ - (QCloudSignatureFields *)signatureFields {
157157

158158
return fileds;
159159
}
160-
- (NSArray<NSMutableDictionary *> *)scopesArray {
161-
NSMutableDictionary *dic = [NSMutableDictionary dictionary];
162-
NSArray *separatetmpArray = [self.requestData.serverURL componentsSeparatedByString:@"://"];
163-
NSString *str = separatetmpArray[1];
164-
NSArray *separateArray = [str componentsSeparatedByString:@"."];
165-
dic[@"bucket"] = separateArray[0];
166-
dic[@"region"] = self.runOnService.configuration.endpoint.regionName;
167-
dic[@"prefix"] = self.object;
168-
dic[@"action"] = @"name/cos:GetObject";
169-
NSMutableArray *array = [NSMutableArray array];
170-
[array addObject:dic];
171-
return [array copy];
172-
}
173-
174-
- (NSString *)colorToString:(UIColor *)color {
175-
176-
CGFloat red, green, blue, alpha;
177-
#if SD_UIKIT
178-
if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
179-
[color getWhite:&red alpha:&alpha];
180-
green = red;
181-
blue = red;
182-
alpha = 1;
183-
}
184-
#else
185-
@try {
186-
[color getRed:&red green:&green blue:&blue alpha:&alpha];
187-
}
188-
@catch (NSException *exception) {
189-
[color getWhite:&red alpha:&alpha];
190-
green = red;
191-
blue = red;
192-
alpha = 1;
193-
}
194-
#endif
195-
196-
red = roundf(red * 255.f);
197-
green = roundf(green * 255.f);
198-
blue = roundf(blue * 255.f);
199-
alpha = round(alpha * 255.f);
200-
uint hex = (((uint)red << 16) | ((uint)green << 8) | ((uint)blue));
201-
202-
return [self base64EncodeString:[NSString stringWithFormat:@"%06x", hex]];
203-
}
160+
//- (NSArray<NSMutableDictionary *> *)scopesArray {
161+
// NSMutableDictionary *dic = [NSMutableDictionary dictionary];
162+
// NSArray *separatetmpArray = [self.requestData.serverURL componentsSeparatedByString:@"://"];
163+
// NSString *str = separatetmpArray[1];
164+
// NSArray *separateArray = [str componentsSeparatedByString:@"."];
165+
// dic[@"bucket"] = separateArray[0];
166+
// dic[@"region"] = self.runOnService.configuration.endpoint.regionName;
167+
// dic[@"prefix"] = self.object;
168+
// dic[@"action"] = @"name/cos:GetObject";
169+
// NSMutableArray *array = [NSMutableArray array];
170+
// [array addObject:dic];
171+
// return [array copy];
172+
//}
173+
//
174+
//- (NSString *)colorToString:(UIColor *)color {
175+
//
176+
// CGFloat red, green, blue, alpha;
177+
//#if SD_UIKIT
178+
// if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
179+
// [color getWhite:&red alpha:&alpha];
180+
// green = red;
181+
// blue = red;
182+
// alpha = 1;
183+
// }
184+
//#else
185+
// @try {
186+
// [color getRed:&red green:&green blue:&blue alpha:&alpha];
187+
// }
188+
// @catch (NSException *exception) {
189+
// [color getWhite:&red alpha:&alpha];
190+
// green = red;
191+
// blue = red;
192+
// alpha = 1;
193+
// }
194+
//#endif
195+
//
196+
// red = roundf(red * 255.f);
197+
// green = roundf(green * 255.f);
198+
// blue = roundf(blue * 255.f);
199+
// alpha = round(alpha * 255.f);
200+
// uint hex = (((uint)red << 16) | ((uint)green << 8) | ((uint)blue));
201+
//
202+
// return [self base64EncodeString:[NSString stringWithFormat:@"%06x", hex]];
203+
//}
204204

205205
- (NSString *)base64EncodeString:(NSString *)string{
206206
NSData *data =[string dataUsingEncoding:NSUTF8StringEncoding];
Binary file not shown.

0 commit comments

Comments
 (0)