Commit dd5a2268dbf3ae55c75fa1c8acdbcea11b463f98

Authored by zhangxiaowen
1 parent 70a58026

no message

CNLiveQrCodeModule.podspec
@@ -87,5 +87,8 @@ TODO: 网家家-二维码模块. @@ -87,5 +87,8 @@ TODO: 网家家-二维码模块.
87 87
88 # 管理类 88 # 管理类
89 s.dependency 'CNLiveManager' 89 s.dependency 'CNLiveManager'
  90 +
  91 + # 分类
  92 + s.dependency 'CNLiveCategory'
90 93
91 end 94 end
CNLiveQrCodeModule/Classes/Controller/CNLiveGenerateQrCodeController.m
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 #import "QMUIKit.h" 13 #import "QMUIKit.h"
14 #import <Masonry/Masonry.h> 14 #import <Masonry/Masonry.h>
15 #import <SDWebImage/SDWebImage.h> 15 #import <SDWebImage/SDWebImage.h>
  16 +#import "CNLiveCategory.h"
16 17
17 #import "CNLiveQrCodeNavigationBar.h" 18 #import "CNLiveQrCodeNavigationBar.h"
18 #import "CNLiveGenerateCodeView.h" 19 #import "CNLiveGenerateCodeView.h"
@@ -234,26 +235,10 @@ static const CGFloat timeValue = 1.5; @@ -234,26 +235,10 @@ static const CGFloat timeValue = 1.5;
234 _navigationBar = [[CNLiveQrCodeNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)]; 235 _navigationBar = [[CNLiveQrCodeNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)];
235 _navigationBar.delegate = self; 236 _navigationBar.delegate = self;
236 _navigationBar.title.text = @"生成二维码"; 237 _navigationBar.title.text = @"生成二维码";
237 - UIImage *image2 = [self xw_getImageName:@"mine_code_more" bundleName:@"CNLiveQrCodeModule" targetClass:[self class]]; 238 + UIImage *image2 = [UIImage cn_getImageName:@"mine_code_more" bundleName:@"CNLiveQrCodeModule" targetClass:[self class]];
238 [_navigationBar.right setImage:[image2 imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; 239 [_navigationBar.right setImage:[image2 imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
239 } 240 }
240 return _navigationBar; 241 return _navigationBar;
241 } 242 }
242 243
243 -/**  
244 - * 创建图片  
245 - *  
246 - * @param imageName 图片名字  
247 - * @param bundleName 图片所在的bundle名字  
248 - * @param targetClass 类和bundle的同级目录  
249 - * @return 返回UIImage  
250 - */  
251 -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{  
252 - NSBundle *bundle = [NSBundle bundleForClass:targetClass];  
253 - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"];  
254 - NSBundle *targetBundle = [NSBundle bundleWithURL:url];  
255 - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil];  
256 - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];  
257 -}  
258 -  
259 @end 244 @end
CNLiveQrCodeModule/Classes/Controller/CNLiveGroupQrCodeController.m
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 13
14 //#import "CNLiveShareManager.h" 14 //#import "CNLiveShareManager.h"
15 //#import "CNLiveShareToolDefine.h" 15 //#import "CNLiveShareToolDefine.h"
  16 +#import "CNLiveCategory.h"
16 17
17 #import "CNLiveQrCodeNavigationBar.h" 18 #import "CNLiveQrCodeNavigationBar.h"
18 #import "CNLiveGroupQrcodeView.h" 19 #import "CNLiveGroupQrcodeView.h"
@@ -86,7 +87,7 @@ static const CGFloat timeValue = 1.5; @@ -86,7 +87,7 @@ static const CGFloat timeValue = 1.5;
86 _navigationBar = [[CNLiveQrCodeNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)]; 87 _navigationBar = [[CNLiveQrCodeNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)];
87 _navigationBar.backgroundColor = [UIColor whiteColor]; 88 _navigationBar.backgroundColor = [UIColor whiteColor];
88 _navigationBar.delegate = self; 89 _navigationBar.delegate = self;
89 - UIImage *image = [self xw_getImageName:@"code_back_black_b" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveGroupQrCodeController class]]; 90 + UIImage *image = [UIImage cn_getImageName:@"code_back_black_b" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveGroupQrCodeController class]];
90 [_navigationBar.left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; 91 [_navigationBar.left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
91 _navigationBar.title.text = @"群二维码名片"; 92 _navigationBar.title.text = @"群二维码名片";
92 _navigationBar.title.textColor = [UIColor blackColor]; 93 _navigationBar.title.textColor = [UIColor blackColor];
@@ -203,20 +204,4 @@ static const CGFloat timeValue = 1.5; @@ -203,20 +204,4 @@ static const CGFloat timeValue = 1.5;
203 return newImage; 204 return newImage;
204 } 205 }
205 206
206 -/**  
207 - * 创建图片  
208 - *  
209 - * @param imageName 图片名字  
210 - * @param bundleName 图片所在的bundle名字  
211 - * @param targetClass 类和bundle的同级目录  
212 - * @return 返回UIImage  
213 - */  
214 -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{  
215 - NSBundle *bundle = [NSBundle bundleForClass:targetClass];  
216 - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"];  
217 - NSBundle *targetBundle = [NSBundle bundleWithURL:url];  
218 - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil];  
219 - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];  
220 -}  
221 -  
222 @end 207 @end
CNLiveQrCodeModule/Classes/Controller/CNLiveMyQrCodeController.m
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 #import "QMUIKit.h" 13 #import "QMUIKit.h"
14 #import <Masonry/Masonry.h> 14 #import <Masonry/Masonry.h>
15 #import <SDWebImage/SDWebImage.h> 15 #import <SDWebImage/SDWebImage.h>
  16 +#import "CNLiveCategory.h"
16 17
17 #import "CNLiveQrCodeNavigationBar.h" 18 #import "CNLiveQrCodeNavigationBar.h"
18 #import "CNLiveMyQrCodeView.h" 19 #import "CNLiveMyQrCodeView.h"
@@ -228,7 +229,7 @@ static const CGFloat timeValue = 1.5; @@ -228,7 +229,7 @@ static const CGFloat timeValue = 1.5;
228 - (UIImageView *)bgView{ 229 - (UIImageView *)bgView{
229 if(!_bgView){ 230 if(!_bgView){
230 _bgView = [[UIImageView alloc]initWithFrame:self.view.bounds]; 231 _bgView = [[UIImageView alloc]initWithFrame:self.view.bounds];
231 - UIImage *image = [self xw_getImageName:@"qr_code_bg" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveMyQrCodeController class]]; 232 + UIImage *image = [UIImage cn_getImageName:@"qr_code_bg" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveMyQrCodeController class]];
232 [_bgView sd_setImageWithURL:[NSURL URLWithString:@"User_Head"] placeholderImage:image completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) { 233 [_bgView sd_setImageWithURL:[NSURL URLWithString:@"User_Head"] placeholderImage:image completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
233 }]; 234 }];
234 } 235 }
@@ -247,26 +248,10 @@ static const CGFloat timeValue = 1.5; @@ -247,26 +248,10 @@ static const CGFloat timeValue = 1.5;
247 _navigationBar = [[CNLiveQrCodeNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)]; 248 _navigationBar = [[CNLiveQrCodeNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)];
248 _navigationBar.delegate = self; 249 _navigationBar.delegate = self;
249 _navigationBar.title.text = @"我的二维码"; 250 _navigationBar.title.text = @"我的二维码";
250 - UIImage *image2 = [self xw_getImageName:@"mine_code_more" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveMyQrCodeController class]]; 251 + UIImage *image2 = [UIImage cn_getImageName:@"mine_code_more" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveMyQrCodeController class]];
251 [_navigationBar.right setImage:[image2 imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; 252 [_navigationBar.right setImage:[image2 imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
252 } 253 }
253 return _navigationBar; 254 return _navigationBar;
254 } 255 }
255 256
256 -/**  
257 - * 创建图片  
258 - *  
259 - * @param imageName 图片名字  
260 - * @param bundleName 图片所在的bundle名字  
261 - * @param targetClass 类和bundle的同级目录  
262 - * @return 返回UIImage  
263 - */  
264 -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{  
265 - NSBundle *bundle = [NSBundle bundleForClass:targetClass];  
266 - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"];  
267 - NSBundle *targetBundle = [NSBundle bundleWithURL:url];  
268 - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil];  
269 - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];  
270 -}  
271 -  
272 @end 257 @end
CNLiveQrCodeModule/Classes/Controller/CNLiveScanQrCodeController.m
@@ -12,6 +12,7 @@ @@ -12,6 +12,7 @@
12 #import "QMUIKit.h" 12 #import "QMUIKit.h"
13 13
14 #import "SGQRCode.h"//二维码库 14 #import "SGQRCode.h"//二维码库
  15 +#import "CNLiveCategory.h"
15 16
16 #import "CNLiveMyQrCodeController.h" 17 #import "CNLiveMyQrCodeController.h"
17 #import "CNLiveQrCodeNavigationBar.h" 18 #import "CNLiveQrCodeNavigationBar.h"
@@ -299,8 +300,8 @@ static const CGFloat timeValue = 1.5; @@ -299,8 +300,8 @@ static const CGFloat timeValue = 1.5;
299 CGFloat flashlightBtnX = 0.5 * (self.view.frame.size.width - flashlightBtnW); 300 CGFloat flashlightBtnX = 0.5 * (self.view.frame.size.width - flashlightBtnW);
300 CGFloat flashlightBtnY = 0.55 * self.view.frame.size.height; 301 CGFloat flashlightBtnY = 0.55 * self.view.frame.size.height;
301 _flashlightBtn.frame = CGRectMake(flashlightBtnX, flashlightBtnY, flashlightBtnW, flashlightBtnH); 302 _flashlightBtn.frame = CGRectMake(flashlightBtnX, flashlightBtnY, flashlightBtnW, flashlightBtnH);
302 - UIImage *image1 = [self xw_getImageName:@"flashlight_close" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveScanQrCodeController class]];  
303 - UIImage *image2 = [self xw_getImageName:@"flashlight_open" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveScanQrCodeController class]]; 303 + UIImage *image1 = [UIImage cn_getImageName:@"flashlight_close" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveScanQrCodeController class]];
  304 + UIImage *image2 = [UIImage cn_getImageName:@"flashlight_open" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveScanQrCodeController class]];
304 [_flashlightBtn setImage:image1 forState:UIControlStateNormal]; 305 [_flashlightBtn setImage:image1 forState:UIControlStateNormal];
305 [_flashlightBtn setImage:image2 forState:UIControlStateSelected]; 306 [_flashlightBtn setImage:image2 forState:UIControlStateSelected];
306 [_flashlightBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 307 [_flashlightBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
@@ -342,7 +343,7 @@ static const CGFloat timeValue = 1.5; @@ -342,7 +343,7 @@ static const CGFloat timeValue = 1.5;
342 CGFloat flashlightBtnX = 0.5 * (self.view.frame.size.width - flashlightBtnW); 343 CGFloat flashlightBtnX = 0.5 * (self.view.frame.size.width - flashlightBtnW);
343 CGFloat flashlightBtnY = CGRectGetMaxY(self.promptLabel.frame)+15; 344 CGFloat flashlightBtnY = CGRectGetMaxY(self.promptLabel.frame)+15;
344 _codeButton.frame = CGRectMake(flashlightBtnX, flashlightBtnY, flashlightBtnW, flashlightBtnH); 345 _codeButton.frame = CGRectMake(flashlightBtnX, flashlightBtnY, flashlightBtnW, flashlightBtnH);
345 - UIImage *image = [self xw_getImageName:@"qr_code_green" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveScanQrCodeController class]]; 346 + UIImage *image = [UIImage cn_getImageName:@"qr_code_green" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveScanQrCodeController class]];
346 [_codeButton setImage:image forState:UIControlStateNormal]; 347 [_codeButton setImage:image forState:UIControlStateNormal];
347 [_codeButton setTitle:@"我的二维码" forState:UIControlStateNormal]; 348 [_codeButton setTitle:@"我的二维码" forState:UIControlStateNormal];
348 _codeButton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:15.0f]; 349 _codeButton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:15.0f];
@@ -396,20 +397,5 @@ static const CGFloat timeValue = 1.5; @@ -396,20 +397,5 @@ static const CGFloat timeValue = 1.5;
396 397
397 398
398 } 399 }
399 -/**  
400 - * 创建图片  
401 - *  
402 - * @param imageName 图片名字  
403 - * @param bundleName 图片所在的bundle名字  
404 - * @param targetClass 类和bundle的同级目录  
405 - * @return 返回UIImage  
406 - */  
407 -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{  
408 - NSBundle *bundle = [NSBundle bundleForClass:targetClass];  
409 - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"];  
410 - NSBundle *targetBundle = [NSBundle bundleWithURL:url];  
411 - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil];  
412 - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];  
413 -}  
414 400
415 @end 401 @end
CNLiveQrCodeModule/Classes/Controller/CNLiveScanResultController.m
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 8
9 #import "CNLiveScanResultController.h" 9 #import "CNLiveScanResultController.h"
10 #import "QMUIKit.h" 10 #import "QMUIKit.h"
  11 +#import "CNLiveCategory.h"
11 12
12 #import "CNLiveQrCodeNavigationBar.h" 13 #import "CNLiveQrCodeNavigationBar.h"
13 #import "CNLiveWebView.h" 14 #import "CNLiveWebView.h"
@@ -78,7 +79,7 @@ @@ -78,7 +79,7 @@
78 _navigationBar.title.textColor = [UIColor blackColor]; 79 _navigationBar.title.textColor = [UIColor blackColor];
79 _navigationBar.delegate = self; 80 _navigationBar.delegate = self;
80 81
81 - UIImage *image = [self xw_getImageName:@"code_back_black_b" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveScanResultController class]]; 82 + UIImage *image = [UIImage cn_getImageName:@"code_back_black_b" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveScanResultController class]];
82 [_navigationBar.left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; 83 [_navigationBar.left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
83 _navigationBar.right = nil; 84 _navigationBar.right = nil;
84 85
@@ -105,20 +106,5 @@ @@ -105,20 +106,5 @@
105 [self.navigationController popViewControllerAnimated:YES]; 106 [self.navigationController popViewControllerAnimated:YES];
106 } 107 }
107 } 108 }
108 -/**  
109 - * 创建图片  
110 - *  
111 - * @param imageName 图片名字  
112 - * @param bundleName 图片所在的bundle名字  
113 - * @param targetClass 类和bundle的同级目录  
114 - * @return 返回UIImage  
115 - */  
116 -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{  
117 - NSBundle *bundle = [NSBundle bundleForClass:targetClass];  
118 - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"];  
119 - NSBundle *targetBundle = [NSBundle bundleWithURL:url];  
120 - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil];  
121 - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];  
122 -}  
123 109
124 @end 110 @end
CNLiveQrCodeModule/Classes/View/CNLiveGenerateCodeView.m
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 #import "SGQRCode.h"//二维码库 13 #import "SGQRCode.h"//二维码库
14 14
15 #import "CNUserInfoManager.h" 15 #import "CNUserInfoManager.h"
  16 +#import "CNLiveCategory.h"
16 17
17 #import "CNLiveNetworking.h" 18 #import "CNLiveNetworking.h"
18 #import "CNLiveEnvironment.h" 19 #import "CNLiveEnvironment.h"
@@ -90,17 +91,14 @@ static const NSInteger margin = 20; @@ -90,17 +91,14 @@ static const NSInteger margin = 20;
90 91
91 } 92 }
92 93
93 -// 重置二维码  
94 - (void)generateQRCode:(NSString *)ID{ 94 - (void)generateQRCode:(NSString *)ID{
95 - //  
96 -// NSDictionary *dic = @{@"content":[EncryptAndDecrypt base64StringFromText:ID encryptKey:AppDESKey],@"type":@"user"};  
97 - NSDictionary *jsonDic = @{@"content":ID?ID:@"",@"type":@"orderCode"}; 95 + NSDictionary *jsonDic = @{@"content":[NSString base64StringFromText:ID?ID:@"" encryptKey:AppDESKey],@"type":@"orderCode"};
98 96
99 NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsonDic options:NSJSONWritingPrettyPrinted error:nil]; 97 NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsonDic options:NSJSONWritingPrettyPrinted error:nil];
100 98
101 NSString *jsonStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; 99 NSString *jsonStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
102 100
103 - UIImage *xw_image = [self xw_getImageName:@"qr_code_icon" bundleName:@"CNLiveQrCodeModule" targetClass:[self class]]; 101 + UIImage *xw_image = [UIImage cn_getImageName:@"qr_code_icon" bundleName:@"CNLiveQrCodeModule" targetClass:[self class]];
104 [self.qrCode sd_setImageWithURL:nil placeholderImage:[SGQRCodeObtain generateQRCodeWithData:jsonStr size:SCREEN_WIDTH-12*margin logoImage:xw_image ratio:0.2]]; 102 [self.qrCode sd_setImageWithURL:nil placeholderImage:[SGQRCodeObtain generateQRCodeWithData:jsonStr size:SCREEN_WIDTH-12*margin logoImage:xw_image ratio:0.2]];
105 103
106 } 104 }
@@ -126,7 +124,7 @@ static const NSInteger margin = 20; @@ -126,7 +124,7 @@ static const NSInteger margin = 20;
126 _header = [[UIImageView alloc] init]; 124 _header = [[UIImageView alloc] init];
127 _header.layer.masksToBounds = YES; 125 _header.layer.masksToBounds = YES;
128 _header.layer.cornerRadius = 5; 126 _header.layer.cornerRadius = 5;
129 - UIImage *xw_image = [self xw_getImageName:@"default_avatar_f" bundleName:@"CNLiveQrCodeModule" targetClass:[self class]]; 127 + UIImage *xw_image = [UIImage cn_getImageName:@"default_avatar_f" bundleName:@"CNLiveQrCodeModule" targetClass:[self class]];
130 [_header sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.faceUrl] placeholderImage:xw_image]; 128 [_header sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.faceUrl] placeholderImage:xw_image];
131 } 129 }
132 return _header; 130 return _header;
@@ -170,21 +168,4 @@ static const NSInteger margin = 20; @@ -170,21 +168,4 @@ static const NSInteger margin = 20;
170 return _desc; 168 return _desc;
171 } 169 }
172 170
173 -/**  
174 - * 创建图片  
175 - *  
176 - * @param imageName 图片名字  
177 - * @param bundleName 图片所在的bundle名字  
178 - * @param targetClass 类和bundle的同级目录  
179 - * @return 返回UIImage  
180 - */  
181 -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{  
182 - NSBundle *bundle = [NSBundle bundleForClass:targetClass];  
183 - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"];  
184 - NSBundle *targetBundle = [NSBundle bundleWithURL:url];  
185 - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil];  
186 - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];  
187 -  
188 -}  
189 -  
190 @end 171 @end
CNLiveQrCodeModule/Classes/View/CNLiveGroupQrCodeView.m
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 #import "SGQRCode.h"//二维码库 13 #import "SGQRCode.h"//二维码库
14 14
15 #import "CNUserInfoManager.h" 15 #import "CNUserInfoManager.h"
  16 +#import "CNLiveCategory.h"
16 17
17 @interface CNLiveGroupQrCodeView() 18 @interface CNLiveGroupQrCodeView()
18 @property (nonatomic, strong) UIImageView *groupHead; 19 @property (nonatomic, strong) UIImageView *groupHead;
@@ -105,7 +106,7 @@ static const NSInteger margin = 15; @@ -105,7 +106,7 @@ static const NSInteger margin = 15;
105 if (!_groupHead) { 106 if (!_groupHead) {
106 _groupHead = [[UIImageView alloc] init]; 107 _groupHead = [[UIImageView alloc] init];
107 _groupHead.backgroundColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0]; 108 _groupHead.backgroundColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
108 - UIImage *xw_image = [self xw_getImageName:@"default_avatar_f" bundleName:@"CNLiveQrCodeModule" targetClass:[self class]]; 109 + UIImage *xw_image = [UIImage cn_getImageName:@"default_avatar_f" bundleName:@"CNLiveQrCodeModule" targetClass:[self class]];
109 [_groupHead sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.faceUrl] placeholderImage:xw_image]; 110 [_groupHead sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.faceUrl] placeholderImage:xw_image];
110 111
111 } 112 }
@@ -144,21 +145,4 @@ static const NSInteger margin = 15; @@ -144,21 +145,4 @@ static const NSInteger margin = 15;
144 return _desc; 145 return _desc;
145 } 146 }
146 147
147 -/**  
148 - * 创建图片  
149 - *  
150 - * @param imageName 图片名字  
151 - * @param bundleName 图片所在的bundle名字  
152 - * @param targetClass 类和bundle的同级目录  
153 - * @return 返回UIImage  
154 - */  
155 -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{  
156 - NSBundle *bundle = [NSBundle bundleForClass:targetClass];  
157 - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"];  
158 - NSBundle *targetBundle = [NSBundle bundleWithURL:url];  
159 - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil];  
160 - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];  
161 -  
162 -}  
163 -  
164 @end 148 @end
CNLiveQrCodeModule/Classes/View/CNLiveMyQrCodeView.m
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
13 #import "SGQRCode.h"//二维码库 13 #import "SGQRCode.h"//二维码库
14 14
15 #import "CNUserInfoManager.h" 15 #import "CNUserInfoManager.h"
  16 +#import "CNLiveCategory.h"
16 17
17 #import "CNLiveNetworking.h" 18 #import "CNLiveNetworking.h"
18 #import "CNLiveEnvironment.h" 19 #import "CNLiveEnvironment.h"
@@ -119,12 +120,11 @@ static const CGFloat timeValue = 1.5; @@ -119,12 +120,11 @@ static const CGFloat timeValue = 1.5;
119 if(!error&&[responseObject isKindOfClass:[NSDictionary class]]){ 120 if(!error&&[responseObject isKindOfClass:[NSDictionary class]]){
120 //对content 先加密 再转为 json 字符串 121 //对content 先加密 再转为 json 字符串
121 NSDictionary *dic = (NSDictionary *)responseObject; 122 NSDictionary *dic = (NSDictionary *)responseObject;
122 -// NSDictionary *dic = @{@"content":[EncryptAndDecrypt base64StringFromText:data[@"qrcode"] encryptKey:AppDESKey],@"type":@"user"};  
123 - NSDictionary *jsonDic = @{@"content":dic[@"data"][@"qrcode"],@"type":@"user"}; 123 + NSDictionary *jsonDic = @{@"content":[NSString base64StringFromText:dic[@"data"][@"qrcode"] encryptKey:AppDESKey],@"type":@"user"};
124 NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsonDic options:NSJSONWritingPrettyPrinted error:nil]; 124 NSData *jsonData = [NSJSONSerialization dataWithJSONObject:jsonDic options:NSJSONWritingPrettyPrinted error:nil];
125 NSString *jsonStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; 125 NSString *jsonStr = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
126 126
127 - UIImage *xw_image = [self xw_getImageName:@"qr_code_icon" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveMyQrCodeView class]]; 127 + UIImage *xw_image = [UIImage cn_getImageName:@"qr_code_icon" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveMyQrCodeView class]];
128 [strongSelf.qrCode sd_setImageWithURL:nil placeholderImage:[SGQRCodeObtain generateQRCodeWithData:jsonStr size:SCREEN_WIDTH-12*margin logoImage:xw_image ratio:0.2]]; 128 [strongSelf.qrCode sd_setImageWithURL:nil placeholderImage:[SGQRCodeObtain generateQRCodeWithData:jsonStr size:SCREEN_WIDTH-12*margin logoImage:xw_image ratio:0.2]];
129 129
130 if([type isEqualToString:@"reset"]){ 130 if([type isEqualToString:@"reset"]){
@@ -162,7 +162,7 @@ static const CGFloat timeValue = 1.5; @@ -162,7 +162,7 @@ static const CGFloat timeValue = 1.5;
162 _header = [[UIImageView alloc] init]; 162 _header = [[UIImageView alloc] init];
163 _header.layer.masksToBounds = YES; 163 _header.layer.masksToBounds = YES;
164 _header.layer.cornerRadius = 5; 164 _header.layer.cornerRadius = 5;
165 - UIImage *xw_image = [self xw_getImageName:@"default_avatar_f" bundleName:@"CNLiveQrCodeModule" targetClass:[self class]]; 165 + UIImage *xw_image = [UIImage cn_getImageName:@"default_avatar_f" bundleName:@"CNLiveQrCodeModule" targetClass:[self class]];
166 [_header sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.faceUrl] placeholderImage:xw_image]; 166 [_header sd_setImageWithURL:[NSURL URLWithString:CNUserShareModel.faceUrl] placeholderImage:xw_image];
167 } 167 }
168 return _header; 168 return _header;
@@ -206,21 +206,4 @@ static const CGFloat timeValue = 1.5; @@ -206,21 +206,4 @@ static const CGFloat timeValue = 1.5;
206 return _friends; 206 return _friends;
207 } 207 }
208 208
209 -/**  
210 - * 创建图片  
211 - *  
212 - * @param imageName 图片名字  
213 - * @param bundleName 图片所在的bundle名字  
214 - * @param targetClass 类和bundle的同级目录  
215 - * @return 返回UIImage  
216 - */  
217 -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{  
218 - NSBundle *bundle = [NSBundle bundleForClass:targetClass];  
219 - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"];  
220 - NSBundle *targetBundle = [NSBundle bundleWithURL:url];  
221 - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil];  
222 - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];  
223 -  
224 -}  
225 -  
226 @end 209 @end
CNLiveQrCodeModule/Classes/View/CNLiveQrCodeNavigationBar.m
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 8
9 #import "CNLiveQrCodeNavigationBar.h" 9 #import "CNLiveQrCodeNavigationBar.h"
10 #import "QMUIKit.h" 10 #import "QMUIKit.h"
  11 +#import "CNLiveCategory.h"
11 12
12 @interface CNLiveQrCodeNavigationBar () 13 @interface CNLiveQrCodeNavigationBar ()
13 14
@@ -59,7 +60,7 @@ static const NSInteger margin = 15; @@ -59,7 +60,7 @@ static const NSInteger margin = 15;
59 _left= [UIButton buttonWithType:UIButtonTypeCustom]; 60 _left= [UIButton buttonWithType:UIButtonTypeCustom];
60 _left.adjustsImageWhenHighlighted = NO; 61 _left.adjustsImageWhenHighlighted = NO;
61 _left.frame = CGRectMake(margin, StatusBarHeight, NavigationBarHeight, NavigationBarHeight); 62 _left.frame = CGRectMake(margin, StatusBarHeight, NavigationBarHeight, NavigationBarHeight);
62 - UIImage *image = [self xw_getImageName:@"mine_back_white_b" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveQrCodeNavigationBar class]]; 63 + UIImage *image = [UIImage cn_getImageName:@"mine_back_white_b" bundleName:@"CNLiveQrCodeModule" targetClass:[CNLiveQrCodeNavigationBar class]];
63 [_left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; 64 [_left setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
64 [_left setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft]; 65 [_left setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
65 [_left addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside]; 66 [_left addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
@@ -102,21 +103,4 @@ static const NSInteger margin = 15; @@ -102,21 +103,4 @@ static const NSInteger margin = 15;
102 } 103 }
103 } 104 }
104 105
105 -/**  
106 - * 创建图片  
107 - *  
108 - * @param imageName 图片名字  
109 - * @param bundleName 图片所在的bundle名字  
110 - * @param targetClass 类和bundle的同级目录  
111 - * @return 返回UIImage  
112 - */  
113 -- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{  
114 - NSBundle *bundle = [NSBundle bundleForClass:targetClass];  
115 - NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"];  
116 - NSBundle *targetBundle = [NSBundle bundleWithURL:url];  
117 - UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil];  
118 - return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil];  
119 -  
120 -}  
121 -  
122 @end 106 @end
Example/CNLiveQrCodeModule.xcodeproj/project.pbxproj
@@ -351,6 +351,7 @@ @@ -351,6 +351,7 @@
351 "${PODS_ROOT}/Target Support Files/Pods-CNLiveQrCodeModule_Example/Pods-CNLiveQrCodeModule_Example-frameworks.sh", 351 "${PODS_ROOT}/Target Support Files/Pods-CNLiveQrCodeModule_Example/Pods-CNLiveQrCodeModule_Example-frameworks.sh",
352 "${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework", 352 "${BUILT_PRODUCTS_DIR}/AFNetworking/AFNetworking.framework",
353 "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework", 353 "${BUILT_PRODUCTS_DIR}/CNLiveBeeHive/CNLiveBeeHive.framework",
  354 + "${BUILT_PRODUCTS_DIR}/CNLiveCategory/CNLiveCategory.framework",
354 "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework", 355 "${BUILT_PRODUCTS_DIR}/CNLiveEnvironment/CNLiveEnvironment.framework",
355 "${BUILT_PRODUCTS_DIR}/CNLiveManager/CNLiveManager.framework", 356 "${BUILT_PRODUCTS_DIR}/CNLiveManager/CNLiveManager.framework",
356 "${BUILT_PRODUCTS_DIR}/CNLiveQrCodeModule/CNLiveQrCodeModule.framework", 357 "${BUILT_PRODUCTS_DIR}/CNLiveQrCodeModule/CNLiveQrCodeModule.framework",
@@ -367,6 +368,7 @@ @@ -367,6 +368,7 @@
367 outputPaths = ( 368 outputPaths = (
368 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework", 369 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AFNetworking.framework",
369 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework", 370 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveBeeHive.framework",
  371 + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveCategory.framework",
370 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework", 372 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveEnvironment.framework",
371 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveManager.framework", 373 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveManager.framework",
372 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveQrCodeModule.framework", 374 "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CNLiveQrCodeModule.framework",